Abstract: This paper introduces a design scheme of an audible and visual alarm device based on the control of the STC89C52 single-chip microcomputer (MCU). The system designed in this scheme can realize the security monitoring of a specific area. When an intruder appears in the monitoring area, the front-end ultrasonic sensor transmits the detection signal to the main control chip MCU of the system by transmitting and receiving ultrasonic waves.
1 Basic principles of sound and light alarm system
Ultrasonic waves refer to mechanical waves with a frequency higher than 20,000 Hz. In order to realize ultrasonic echo ranging, ultrasonic waves must be generated and received by ultrasonic sensors. Ultrasonic sensors use the principles of piezoelectric effect and inverse piezoelectric effect to realize the mutual conversion between electrical energy and ultrasonic energy. That is, the ultrasonic transmitter converts electrical energy into ultrasonic energy through the inverse piezoelectric effect to generate ultrasonic waves; while the ultrasonic receiver converts ultrasonic energy into electrical energy through the piezoelectric effect to receive ultrasonic waves. If the ultrasonic wave emitted by the ultrasonic transmitter propagates in the medium at a speed of v (unit: m/s), and encounters the object to be measured in the effective prevention area, the ultrasonic wave is reflected and received by the ultrasonic receiver. The propagation time is t (unit: s), then the distance s (unit: m) between the intruder and the prevention object can be calculated. The formula is:
The system structure block diagram is shown in Figure 1. The single-chip microcomputer receives the intruder distance electrical signal output by the ultrasonic sensor according to the clock timing given by the crystal oscillator circuit, and displays the distance value in real time on the LCD screen. At the same time, it controls the sound and light alarm system composed of light-emitting diodes and buzzers to make it flash at a certain frequency and sound an alarm.
Figure 1 System structure diagram
2 System Hardware Design
2.1 Hardware Circuit
The design of the hardware circuit mainly includes four parts: the single-chip microcomputer system and display circuit, the ultrasonic transmitting and receiving circuit, and the sound and light alarm circuit. The single-chip microcomputer uses STC89C52. A 12 MHz high-precision crystal oscillator is used to reduce the measurement error. The ultrasonic sensor uses a piezoelectric ultrasonic transducer. The single-chip microcomputer port P2.7 is set to output the 40 kHz square wave signal required by the ultrasonic transducer, and the port P3.2 monitors the return signal output by the ultrasonic receiving circuit. The display circuit uses the KXM12864M display screen. The sound and light alarm circuit consists of a light-emitting diode and a buzzer.
2.2 Hardware of each main module
2.2.1 STC89C52 main control circuit
Figure 2 STC89C52 main control circuit
2.2.2 Ultrasonic transmitting and receiving circuit
The piezoelectric ultrasonic transducer realizes the conversion between ultrasonic energy and electrical energy through the resonance of piezoelectric crystals, thereby realizing the emission and reception of ultrasonic waves. The ultrasonic transmitter is installed at the J1 end, and the P27 port of the microcontroller outputs a square wave electrical signal at a frequency of 40kHz. Then the piezoelectric crystal will vibrate at the same frequency due to the reverse piezoelectric effect, realizing the conversion of electrical energy into ultrasonic energy and generating ultrasonic waves, as shown in Figure 3.
Figure 3 Ultrasonic transmitting circuit
Install the ultrasonic receiver at the J2 end. When there is no electrical signal applied to the two ends of the piezoelectric crystal, when the ultrasonic signal is received, the piezoelectric crystal will produce a piezoelectric effect and vibrate at the same frequency, realizing the conversion of ultrasonic energy into electrical energy and generating an electrical signal. The electrical signal is amplified by LM358 and sent to LM567 for phase-locked loop detection, so that the single-chip microcomputer can detect a ground wave. As shown in Figure 4 below.
Figure 4 Ultrasonic receiving circuit
2.2.3 Display Circuit
The display circuit uses KXM12864M LCD display screen.
2.2.4 Sound and light alarm circuit
As shown in Figure 5, the sound alarm circuit uses a piezoelectric buzzer. When the microcontroller outputs a low level, the transistor is turned on and the buzzer alarms.
Figure 5 Sound alarm circuit
As shown in Figure 6, in the light alarm circuit, when the microcontroller outputs a low level at the corresponding port, the green, yellow and red light-emitting diodes flash at different frequencies.
Figure 6 Light alarm circuit
2.2.5 Power supply circuit
As shown in Figure 7, the power supply VCC is composed of 2 to 4 No. 5 battery packs, C1, C2, C3, and C4 play a role in voltage stabilization. Pressing the switch SW1 turns on the power supply and the green LED lights up.
Figure 7 Power supply circuit
3 Software Solution
3.1 Main Program
The main program flow chart is shown in Figure 8. After the program is initialized, the confirmation button is pressed, the microcontroller transmits a square wave, and the entire system enters the deployment state. After each square wave is transmitted, the program will enter the delay state to determine whether an echo is received, that is, whether an interruption occurs. If an echo is generated, the program enters the interrupt service program, first turns off the interrupt, measures and reads the timer time t, and calculates the distance of the intruder by the formula, and displays the value on the LCD screen. Since the alarm program has three built-in alarm states, as the intruder approaches the intrusion distance, the "beep" sound of the buzzer and the flashing frequency of the light-emitting diode will gradually increase.
Figure 8 Main program flow chart
3.2 Function Display
3.2.1 Enter the system interface
Press the power switch, as shown in Figure 9, the system enters the initialization state, the system prompts you to press the "Confirm Key" (the first key from left to right below the LCD screen), and the system enters the monitoring mode.
Figure 9 The system enters the standby stage
Press the "Confirm button", as shown in Figure 10, the system enters the monitoring mode, the system starts to arm, and then prompts "Items are safe".
Figure 10 The system enters monitoring mode
Press the "Confirm Key" again, as shown in Figure 11, the system enters the monitoring range setting mode, and the second and third buttons from left to right below the LCD screen can increase or decrease the distance value of the monitoring area.
Figure 11 Entering the monitoring range setting mode
3.2.2 Real-time monitoring of intruder distance
(1) As shown in Figure 12, an intruder enters the guarded area, the alarm system is activated, the ultrasonic sensor measures a distance of 33 cm, and the green LED light and buzzer flash and sound at a slower frequency (the warning distance is 30-40 cm at this time).
Figure 12 Ultrasonic ranging range is 30-40 cm
(2) As shown in Figure 13, an intruder enters the guarded area, the alarm system is activated, the ultrasonic sensor measures a distance of 24 cm, and the yellow LED light and buzzer flash and sound at a faster frequency (the warning distance is 20-30 cm at this time).
Figure 13 Ultrasonic ranging range is 20-30 cm
(3) As shown in Figure 14, an intruder enters the guarded area, the alarm system is activated, the ultrasonic sensor measures a distance of 11 cm, and the red LED light and buzzer flash and sound at a faster frequency (the warning distance is 10-20 cm at this time).
Figure 14 Ultrasonic ranging range is less than 20cm
From the above, it can be seen that as the intruder continues to approach the ultrasonic sensor (or the target of defense), the alarm signal of the sound and light alarm device will be reflected through the sound of the buzzer and the flashing of light-emitting diodes of different colors at three different frequencies, thereby effectively reminding relevant personnel to be on guard and respond to the intrusion in time; at the same time, if the intruder finds the alarm signal, it is also a deterrent to his intrusion.
4 Steps
4.1 Initial State
Press the self-locking switch to turn on the power, and the LCD screen will display the system's initial status "System Introduction Ultrasonic monitoring system can monitor three adjustable areas. Press the confirmation button to enter the system."
4.2 Arming Status
According to the text prompt displayed on the LCD screen, press the confirmation button, which is the first button from left to right below the LCD screen. You will hear a "beep" sound and the system will enter the monitoring mode, that is, the armed state.
4.3 Setting Status
Press the confirmation key again to enter the monitoring range setting mode, that is, press the second and third buttons from left to right below the LCD screen to adjust the distance values of the three monitoring areas.
4.4 Return to the armed state
After the monitoring range is adjusted, press the return key, that is, press the fourth key from the left to the right below the LCD screen, and the system will re-enter the deployment state. At this time, the monitoring range is the adjusted range.
4.5 Disarmed state
Press the self-locking switch again, the power is turned off, and the system enters the disarmed state.
5 Innovations
5.1 Non-contact alarm
Compared with the traditional contact alarm system, this alarm system adopts ultrasonic ranging non-contact alarm method, which can provide maximum safety protection for the protected object in space.
5.2 Three adjustable monitoring areas
The alarm system monitors a dynamically adjustable prevention area, which is divided into three adjustable zones. The distance values of the three monitoring areas can be adjusted arbitrarily within the maximum effective distance, and the values can be accurate to centimeters.
5.3 The device is small and easy to install
The device volume is about 400cm3, which occupies a small space and is easy and concealed to install, and is basically not restricted by installation conditions.
6 Conclusion
The hardware circuit design of the sound and light alarm system based on single-chip microcomputer mainly consists of four parts: single-chip microcomputer system and display circuit, ultrasonic transmitting and receiving circuit, and sound and light alarm circuit. The circuit is simple and the cost price is 50 to 60 yuan. It is a low price and can be widely promoted and applied with a little packaging according to special needs.
Previous article:Community anti-theft alarm: How does Linux beat Windows in seconds?
Next article:DIY home burglar alarm technology and design reference
- 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
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Microchip Accelerates Real-Time Edge AI Deployment with NVIDIA Holoscan Platform
- Microchip Accelerates Real-Time Edge AI Deployment with NVIDIA Holoscan Platform
- Melexis launches ultra-low power automotive contactless micro-power switch chip
- Melexis launches ultra-low power automotive contactless micro-power switch chip
- Molex leverages SAP solutions to drive smart supply chain collaboration
- Pickering Launches New Future-Proof PXIe Single-Slot Controller for High-Performance Test and Measurement Applications
- Apple faces class action lawsuit from 40 million UK iCloud users, faces $27.6 billion in claims
- Apple faces class action lawsuit from 40 million UK iCloud users, faces $27.6 billion in claims
- The US asked TSMC to restrict the export of high-end chips, and the Ministry of Commerce responded
- The US asked TSMC to restrict the export of high-end chips, and the Ministry of Commerce responded
- Signal Integrity Analysis (Bergding)
- What is the function of SCR1 thyristor in this circuit?
- A multifunctional data acquisition system based on USB and FPGA
- COCOFLY Tutorial - Crazy Shell Drone Series Quick Start [4] Flight Control Firmware Burning
- GD32E231 DIY Competition (1)——KEIL platform built
- Can GaN technology create superior RF crystals?
- Today at 10:00 AM R&S Live Broadcast with Prizes [USB 3.2 Compliance Test]
- How to measure code execution time on ARM Cortex-M MCUs?
- 2019 Altium "Mobile Weekend Lab Class" Free Tickets- Shanghai Station
- EEWORLD University - Common techniques for designing low-power DC-DC converters