- Home >> Technical Service >> MCU
SCM sound and light control lamp system
Design of sound and light control lamp system based on single chip microcomputer
With the rapid development of society, technology is following closely behind. Many public places have taken many measures in terms of lighting. This will also be a current development trend. In addition to sound and light control in real life, microwave induction and human body There is also an infrared sensor switch. However, microwave induction is not stable enough and anti-interference is not ideal. Although infrared induction is more ideal than microwave induction in terms of performance, because its installation is more complicated and the price is relatively expensive, the scope of application of infrared induction is limited. , can only be used in some well-managed places, such as: hotels, restaurants, corridors and some fixed corridors. Although infrared sensors can be used to control lighting in these places, there are also price issues and unfavorable factors in installation management.
The circuit design avoids the above instability, performance, price and installation limitations. It can meet most of the environment and can save energy in a limited amount.
1. Hardware circuit design of sound and light control lamp system
The course design circuit is composed of 51 single-chip microcomputer, LM393 voltage comparator circuit, electret microphone control circuit, photoresistor control circuit, relay control circuit, digital tube countdown, key switch display part.
1.1 MCU and display part
The circuit is composed of a single-chip microcomputer, a triode, and two common anode digital tubes. The time countdown digital tube display circuit is shown in Figure 2; when the program enters initialization, the digital tube displays ten seconds, and when there is sound at night, the digital tube starts to count down when the relay is closed. The pins of the single-chip microcomputer output high and low levels to change the base voltage of the triode, so that Q2 and Q3 are turned off or turned on, thereby changing the bit display of the digital tube. The P0 port of the microcontroller outputs high and low levels to change the values of a, b, c, d, e, f, and use human visual effects to display different numbers. The two-digit digital tube is a common anode digital tube, and the segment selection is connected to the P0 port. By changing the high and low levels of the P0 port pins, the numbers are displayed, and the P2.3 pin is used to control the one-digit digital tube on and off, and the P2.7 is used to control the ten-digit digital tube on and off, and a certain time Scan at intervals, pull up or down the pins of P0 port, P2.3, and P2.7 to display the changes of different digital tubes on and off. The driving current of the single-chip microcomputer is limited, and it cannot drive the digital tube to light at the same time, so two PNP transistors Q2 and Q3 are added to drive the digital tube to display.
Press the button S2 to pause the display and the light is always on, press the digital tube again to continue the countdown.
1.2 Sound and light part
Figure 3 shows the sound and light control circuit. By changing the resistance value of the photoresistor RRR, the voltage of the same input terminal INA+ is changed, and at the same time compared with the voltage of the reverse input terminal INA-, the resistance value of the photoresistor RRR is changed by the intensity of the external light, and the external light When it is strong, the resistance value of RRR is only a few hundred ohms, and when the external light is weak, the resistance value of RRR is tens of megohms. The photoresistor RRR and R5 resistor are connected in series in the circuit, and the change of RRR resistance causes the change of INA+ pin voltage. The INA+ pin voltage is lower than the INA- pin voltage and OUTA outputs a low level. At this time, the photoresistor works at night. The INA- pin voltage can be adjusted by the sliding rheostat R4.
The electret microphone MK1 converts the sound into a weak voltage signal. When there is a sound, the microphone senses the sound and generates an AC signal, and then the AC signal causes a voltage drop across the voltage across C4, forcing C4 to charge. At this time, the base of the triode has a voltage, which meets the conduction condition of the triode. At this time, the collector pin becomes a high level. After the voltage of INB- is compared with the voltage of INB+, OUTB outputs a low level, and the conduction time of the triode depends on the capacity of capacitor C4.
1.3 Relay part
The pin P3.7 of the microcontroller is connected to the base of the transistor Q1, and the transistor is used to turn on and off the relay, which becomes a relay drive circuit as shown in Figure 4: the base of the transistor Q1 is connected to P3 of the microcontroller. 7 ports, the output current of the I/O port of the microcontroller is about 20mA, so it cannot be directly used to drive the load. Q1 is used to amplify the current, the amplified current is ninety times, the rated current of the relay is 40mA, and the base current of Q1 is amplified enough to drive the relay to work. When the P3.7 port outputs a high level, the Q1 transistor is cut off, and when the P3.7 port outputs a low level, the Q1 transistor is turned on, the relay is energized, the relay is normally open, the electric shock is closed, and the load light is on.
The LED is used to display the pull-in and disconnection state of the relay. When the relay is pull-in, the LED light is on, and when the relay is disconnected, the LED light is off.
2. Installation of sound and light control lighting system
First draw the schematic diagram and check, compile the program, draw the simulation circuit and debug it, the software can be realized, and then prepare the materials needed for welding, as well as various tools, first test whether each device is good or not, and can correctly distinguish each device Positive and negative electrodes, how to use them, what to pay attention to when welding, the sequence of the welding process, one part is debugged after welding, the other part is inspected after welding, and problems can be solved if you know how to modify the program.
3. Comprehensive inspection of sound and light control light system
Before welding the circuit, it is necessary to measure each component separately to see if there are any bad components, to find out the positive and negative poles of each component and its function, and the order of welding. If some components have sockets, solder the sockets first, and insert the components into the sockets after soldering the sockets. When soldering electrolytic capacitors, digital tubes and LED lights, the temperature of the soldering iron should not be too high, and the soldering time should not be too long, so as not to burn out the components.
After the circuit is soldered, it is necessary to check each pin to see if there is any false soldering or missing soldering on each pin, and use a multimeter to check whether the positive and negative electrodes of each component are connected together. Whether each pin is short-circuited, and whether some pins are supposed to be connected together are not soldered or soldered incorrectly. In particular, the pins of the single-chip microcomputer are too close, and a multimeter should be used to check whether the adjacent pins are short-circuited. Check whether the connection of each pin is correct, and whether the functions of the pins are wrongly soldered. After checking the basic measurements, don't rush to power on, insert the components into the socket, and then use a multimeter to measure each pin to see if there is any short circuit, open circuit, or false soldering. Finally, be sure to measure the positive and negative poles of the circuit to see if there is a short circuit.
in conclusion
This course is designed for energy saving, using the combination of single chip microcomputer, sound and light to realize lighting. The research in this paper is suitable for use in homes, offices, corridors, buildings, and some public places as street lights. Its working principle uses the sound of people walking to be detected by the circuit, and at the same time it is determined that the light will be on at night, and the light will be turned off after a delay after the person leaves. Even if someone passes by during the day, the light will not turn on, and the power consumption of the circuit itself is low. It is powered by a five-volt power supply, and coupled with the characteristics of the circuit itself, this circuit has the effect of saving energy. The design has a wide range of use and is stable and reliable, and it is worthy of being applied to life.
This course designs sound and photosensitive circuits to adjust their sensitivity, adds buttons to keep the lights on, and increases the display time of the lights to improve its practicability. When someone passes by continuously, it will re-update the countdown with the last person as the countdown, so that the design is more in line with the actual situation.
The above is the design method of the sound and light control light system based on the single-chip microcomputer introduced by Shenzhen Zuchuang Microelectronics Co., Ltd. for you. We have rich experience in customized development of smart electronic products, can evaluate the development cycle and IC price as soon as possible, and can also calculate the PCBA quotation. We are the agent of Sonix MCU and Yingguang MCU agent, selling and developing MCU and voice IC solutions of Sonix and Yingguang. We act as an agent and develop ICs and solutions of Jieli, Ankai, Quanzhi, realtek and other series, and also develop BLE Bluetooth IC, dual-mode Bluetooth module, wifi module, and Internet of Things module. We have hardware design and software development capabilities. Covering circuit design, PCB design, single-chip microcomputer development, software custom development, APP custom development, WeChat official account development, voice recognition technology, Bluetooth development, wifi technology, etc. It can also undertake the research and development of smart electronic products, the design of household appliances, the development of beauty equipment, the development of Internet of Things applications, the design of smart home solutions, the development of TWS earphones, the development of Bluetooth earphone speakers, the development of children's toys, and the development of electronic education products.
- TOP