O Introduction
Infrared pumps are usually used to complete the function of "extending your hand to get water out, retracting your hand to stop the water", and generally provide manual and automatic pumping modes, and have low voltage detection alarm and voice prompts after use. When the infrared pump is working, it generally converts the action of extending your hand to get water out into an electrical signal through a sensor, and emits infrared light through an infrared emitting diode to control the infrared receiving diode in the controlled device, and then uses the intensity of light to change the current in the circuit. When you stretch out your hand, the intensity of the infrared light received by the receiving part decreases, and the intensity of the converted current weakens. When you take your hand away, the infrared directly hits the photosensitive tube, and the output current increases; the second step is to convert the intensity of the current signal into high and low levels that can be recognized by the SPCE06lA microcontroller. Therefore, the circuit needs to have the function of a current-controlled voltage source, with a high level of about 5V and a low level of 0V. To this end, the common emitter connection of a bipolar transistor can be used to achieve this; the third step is to output a control signal by judging the high and low voltage signals, and output the control signal to the motor, and then control the water pump through the motor. This part mainly detects the interrupt of IOB2. When you stretch out your hand, the infrared ray is blocked, the transistor is cut off, and IOB2 gets a high level. That is, the rising edge interrupt application function of IOB2 is used (or the query method is used) to make an interrupt request for draining water to the SPCE061A microcontroller.
Through the above three steps, only the design function can be basically completed. This article has the following three improvements on the above traditional design:
(1) Use the 1*3 keyboard to switch between automatic and manual. In automatic mode, put your hand into the instrument to discharge water, and take your hand away to stop. In manual mode, press key 2 to discharge water, and press key 3 to stop.
(2) The working indicator light circuit module has been improved. When the circuit is in working state, the indicator light is on.
(3) The voice broadcast has been improved. Since the SPCE061A microcontroller integrates two 10-bit DAC (digital-to-analog conversion) modules, this resource can be used to easily realize the conversion of digital to analog signals, making human-computer interaction more friendly, and can also indicate the current working status of the system.
1 Hardware design of infrared pump
The working principle of this system is shown in Figure 1.
This scheme adopts Lingyang SPCE061A single chip microcomputer. GR4010l infrared emitting diode is selected as infrared emitting device. GD1611 silicon PIN photosensitive diode is used as infrared receiving device. QDB-30-3.0 is selected as the driver of the pump. The infrared sensing part can be used to detect whether someone needs to use the pump. It is divided into two parts: infrared emission and infrared reception. The infrared emitting tube adopts GR40101, which mainly controls the emission frequency of the infrared emitting tube by outputting a certain frequency pulse through IOB8. The infrared receiving tube adopts GD1611, which can be detected by using the external interrupt function of IOB2. The voice broadcast part uses the DACl inside SPCE061A to output the signal to the voice circuit, and then uses the A2000 format to play. This system provides 3 buttons, which can be used to set the liquid output, automatic and manual pumping, etc. They occupy 3 I/O lines of IOA0-2 of SPCE061A. The system uses a micro motor as the pump drive, and the motor is controlled by a transistor as an electronic switch. The transistor can be controlled by IOB4 to control the motor. The low voltage detection can be completed by using the LVD unit inside SPCE061A without the need for external components. In addition, the system also provides a light-emitting diode as a working indicator, which can be controlled by IOA5.
Figure 2 shows the control circuit schematic of the system. In the circuit, SPCE061A is the main control chip, and IOA5 controls the working indicator light. When the system is powered on, IOA5 can be controlled to output a high level through the process control, and the working indicator light is always on. The function of the 1*3 keyboard is to set the switching between automatic and manual modes, manual water discharge, and manual water stop, which occupies three ports IOA0-2. When the 1 key is pressed for the first time, the default is automatic mode, that is, when the hand reaches the instrument, the IOB2 port cannot receive the infrared control signal emitted by the IOB8 port, then the single-chip microcomputer controls the IOA4 port and controls the motor to rotate and pump water. When the hand leaves, the IOB2 port receives the infrared signal and controls the motor to stop discharging water. When the 1 key is pressed again, it switches to manual mode. At this time, press the 2 key to start discharging water and press the 3 key to stop discharging water. When the motor changes from rotating to stopping, the single-chip microcomputer controls the DAC1 port to play "Thank you". When the voltage is lower than the voltage value set at the beginning, the system plays a sound alarm.
In Figure 2, the IOB2 port of SPCE061A is used to detect the received signal (the two states of the signal, high and low levels, indicate the action of extending and retracting the hand), the IOB8 port is used to control the infrared emission, the IOA4 controls the micro motor, the IOA5 is the working indicator light, the IOA0-2 can control the 1*3 keyboard, the IOA9 port is for low voltage detection, and the DAC1 port is connected to the voice broadcast. Pins 12 and 13 are the output and input of the oscillator, and pins 16, 17, and 18 are connected to the enable terminal, clock pin, and data pin of the online debugger respectively.
2 Software design of infrared pump
According to the designed functions and hardware circuits, the software part of this system requires the following control programs:
The first is to emit infrared signals. From the infrared emitting diode GR40101, it can be seen that IOB8 of the SPCE061A microcontroller should output a pulse of a fixed frequency to stimulate the device to emit infrared rays, so the program needs to complete this function first. The actual program should generate an 8 kHz pulse through the timing interrupt inside the SPCE061A microcontroller. The specific operation is to calculate how many divisions are required to reduce the frequency to 8 kHz through the crystal oscillator frequency of the SPCE061A microcontroller, thereby obtaining the count value and filling the count value into the counter, and setting the corresponding interrupt register at the same time. Then, in the interrupt service subroutine of the timing interrupt, the statement IOB8=!IOB8 is used to control the IO port to output an 8 kHz square wave.
The second is the reception and processing of infrared signals. As explained in the hardware part, when the hand is extended, IOB2 will have a high level, and in other cases, the pin outputs a low level. Therefore, the high level detection can be realized through the interrupt function of IOB2. When IOB2 has a rising edge, it indicates that the hand is extended at this time, and the system enters the interrupt service program of IOB2, which can complete the function of controlling the water pump and the indicator light.
Then there is the keyboard scanning program. The query method can be used to cyclically detect whether a key is pressed. When a low level is detected at the key port, the corresponding processing program is entered. The keys that manage the automatic and manual modes are implemented in this way, that is, each time a key is pressed, the flag bit changes. If it is 0, it is set, and if it is 1, it is cleared, thereby controlling the selection of manual and automatic. Other keys enter the key processing program for corresponding processing, and voice output is started at the same time.
Figure 3 shows the software flow chart of this system. First, the system is initialized, then each IO port is initialized, and finally the system task is executed. The process of the main task is that IOA0-2 ports are all at a high level. When a key is pressed, which port becomes a low level, and then the level value of the IOA0-2 port is detected. If it is found that a port becomes a low level, the information is sent to the main task side to wait for keyboard information. When the person finishes using it, the system returns to the upper layer and continues to wait for keyboard information; if it is found that all ports of the keyboard are high level and no port becomes a low level, it returns and then continues the keyboard scanning task.
3 Conclusion
This paper presents an improved design method of an infrared pump controlled by the single-chip SPCE061A produced by Lingyang Company. The improved pump has three additional functions: manual and automatic mode conversion, low voltage detection alarm, and voice prompt after use. Actual tests have proved that the device also has the characteristics of strong anti-interference ability, error-free operation, and power saving.
Previous article:Summary of the learning process of C and C++
Next article:Principle and software design of real-time clock device X1226
Recommended ReadingLatest update time:2024-11-16 18:10
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
- 【Perf-V Review】Three-color LED
- CC3200-LAUNCHXL Development Board Evaluation Report
- STM32MP157A-DK1 Evaluation (6) Programming Environment under Cortex-A7 Linux
- MSP430 Learning Clock
- 【Silicon Labs Development Kit Review】+Development Environment Construction
- In fact, there are many small circuits in RF, which are very useful. As we all know, RF modules are very expensive, and the better the performance, the more expensive it is. ...
- TK2683 Insulation Resistance Tester (Tesco Electronics)
- Can I set the I2C pin on ESP32?
- ESD protection is carried out using capacitors. I have many problems. Please help!
- AUTOSAR’s popularity in automotive electronics software development