Research on software design of brain wave therapeutic instrument based on single chip microcomputer

Publisher:JoyfulSerenadeLatest update time:2011-12-16 Keywords:brainwave Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
O Introduction
According to the research of modern electrophysiological neuropsychology, brain wave activity is mainly divided into four groups of patterns according to specific wavelengths: β, α, θ, and δ. A certain pattern of brain wave activity is associated with a specific mental state. The brain wave therapy device is a new type of medical instrument. It uses bioinformatics simulation technology based on the principles of brain wave synchronization and brain wave frequency guidance, and uses a computer to simulate brain waves of various frequencies, and modulates them into brain wave music signals to feed back to the user, affecting and regulating the level of human brain wave activity and excitement, so that the brain is often in a specific brain wave state. At present, the commonly used brain wave software generation methods include calling function algorithm generation and simulating DSS sampling output. This paper uses the method of simulating DSS sampling output based on ordinary single-chip microcomputer to design the system.


1 System hardware introduction
As shown in Figure 1, the system consists of a single-chip microcomputer, program memory, digital-to-analog converter, amplifier and filter circuit, stereo headphones, program indicator light, program time display, buttons, etc. The system can be divided into three modules: button circuit, brainwave music generation circuit, and program time and program indicator light display circuit.

After the system is turned on, the user selects the program and presses the start button to start running. After starting running, the single-chip microcomputer first generates a digital signal of brainwave music with a preset frequency. This signal is converted into an analog signal by the digital-to-analog conversion circuit, and then the analog switch generates left and right dual-channel signals, which finally enter the headphones through the filter amplifier circuit. During the program playback, there will be a program indicator light and a running time display, and the program time is displayed in minutes.


2 System software introduction
The software mainly consists of the following parts: keyboard detection and control part, brain wave music program generation part, program time and program indicator light display part.
2.1 System software flow
Figure 2 is the overall flow chart of the system. After the device is powered on, the microcontroller initializes the system, including initializing the I/O port and various function registers and external devices, and then waits for the function interrupt subroutine. Here, the keyboard subroutine calls the external interrupt and the timer/counter interrupt. When a keyboard interrupt is detected, it is first de-jittered, then the key value is read and transferred to the corresponding function subroutine. The brain wave music generation subroutine is triggered after the start key is pressed, and it will call each timer to complete the generation of brain wave sound and light. At the same time as the program starts, the program time display subroutine will display the time. The following is an analysis of some key points in the design.

2.2 Brainwave sound and light program generation part
Module 2 of Figure 1 is the hardware circuit of the brainwave music program generation part. The software part of the brainwave sound and light program generation mainly consists of two parts: the generation of monophonic brainwave music and the generation of binaural music.
2.2.1 Monophonic brainwave music generation
Because the frequency of the therapeutic wave is mostly outside the hearing range of the human ear, an amplitude modulated signal with the frequency of the therapeutic wave is used to transmit the therapeutic signal to the brain, that is, a sine wave with a therapeutic frequency is used to amplitude modulate a carrier of a certain frequency to generate music, so the focus of the brainwave music design is the generation of amplitude modulated waves. The design does not call the sine function to directly generate sine wave data, but first samples the sine wave to obtain the sine wave data, and then solidifies the data in the ROM. Because the system
uses an 8-bit single-chip microcomputer, the maximum number stored in one byte is 255, so the range of the sampling value is selected as 0 to 255.
The following is an introduction to the generation and regulation of the amplitude modulation wave:
(1) Generation of the amplitude modulation wave
Because the microcontroller cannot output negative numbers, the modulation signal in this design is formula (1):


The single chip microcomputer takes the sampling points of the modulation signal and the carrier signal respectively, then multiplies them and takes the high 8 bits of the result as the output, and the obtained signal is as follows:

[page]

The DC and modulation signal components are filtered out by an external high-pass filter to obtain the required amplitude modulation signal as shown in formula (4):


Where Ω is the frequency of the modulation signal, that is, the brain wave frequency, and the frequency range is 1Hz to 30Hz; w0 is the frequency of the carrier wave, ranging from 90Hz to 800Hz, and the initial frequency is set to 330Hz. The output amplitude modulation waveform is shown in Figure 3.

(2) Adjustment of the carrier frequency of the AM wave
The carrier frequency is the pitch of the brainwave music. Adjusting the pitch to the range that the human ear is sensitive to will make the treatment effect more obvious. The frequency range of sound vibration that people can hear is 20Hz to 20kHz, and the design requires a frequency adjustment range of 90Hz to 800Hz. The carrier frequency is calculated as shown in formula (5):

