Design of analog street lamp control system based on single chip microcomputer

Publisher:RadiantBreezeLatest update time:2012-06-25 Source: 维库电子 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

0 Introduction

This article uses high-efficiency, energy-saving and environmentally friendly LED lamps as light sources, and uses sensor modules, light-controlled street lamp modules, and constant current source modules to implement it. According to environmental, traffic and other factors, the microcontroller collects signals from photoresistors or photoelectric switches to control the on and off of street lamps, realizing photoelectric and time control; at the same time, it has functions such as traffic situation detection, automatic fault detection and alarm, realizing intelligent control of street lamps, saving electricity energy and human resources.

1 System design requirements

1.1 System design requirements.

Design and make a set of simulated street light control system, the layout of street lights is shown in Figure 1. It is required to realize the clock function of the simulated street light control system, set and display the time of switching lights, and control the branch lights to turn on and off on time; automatically control the lights on and off according to the changes in the brightness of the environment; automatically adjust the lighting status according to the traffic conditions; independently control the on and off time of each street light; when the street light fails, the branch controller sends a ticking alarm signal and displays the number of the faulty light. The traffic conditions use infrared transceiver sensors to realize the automatic adjustment function. The unit controller has a dimming function, and the output power of the street light drive power supply can be automatically reduced according to the set requirements at the specified time. The power should be set and adjusted within the range of 20% ~ 100%, and the adjustment error is ≤2%.

Figure 1 Schematic diagram of street light layout

Figure 1 Schematic diagram of street light layout

1.2 System Design

The system uses C8051F020 microcontroller as the system controller, and uses wired transmission to control LED1 and LED2. The control method is shown in Figure 2. C8051F020 microcontroller is a fully integrated mixed signal system-level chip with built-in ADC and DAC. However, this system needs to collect changes in ambient light and automatically control the brightness of LEDs, which requires converting analog voltage into digital quantity processing and converting digital quantity into analog quantity control. The entire system is completely self-sufficient, uses fewer peripheral devices, has low system cost, and is simple and convenient to debug.

Figure 2 C8051F020 control structure

Figure 2 C8051F020 control mode structure.

2 System Hardware Design

2.1 System overall block diagram and control circuit design

The hardware structure of the infrared road light control system is shown in Figure 3. The control system is mainly composed of functional modules such as the main control microcontroller, display interface, infrared remote control, sensor, and constant current drive. The C8051F020 microcontroller receives the infrared remote control signal, sets the time for switching the light on and off, starts the analog control system, and collects the ambient light and dark signal and inputs it into the microcontroller for analog-to-digital conversion to control the switching state of the LED light. The microcontroller detects the working state of the LED light in real time. When a fault occurs, the microcontroller controls the sound and light circuit to alarm and controls the LCD to display the fault point number. The analog voltage is output within the specified time to control the brightness of the LED light. The traffic situation is detected according to the infrared receiving signal, and the LED light can be intelligently controlled according to different traffic conditions. The minimum system and interface circuit of the C8051F020 microcontroller are shown in Figure 4.

Figure 3 Infrared line light control system hardware structure

Figure 3 Hardware structure of infrared line light control system.

Figure 4 C8051F020 MCU minimum system and interface circuit schematic

Figure 4 C8051F020 MCU minimum system and interface circuit schematic.

2.2 LED constant current drive power supply design

Since OP07 has a very low input offset voltage (maximum 25 μV), OP07 does not require additional zeroing measures in many applications; OP07 also has the characteristics of low input bias current (± 2 nA) and high open-loop gain (300 V/mV). The output voltage of the 6th foot of the OP07 integrated operational amplifier is fed back to the inverting input terminal through resistor R30 to form a common-phase proportional circuit. The base of the power transistor Q6 is connected to the operational amplifier to increase the drive current. When the common-phase input voltage of OP07 is constant, due to the existence of negative feedback, the output voltage of OP07 is guaranteed to be constant, so that the current flowing through the LED load is a constant current. The schematic diagram of the LED constant current drive power supply circuit is shown in Figure 5. [page]

Figure 5 Schematic diagram of LED constant current drive power supply circuit.

Figure 5 Schematic diagram of LED constant current drive power supply circuit.

According to Figure 5, we can see that:

It can be seen from the above formula that the value of the output current is only related to the input control voltage, and the two are proportional. In the circuit, R25 = R26, R39 = R30, and the proportional factor can be changed by selecting appropriate resistance values. When changing the current source proportional factor, it is also necessary to change the capacitance value of the compensation capacitor C29.

2.3 Position detection circuit

