The core of the mobile music robot is Infineon 16 bit MCU xe162fn processor. The 16 / 32-bit microcontroller developed by Infineon has the functions of high system integration, no additional devices and related software overhead, and providing system security and fault protection mechanism. Bluetooth is a global open and low-cost wireless communication specification. In addition, due to the advantages of long transmission distance, strong anti-interference ability, low power consumption and high transmission rate, Bluetooth wireless communication technology is adopted in the design. The main body of the design is a wheeled mobile car robot, which has many functions, such as following the host to walk, playing music, remote control operation, flashing color lights with clapping frequency, and home security. The movement of the robot is realized by driving the DC motor to drive the wheel to rotate. The function of walking with the master is to judge the orientation between the handheld device in the master’s hand and the mobile music robot by infrared emission and reception, and then drive the robot to walk with the master.
The operation of wireless remote control is realized by Bluetooth communication. In the security function, the mobile music robot is equipped with a typical smoke sensor for fire detection, and if smoke or gas leakage is detected, the local voice alarm and SMS sending module controlled by GSM wireless network send alarm SMS to the designated mobile phone number. GSM network is a kind of wireless digital network standard based on cellular system. It has many advantages, such as large network capacity, complete types of services, strong signal stability, high confidentiality and security, flexible switching processing and automatic roaming function. In the design of the handheld device, it is equipped with a 320 * 240 touch screen to realize intuitive and convenient remote control without keys, and an acceleration sensor to sense the tilt angle to control the robot movement.
The intelligent following function of the system is realized by infrared. When the infrared receiver on the music robot perceives the infrared, it will track the infrared emission source. If it can’t, it will rotate in place to search the infrared emission source again until the direction is repositioned. The infrared emission source is composed of 10 infrared emission tubes. The 10 infrared emission tubes are evenly placed on the surface of a sphere, so that the infrared emission source can radiate infrared in all directions, which ensures that the music robot can find the infrared emission source more quickly and accurately. The carrier frequency is 38 kHz and the duty cycle is 50%. The transmitting and receiving circuit of infrared is shown in Figure 1. 10.0 connects a common I / O pin to control the on-off of infrared, that is, to turn on for 4 ms, then turn off for 11 ms, and turn on and off repeatedly. Connect a PWM square wave with a frequency of 38 kHz. There are 10 infrared transmitting tubes.
The infrared receiving device adopts two infrared receivers 1838, which are respectively installed on the head and tail of the music robot. The output pins of the two receivers are connected to the 10.2 and 10.7 pins of the MCU respectively. The infrared receiver 1838 is sensitive to the frequency of 38 kHz, so the infrared receiver 1838 can detect the orientation of the infrared emission source and drive the motor forward in the direction of the external emission source.
Figure 1 intelligent following infrared transmitting and receiving circuit
Design of clapping signal acquisition circuit
The realization of clapping lantern function is mainly divided into clapping signal capture and rotary lighting of lantern. The rotary lighting of lantern is relatively simple, but the clapping signal capture is not a standard step signal because the clapping signal is not a standard step signal. When the oscilloscope is used to observe the waveform, in fact, there are more burrs on the rising edge and falling edge of the waveform, that is, a clapping signal A multiple step signal is generated by the signal. If the microcontroller records the time interval of two rising edges, because of the existence of burr, the microcontroller mistakenly captures the burr as the rising edge, resulting in the time interval of two rising edges becoming smaller. The solution is to use the envelope detection circuit to detect the envelope, and then select the appropriate comparison voltage value through the voltage comparator, so as to produce a more ideal step signal, that is, a clap to produce a step signal.
The circuit uses the microphone to collect the sound signal, and then uses LM324 to amplify the collected signal, the amplification ratio is 100 times, and then connects two 1N5819 and a 104 single stone capacitor for envelope detection. Finally, lm358 is used as the voltage comparator, and 1K resistor and 880 Ω resistor are used to obtain the comparison voltage value. The circuit is shown in Figure 2. The robot’s movement is realized by driving DC motor to drive the wheel to rotate, that is, to control the forward and reverse rotation and speed of DC motor. The DC motor driver chip of the system adopts L298N of SGS company, with four channel logic drive circuit inside. The H-type balance bridge composed of triode has high driving power and strong driving ability. At the same time, H-type PWM circuit works in transistor saturation state and cut-off state, which has very high efficiency.
Figure 2 clapping signal capture circuit
Design of DC motor drive circuit
Motor speed depends on three factors: load, voltage and current. For a given load, pulse width modulation can be used to keep the motor speed stable. By changing the pulse width applied to the DC motor, the speed of the motor can be increased or decreased. Adjust the pulse width, that is, change the duty cycle, adjust the speed of the motor. The driver board uses six high-speed optocouplers 6n137 to realize the isolation between the driver circuit and the logic circuit, which can effectively avoid the mutual interference between the driver circuit and the logic circuit. The circuit diagram of the drive board is shown in Figure 3.
Figure 3 DC motor drive circuit
Through software programming, the duty cycle of two PWM pulse signals can be changed freely. The a end of the motor is connected with the PWM pulse signal, and the B end of the motor is connected with an I / O pin of the MCU. When the I / O pin is set to 1, the current flows from the B end of the motor to the a end of the motor; when the I / O pin is set to 0, the current flows from the a end of the motor to the B end of the motor, so that the motor can change the rotation direction of the motor, control the duty ratio of the PWM pulse signal, and change the rotation speed of the motor, so as to realize the control of the steering and speed.