fw0=1/nT (5)
The frequency of the carrier wave is determined by the number of sampling points n and the sampling time interval T of the carrier wave. Adjusting by changing the number of sampling points requires a large number of sampling points, and the change in the number of sampling points will inevitably bring about a large phase truncation error. This design adjusts the frequency by changing T, which ensures that no sampling points are missed and that the number of sampling points does not need to be too large. During the frequency modulation process, the time T corresponding to the required frequency is first calculated, and then it is assigned to the sampling time interval parameter, so that the carrier wave is jumped to the required frequency.
(3) Frequency adjustment of the modulation signal of the amplitude modulation wave
In the design, the modulation signal of the amplitude modulation wave is the envelope of the brainwave music, which determines the characteristics of the brainwave music (especially the therapeutic content). The frequency adjustment of the modulation wave changes within a certain brainwave frequency range (1Hz~30Hz), and the time and frequency parameters of its frequency change over time have been solidified in the ROM and cannot be adjusted arbitrarily. The principle of modulation signal frequency adjustment is the same as that of carrier frequency adjustment, and you can refer to formula 5. In this design, the frequency change parameter of the modulation signal over time has been converted into a time parameter. When the program is running, the time parameter is called by a table lookup method to change the frequency of the modulation signal.
(4) Adjustment of brainwave music intensity
The brainwave music signal vAM is used as the reference voltage Vref of DA2, and the intensity parameter PW of the microcontroller is used as the input signal of DA2. DA1 and DA2 use DAC0832. Because the DAC in the design adopts a unipolar reverse voltage output mode, the output of DA2 is as shown in formula (6):


In this way, the intensity of brainwave music varies within 0~-vAM.
2.2.2 Generation of dual-channel music
As shown in Figure 4, the input ports A2 and B1 of the analog switch are connected to low level, and Al and B2 are connected to the brainwave music signal at the same time. The single-chip microcomputer controls the on and off of the two switches through the control ports l and 2. When the left and right switches are always turned on, the left and right synchronous outputs will be generated; when the single-chip microcomputer controls the analog switches to be turned on and off alternately at the same frequency as the modulation signal, the left and right signals will be output alternately. These two output signals are output to the headphones through the amplification and filtering circuit. This alternating/synchronous stereo effect on the human brain will guide the brain to achieve an effective therapeutic effect of dual-brain synchronization. Figure 5 is the collected left and right alternating output signal.

2.3 Program time and program indicator light display section The
program time display section is a single-chip microcomputer that calls the internal timer to count minutes and outputs the time signal to the LED digital tube for display. The program time is displayed as 0 when the machine is turned on. During operation, when the program time reaches the preset time, the alarm subroutine will be called to sound an alarm and set the program end flag. The program indicator light display is a single-chip microcomputer that controls the light-emitting diode light of the program indicator in the program selection subroutine to indicate which program is currently being output.


3 Result Analysis
Through experimental observation and oscilloscope measurement, the device can output brainwave music with effective frequency, meet the expected parameter settings, and the waveform has no obvious distortion. Figure 5 is the collected waveform.

However, there are still some errors in the actual output waveform, which mainly come from: ① Since the sine amplitude value stored in the internal waveform memory is expressed in binary, the sine amplitude value that exceeds the memory word length must be quantized, which introduces quantization errors. There are two main ways to quantize amplitude, namely rounding quantization and truncation quantization. Here, truncation quantization is used. ② The spurious level caused by the non-ideal conversion characteristics of DAC. The non-ideal characteristics of DAC include: the limited resolution bit number of DAC; the nonlinearity of differential and integral; the instantaneous burr during D/A conversion; clock leakage; digital noise feedthrough; conversion rate limitation, etc. ③ During the frequency adjustment of the modulated signal, the sampling points of the sine wave will be missed, which will inevitably produce phase truncation errors.
In view of the above problems, some improvement methods are proposed: ① Use a single-chip microcomputer with higher bit number and a high-performance digital-to-analog converter. ② Increase the ROM capacity and the number of sampling points to improve the amplitude resolution.

Keywords:brainwave Reference address:Research on software design of brain wave therapeutic instrument based on single chip microcomputer

Previous article:Research on automatic image alarm system and its implementation with single chip microcomputer
Next article:A cardiopulmonary resuscitation system based on single chip microcomputer

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号