Infrared transceiver sensor is used, a transmitting tube transmits infrared and a receiving head receives infrared signal. Figure 6 is the principle block diagram of infrared transceiver sensor to judge traffic conditions and infrared receiving and transmitting circuit. Infrared transmitting tube and receiving tube are installed in opposite direction. When an obstacle reaches the middle of infrared transmitting tube and receiving tube, different high and low levels will be generated. The single chip collects this signal and controls the switch state of the light. Infrared transmitting tube and receiving tube are shielded to eliminate external interference.

Figure 6 Schematic diagram of infrared transceiver sensor for judging traffic conditions and infrared receiving and transmitting circuit
Figure 6 Schematic diagram of the infrared transceiver sensor for judging traffic conditions and the infrared receiving and transmitting circuit.
2.4 Environmental light and dark change detection and fault detection circuit
The light-sensitive resistor is used to realize the change of its brightness and darkness, and different voltages are generated. After the analog-to-digital conversion processing inside the single-chip microcomputer, the corresponding processing is performed according to the detected signal to realize the change of the switch state of the LED lamp due to environmental changes. Its principle diagram is shown in Figure 7.
Figure 7 Ambient light and dark change detection and fault detection circuit
Figure 7 Ambient light and dark change detection and fault detection circuit.
3 System Software Design
The system software is programmed in C language, and the software development is debugged using the Xinhualong Silicon Laboratories IDE software platform. In order to facilitate writing and debugging and save resources, the program uses modular design, and the program is designed separately according to the functional requirements, which greatly simplifies the design and debugging of the program and saves the design cycle.
3.1 System main program
The main program starts working in a waiting state. When a key is pressed, the system works according to the key mode. This system uses infrared remote control and uses timer interrupt to decode it. The program works according to the set mode and automatically controls the switch state of the street light when encountering special circumstances. The main program flow chart is shown in Figure 8.
Figure 8 Main program flow chart.
Figure 8 Main program flow chart.
3.2 Power Regulation Subroutine
The power regulation subroutine flow chart is shown in Figure 9. The program first uses the PID algorithm to compare and determine whether the detection value is 20%. If not, the clock signal is increased by 1 and the PWM control voltage output is modified at the same time.
[page]
If the clock signal does not add 1, you need to consider whether you need to manually adjust the power.
Figure 9 Flowchart of the power regulation subroutine.
Figure 9 Flowchart of the power regulation subroutine.
4 System Testing
4.1 Switch control function measurement
(1) Test of automatic adjustment of traffic conditions.
The test of automatic adjustment of traffic conditions is shown in Table 1. The test results show that the switch of LED light 1 and LED light 2 can be automatically adjusted, and the distance between the positioning point on the movable object M and the vertical line passing through the "lighting state change point" (S, B, S\' and other points) is ≤2 cm.
Table 1 Traffic condition automatic adjustment test.
Table 1 Traffic condition automatic adjustment test
(2) Test the timing of switching lights on and off.
Set LED light 1 and LED light 2 to turn on at the same time (17:00), LED light 1 and LED light 2 to turn off at the same time (17:10); set LED light 1 and LED light 2 to turn on and off at different times (LED light 1 turns on at 18:00, LED light 2 turns on at 18:10; LED light 1 turns off at 9:00, LED light 2 turns off at 9:10). The timing test of turning on and off the lights is shown in Table 2.
Table 2 Switching light timing test
Table 2 Switching light timing test
It can be seen from the above table that there are errors in the system. The errors are caused by errors in the circuit’s own clock and human reading errors.
(3) Test the automatic on/off switch of lights when the ambient light changes.
The test of automatic switching lights on and off when the light changes shows that: when the environment becomes darker, the lights are automatically turned on, and when the environment becomes brighter, the lights are automatically turned off.
4.2 Constant current source output power test
Table 3 shows the measured current value when the constant current source is connected to the LED load and the control voltage is adjusted.
Table 3 LED lamp constant current drive circuit test data
Table 3 LED lamp constant current drive circuit test data
From the test results, it can be seen that the constant current accuracy of the current source reaches 98.7%, the output power accuracy changes by less than 2%, and the basic technical indicators meet the design requirements.
5 Conclusion
Through comprehensive testing, this simulated street light control system has realized the self-setting and display of the switch time, controlling the entire branch to turn on and off the lights on time, and automatically controlling the brightness and switch of the lights according to the changes in the ambient light and traffic conditions; when the street light fails, the branch controller sends a ticking alarm signal and displays the number of the faulty light. The entire system is completely self-sufficient, uses few peripheral devices, is convenient and flexible in software programming, is simple and convenient in system debugging, has low system cost, high cost performance, and has high practical significance.
Reference address:Design of analog street lamp control system based on single chip microcomputer

Previous article:Overview of MCU Memory Registers
Next article:The same data memory expansion technology analysis solution as the MCS51 series microcontroller

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号