1 芯片介绍
1.1 LD3320语音芯片介绍
LD3320是一颗基于ASR技术非特定人语音识别的语音识别芯片。语音识别ASR技术,是基于关键词语列表识别的技术。只需要软件编辑好要识别的关键词语列表,并把这些关键词语以字符形式传送到芯片内部,就可以对人说出的关键词语进行识别,不需要作任何录音。比如,在51单片机编程中,简单地设置语音芯片的寄存器,诸如把“ni hao”这样的识别关键词动态地传入芯片中,芯片就可以识别这个关键词语了。并且在同一时刻,最多可以在50条关键词语中进行识别,可以根据场景需要,在终端随时编辑和更新这50条关键词语。另外,芯片上集成了高精度的D/A和A/D接口,并且接有Flash和RAM,只需把麦克风接在芯片的AD引脚上即可实现语音识别/声控/人机对话功能。
1.2 AVR芯片介绍
本例使用ATmega128单片机作为鱼体控制芯片,ATmega128具有以下特点:低功耗的8位微处理器,有133条指令,且大多数指令可以在一个时钟周期内完成;53个可编程I/O口线;128K字节的系统内可编程Flash;4K字节的EEPROM;优化的外部存储器空间多达64K字节;两个带有独立预分频器和比较器的8位定时器/计数器;两个带有预分频器、比较功能和捕捉功能的16位定时器/计数器;两路8位PWM;6路分辨率可变(2到16位)的PWM;两个可编程的串行USART;8路10位的ADC。
2 硬件设计实现
2.1 整体设计方案
语音识别系统识别到语音数据会产生一个中断信号给51单片机,然后单片机通过程序判断语音数据的正确性(可能是噪音),如果正确就通过P0口读取语音数据,并且将数据通过WAP200B无线通讯模块发送给鱼体主控芯片AVR单片机,此时AVR就可以根据命令产生相应占空比的PWM波。整体方案设计如图1所示。
2.2 Voice control part
When M-LD3320 performs voice recognition, it needs a high purity 3.3V DC power supply and a suitable crystal signal (we used a 12M square active crystal). Use the 51 single-chip microcomputer to write a program to control the LD3320 chip to realize the voice recognition function. At the same time, it is necessary to ensure that the final power supply of the 51 single-chip microcomputer and the voice module is unified. When
the microphone collects the sound, regardless of whether the normal result is recognized, the chip will generate an interrupt signal and return it to the 51 single-chip microcomputer through the IRO pin, and transmit the data to the 51 single-chip microcomputer through ICR_P0~ICR_P7 for processing. Then the interrupt program analyzes the result according to the value of the register. If the recognition is successful, the recognized data will be sent out through the wireless communication module. Since this article uses a parallel method when the voice module transmits data to the MCU, the MD is directly grounded. If the serial method is used, the MD pin needs to be set high. The connection diagram between it and the 51 single-chip microcomputer (based on STC89C52) is shown in Figure 2. [page]
The module PCB has connected the microphone pins to the module's MIC socket, so when connecting the circuit, pins 11 to 19 and 22 to 31 are left unused. When connected to the 51 microcontroller, ICR_P0 to ICR_P7 (pins 2 and 33-39) must be connected to the data bus of the microcontroller. At the same time, 1K/10K pull-up resistors (pull-up to 3.3V) need to be welded on P0-P7, as well as the control pins RDB, MD, INTB, WRB, and CSB. This can help the system run stably. There are two options for connecting the CLK pin: 1) directly input the crystal oscillator signal of the 51 microcontroller to the CLK pin of the LD3320 through a wire, but the wire should not be too long. 2) directly weld the square active crystal oscillator to the reserved connection point on the module, and the CLK pin needs to be left unused. The second method used in this article.
2.3 AVR control part
AVR is the main control MCU of the fish body, mainly used to control the power part of the robot fish. The power of the robot fish comes from the servos. The number of designed joints is three, that is, there are three servos. Each servo is controlled by a 15-bit PWM wave with different duty cycles to rotate at different angles. The three servos need to cooperate to form a fish body wave to control the swing of the fish body. The fish body structure is shown in Figure 3.
The fish body wave is a fitting of the real fish swimming morphology using a rod-based robot fish. The fish body wave curve can be considered to be a synthesis of the fish body wave amplitude envelope and a sine curve. It starts from the center
of the fish body inertia force and extends to the caudal peduncle. Its curve equation can be expressed as In the formula, yboby is the lateral displacement of the fish body (dorsoventral axis), x is the axial position of the fish body (head-tail axis), c1 is the first-order coefficient of the fish body wave amplitude envelope, c2 is the second-order coefficient of the fish body wave amplitude envelope, k is the wavelength multiple (k=2π/λ), λ is the wavelength of the fish body wave, and w is the frequency of the fish body wave (w=2πf=2π/T).
Since computer control is a discrete digital quantity, the fish body wave curve also needs to be discretized, so the time parameter t is separated from the fish body wave motion function yboby(x, t), and the equation is
In the formula, i represents the i-th variable of the spline curve sequence within a swing cycle; N represents the fish body wave resolution, that is, the degree to which the entire fish body wave is discretized within a swing cycle, and its upper limit cannot be greater than the highest frequency of the drive mechanism swing.
In order to better characterize the parameters of the fish body fluctuation and improve the flexibility of the fish body direction control, especially the turning process, on the basis of the characteristic parameters of equation 2, the quadratic gain of the wavelength multiple k relative to x is increased, and the modified equation is as follows
By adjusting the values of k1 and k2, more fish body wave curves can be obtained according to the change of x. At the same time, in the design process of the robot fish, the mobility and flexibility of the movement can be increased by fine-tuning the body wave parameters.
[page]
According to the actual fish body, select appropriate fish body wave parameters, and simulate all fish body waves from 0 to N in a swing cycle through simulation tools, so as to calculate the angle required for the servo to rotate in various situations, and then set the PWM wave duty cycle of each servo to generate the required fish body wave. In this paper, the parameters are set as c1=0.05; c2=0.09; k1=0.5; k2=0.1; and N=10. The fish body wave curve is shown in Figure 4. The straight line segment is the fish body wave formed by the cooperation of three servos in practice, and the curve is the ideal fish body wave curve.
Use AVR's USART0 to connect to the wireless communication module. When the 51 MCU transmits data to the AVR through the wireless communication module, the AVR MCU software control will generate a serial interrupt, at which time the received command can be judged, and the duty cycle of the PWM wave can be changed according to the command, thereby changing the swimming direction of the robot fish.
2.4 WAP200B wireless communication transmission part
The wireless module WAP200B has a total of 10 pins: VCC_CPU is the MCU power input, VCC_RF is the RF short-circuit power supply, and VCC_PA is the RF amplifier power supply. These three pins are connected to DC3.3V; SET is the configuration or normal working mode selection signal input pin. When the level is low, WAP200B is in configuration mode. At this time, the serial port data is used as a configuration instruction and will not be transmitted. When the level is high (3.3V), the module enables the receiving and sending function; RXD/TXD is the pin for serial port data input/output from WAP200B, 3.3V/5V is compatible with TTL logic level, RESET is the reset signal input pin, and it is connected to a high level for normal operation; ANTENNA is the antenna interface. The connection method is shown in Figure 5.
The TXD/RXD of the wireless communication module is connected to the RXD/TD of the 51 single-chip microcomputer respectively, which is equivalent to a serial port of the 51 single-chip microcomputer. Before using the wireless communication module, you need to configure its baud rate, serial port mode, channel and transmission power (SET is set to low). The two modules that communicate with each other must ensure that they have the same baud rate and channel. At the same time, the baud rate of the 51 single-chip microcomputer serial port must also be consistent with the communication module. The transmission power can be set according to the distance of the transmission.
3 Control software design process
The 51 single-chip microcomputer is the main control CPU of the voice chip. Its software mainly includes the main program, serial port initialization (the baud rate and serial port mode settings need to be consistent with the wireless communication module), voice system recognition control, and command data transmission. The 51 program flow is shown in Figure 6.
[page]
AVR is the main control chip of the fish body. Its software mainly includes the main program, serial port initialization (the baud rate and serial port mode need to be consistent with the above, and the receiving interrupt is also set to open), and the PWM wave that makes the robot fish swim directly. No matter what state it is in, as long as the serial port receives a command, an interrupt will be generated, and the duty cycle of the PWM wave needs to be changed according to the command, thereby changing the swimming direction of the robot fish. It should be noted that after changing the PWM wave duty cycle, it only needs to maintain this duty cycle for a period of time (there may be new commands during this period of time). After the fish body changes direction, the duty cycle needs to be changed to direct swimming again. The AVR control process is shown in Figure 7.
4 Experimental results
This voice control system has been implemented in the experiment. We edited the commands "zuo", "you", "qian" and so on in the 51 single-chip microcomputer; edited the PWM wave duty cycle of the corresponding command in the receiving interrupt of the AVR single-chip microcomputer; all serial port communication parameters are set to: baud rate 9600bps; serial port mode is 8 data bits, 1 stop bit, no parity bit; channel is set to 28; transmission power is set to maximum (FF). Olympus ME52 microphone is used as the voice receiving device.
Table 1 shows the angles of the three servos in ten discrete cycles when the fish is swimming straight (forward). When turning, the first two servos deflect, and the third servo remains unchanged; when issuing a "left" turn command, servos 1 and 2 add negative 40° to the straight swimming; when turning "right", add positive 40°. Since the servo angle and the PWM wave duty cycle are linearly related, on this basis, we matched the mathematical relationship between the PWM wave duty cycle and the servo angle.
jiaodu is the defined array of angles of each servo when swimming straight, j is the servo number, i is the cycle, pianjiao is the angle added to the straight swimming when turning left, right, etc. (plus or minus 40°); xiuzheng is the compensation angle that needs to be debugged in practice.
In actual operation, when the "left", "right", "forward" and other commands are issued, the robot fish will immediately make corresponding actions.
5 Conclusion
This paper mainly introduces the application of speech recognition technology in robot fish and the principle of fish body wave generation, and realizes voice control of the swimming direction of robot fish. It is believed that with the in-depth research on robot fish, more functions can be realized on the basis of the voice system, making the robot fish more intelligent, and ultimately providing more help and convenience for human exploration of the ocean.
Previous article:Implementation of analgesic instrument system based on LabVIEW and AVR microcontroller
Next article:Fatigue driving detector based on head position characteristics of single chip microcomputer
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Today at 10:00 AM Live: Building Sensor-Based Test Systems with NI CompactDAQ and LabVIEW
- How can I buy the blood glucose sensor chip from Maxim? Is there any sample program available?
- GA and CAN controller MCP2515 design inertial navigation system CAN bus interface.pdf
- GD32L233C-START Development Board Evaluation: Introduction to the Development Board (I)
- Help, DC motor driver chip selection
- Does anyone know which chip can be used to replace the ISM330DLC or other brands? I look forward to your replies!
- LSM6DS3TR-C related information
- Strengthen physical exercise after work
- Please advise, does connecting a 102 capacitor in parallel with a button really have the effect of eliminating jitter?
- OLED display driver