Abstract This paper introduces the principle and characteristics of a person detection device. The device is based on the PICl6F628A single-chip microcomputer, uses a pair of independent ultrasonic transducers for transmission and reception, and uses the Doppler effect to effectively detect whether someone enters a certain space, and can output signals to control the switch of lighting equipment.
Ultrasonic waves can be used to effectively detect moving objects in a certain space. It is easy to install and has good detection effects. This article introduces a person detection device designed using the ultrasonic Doppler effect. The design uses the PICl6F628A single-chip microcomputer to improve the ultrasonic detection hardware circuit used in the past, and uses software programming to effectively detect the person, and then outputs a control signal to control the switch of the lighting device.
1 Working principle and characteristics
When there is relative motion between the sound source and the sound wave receiver, the signal frequency received by the sound wave receiver will be different from the propagated sound wave frequency. The frequency difference is related to the relative motion speed between the sound source and the receiver. This is caused by the Doppler effect. This design uses an ultrasonic transmitter and receiver that are both fixed in the same direction. When an obstacle moves toward or away from the two, it can be regarded as a relative motion between the image source and the receiver formed by the reflection effect of the obstacle surface on the sound wave. The Doppler effect can also be used to determine whether someone is moving within the detection range based on the signal received by the receiver.
The device has both ultrasonic transmitting and receiving transducers, and is easy to install. The maximum detection distance of the front is adjustable from 1 to 5.5 m, and can effectively detect moving objects in the space. After detecting a moving object, a +12 V signal is output to control the switch of the lighting device. The duration of the +12 V output can be adjusted from 15 to 1 800 s.
2 Hardware System
This device uses ultrasonic transducers with independent transmission and reception. The hardware system can be basically divided into a microprocessor part, a transmission part, and a reception part.
Microprocessor The PICl6F628A microcontroller produced by Microchip is used, and its pins are shown in Figure 1. This microcontroller is a reduced instruction set processor (RISC) with a total of 35 assembly instructions, which is simple and effective to use. The PICl6F628A has a total of 18 pins, a standard operating voltage of 5 V, and an external crystal oscillator can reach a maximum of 20 MHz. Its internal resources are very rich, including 2 KB of Flash program memory, 224B of data memory, 2 analog comparators, 1 PWM controller, 1 16-bit timer/counter, 1 8-bit timer/counter, 1 8-bit timer, as well as power-on startup circuit, power-off reset circuit and watchdog circuit. PICl6F628A can also respond to various hardware interrupts such as timers, comparators, RB ports, etc. Reasonable use of these resources can effectively simplify peripheral circuits and reduce product costs (the on-chip resources not used in this design are not listed here).
The circuit diagram of the transmitting part is shown in Figure 2. The ultrasonic transmitting transducer uses 328STl60, and its center frequency is 32.81.0 kHz. Using the PWM controller of the PIcl6F628A microcontroller, the RB3 port outputs a square wave signal of about 32.8 kHz, and the voltage and current are amplified through transistors Q1 and 4069, thereby driving the transmitting transducer to emit an ultrasonic signal. Among them, transistor Q2 is designed for system self-test. In the normal detection process, the RBO port always outputs a low level, so that the transistor Q2 remains in the cut-off state, which will not affect the normal transmission of the ultrasonic transmitting transducer.
[page]
The receiving circuit diagram is shown in Figure 3. The ultrasonic receiving transducer uses 328SRl60, and its center frequency is also 32.8 ± 1.0 kHz. Since the signal directly received by the receiving transducer is relatively weak, it needs to be amplified by an operational amplifier first. The operational amplifier model used here is TLO62. In order to cooperate with the subsequent detection, it forms a positive phase and a negative phase amplifier circuit respectively. The detection circuit actually uses a bidirectional analog switch chip 4066, and uses the driving signal sent by the ultrasonic wave as the reference signal for detection, that is, the switching of the analog switch of 4066 is controlled by RB3. When the RB3 level is high, the positive phase amplifier circuit is connected; when the RB3 level is low, the negative phase amplifier circuit is connected. This is equivalent to multiplying the amplified signal by 1 continuously, and its switching frequency is the same as the ultrasonic transmission frequency. Let the frequency be, fo, then the equivalent signal generated by the analog switch is a square wave with a frequency of fo and an amplitude of 1, let it be uo. Then uo can be obtained from the Fourier series. The expression of is:
,
Assume that the received signal is u1=Usin(2πf1t+π), and the amplification factor of the positive and negative phase amplifier circuits is A. Then the expression of the signal u after passing through the detection circuit is:
Among them, fo is the frequency of the ultrasonic signal sent, θ0 is its initial phase angle, f1 is the frequency of the received ultrasonic signal, θ1 is its initial phase angle, and U is its amplitude.
Due to the Doppler effect, if there is no moving object reflecting the ultrasound, then fo=f1; once there is a moving object reflecting the ultrasound, then fo-f1≠0. Although fo and f1 are both relatively large, the frequency difference caused by human motion, that is, the absolute value of fo-f1, will not be too large. From the above formula derivation results, it can be seen that as long as a low-pass RC filter is used to filter out the high-frequency signal, the characteristic signal generated by human motion can be obtained.
Then, u' is further processed by a differentiator to obtain a waveform with more obvious changes, which can effectively improve the detection sensitivity. After removing useless signals or interference signals through a bandpass filter, the output waveform is sent to the RB5 port of the microcontroller through the comparator. The received pulse signal can be processed in real time using the RB port interrupt of the microcontroller. As shown in Figure 3, adjusting R can change the comparison level of the level comparison circuit, so that the maximum detection distance of the front of the device can be adjusted between 1 and 5.5 m.
As shown in Figure 4, by using the structural feature that the RA4 port of the PICl6F628A microcontroller is an open collector, a pull-up resistor can be directly added to the RA4 port to conveniently control the lighting device. The driving capability of the PIC series microcontroller port is very strong and can directly drive the LED. When a moving object is detected, the microcontroller outputs a +12 V level signal through the RA4 port to drive the lighting device, and at the same time controls the LED to flash once through the RB2 port.
[page]
In addition, adjusting R3 can make the duration of the +12V level signal change between 15 and 1800 s. This function mainly uses the two comparators inside the microcontroller and combines with the peripheral RC charging circuit to detect the position of R3. The specific process is as follows: By setting the control word of the microcontroller, the positive input terminals of the comparators P1 and P2 are connected together inside the microcontroller and connected to the RA2 port. RA0, RAl, and RA2 are all input ports, as shown in Figure 4.
Under normal conditions, RA3 is an output port, and the output is low level. At this time, capacitor C1 and comparators P1 and P2 are in a stable state. When the position of the R3 slider needs to be tested, port RA3 changes from output to input, and the timer inside the microcontroller starts timing. In this way, +12 V starts to charge capacitor C1 through resistor R1. When the level of port RA2 exceeds port RA1, the output of comparator P2 changes, causing the comparator interrupt of the microcontroller. In the interrupt service program, the position of the resistor R3 slider can be calculated by reading the value of the timer. Then restore port RA3 to an output low level, discharge capacitor C1, and the entire circuit returns to the initial state, ready for the next test. The function of comparator P1 is to prevent comparator P2 from unexpected events. When the level of port RA2 exceeds port RA1 and no interrupt is generated, comparator P1 generates an interrupt and stops charging capacitor C1 to prevent the levels of ports RA2 and RA3 from being too high, causing damage to the microcontroller. The purpose of measuring the resistor R3 is to set the lighting time of the lighting equipment. The accuracy requirement is not high, so using this circuit for measurement is not only simple, convenient and low-cost, but also has good practical effect.
3 Software Programming
Based on hardware processing, the waveform reaching the microcontroller is already ideal, but the received pulse signal cannot be used as the detection standard. Software programming is still needed to further increase the anti-interference performance. Since the main purpose of the device is to detect the movement of the human body, a small movement of the human body can at least cause the microcontroller to receive a pulse signal of several hundred ms. In order to improve reliability, this design ignores signals with a duration of less than 100 ms. In addition, if multiple devices work at the same time, various hardware errors may cause the ultrasonic frequency sent out to be not exactly the same. When the difference is relatively large, a pulse signal of a certain frequency will continue to be received. If no processing is done, this will also affect normal detection. Considering that when no one passes by, if there is interference and the interference source is stable, the frequency of the pulse signal received by the microcontroller is basically unchanged, so the more ideal detection mechanism is: judging whether there is human movement based on whether the frequency of the returned frequency difference signal changes.
In this design, the received pulse signals are counted within two consecutive 100 ms time periods. If the count value increases, it is judged that the detection is successful. While counting, if the count value within 100ms is less than 5, it is discarded. In order to ensure reliability during use, this device performs self-tests at regular intervals. As shown in Figure 2, during the normal detection process, the RBO port always outputs a low level. Only when self-test is required, the RB0 port outputs a square wave of a certain frequency as a self-test signal. At this time, the ultrasonic signal has been modulated by the self-test signal before it is transmitted. If the entire device works normally, the microcontroller can receive the pulse signal even when there is no moving object reflecting the ultrasonic wave. In this way, self-test can be performed to determine whether it is working normally. If the self-test fails, the LED will flash continuously to indicate that it has a fault, and the +12 V signal will be output continuously to control the lighting device to be always on to avoid affecting the normal passage of pedestrians.
4 Conclusion
The appearance of the device is shown in Figure 5. There is a hanging bayonet at the bottom, which can be easily installed on the wall of the passage. The sensitivity knob on the top can adjust the sensitivity of the detection, and the delay time knob can adjust the time for the lighting device to light up after a person comes. The LED on the top can indicate the detection status under normal conditions and the fault when the self-test fails.
Practice has proved that the device is not only easy to install, but also has good use effect, and can meet the requirements of incoming detection in various occasions. In addition, the device has high detection sensitivity and can be used as an alarm device for security systems with a little adjustment.
Previous article:Introduction to Nancy Codec video encoding and decoding technology standards
Next article:Using the MAXQ3210 to Build a Water Level Monitoring/Alarm System
- Popular Resources
- Popular amplifiers
- Mir T527 series core board, high-performance vehicle video surveillance, departmental standard all-in-one solution
- Akamai Expands Control Over Media Platforms with New Video Workflow Capabilities
- Tsinghua Unigroup launches the world's first open architecture security chip E450R, which has obtained the National Security Level 2 Certification
- Pickering exhibits a variety of modular signal switches and simulation solutions at the Defense Electronics Show
- Parker Hannifin Launches Service Master COMPACT Measuring Device for Field Monitoring and Diagnostics
- Connection and distance: A new trend in security cameras - Wi-Fi HaLow brings longer transmission distance and lower power consumption
- Smartway made a strong appearance at the 2023 CPSE Expo with a number of blockbuster products
- Dual-wheel drive, Intellifusion launches 12TOPS edge vision SoC
- Toyota receives Japanese administrative guidance due to information leakage case involving 2.41 million pieces of user data
- 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
- Analysis of several components of switching power supply that "seriously affect the cost"!
- This week's highlights
- MicroPython version 1.13 released
- How to create a compilation environment for the SINA33 development board
- What are the main parameters of electronic components? What are their respective characteristics?
- Regarding the issue of analog quantity acquisition, please ask the seniors
- [RVB2601 Creative Application Development] MP3 Player
- HuaDa HC32A460 Series Introduction (Part 2)
- 【IoT Development Notes】Gizwits Cloud Device Transplantation RT-Thread
- Semiconductor Industry Online Member System Questionnaire Survey Come and participate to win a 50 yuan Jingdong card! It can be done in 3 minutes~