Design of automatic measurement and control LED energy-saving lighting system based on C8051F020

Publisher:Whisper123Latest update time:2011-04-06 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Abstract: This paper proposes a design scheme of LED lighting system which can realize automatic switch and brightness adjustment according to the changes of ambient light intensity, infrared and temperature. The single chip microcomputer C8051F020 is used as the system control core, and a light intensity sensor composed of silicon photocell and integrated operational amplifier is designed. The pyroelectric module is selected as the infrared wireless sensor, and the DS18B20 is used as the temperature sensor. The working information display is also realized by using liquid crystal. The experimental results show that the system can automatically shut down when the light intensity is greater than 2 170 lx or the temperature is higher than 82.5 ℃, and can automatically turn on when the light intensity is less than 1 040 lx or the temperature is lower than 49.3 ℃; when the light intensity changes between 1 000 and 2 000 lx, the LED brightness can be automatically adjusted to maintain the basic stability of the ambient illumination.

LED is known as the "fourth generation of green lighting" and has been gradually applied to telecommunications, transportation, agriculture, medicine, military and other fields. LED (Light-emitting Diode) is a solid-state semiconductor component that can directly convert electrical energy into light energy. As a solid lighting source, LED has the characteristics of long life, high light efficiency, and multiple light colors. It can work under safe low voltage, and can also be continuously switched on and off, and can achieve 0% to 100% dimming.

This article describes a design scheme for an automatic measurement and control LED energy-saving lighting system based on the single-chip microcomputer C8051F020. The system can regulate the luminous intensity of LED lamps. When the ambient light intensity decreases, the luminous intensity of LED lamps is automatically increased. When the ambient light intensity increases, the luminous intensity of LED lamps is automatically reduced, maintaining the stability of the ambient light intensity value and achieving energy-saving effects. At the same time, the system also has three sensor switches to control the on and off of LED lamps, namely light intensity, temperature, and infrared. In addition, overvoltage and overcurrent protection measures are added to further improve energy-saving efficiency and ensure the normal operation of the lighting system. In addition, the system also uses liquid crystal to realize the external display of LED lighting working information. The system can be applied to many occasions such as corridor lighting, work lighting, equipment lighting, etc.

1 Overall design plan

This system uses the single-chip microcomputer C8051F020 as the core to realize the automatic measurement and control of LED lighting. The overall framework of the system is shown in Figure 1.

The overall framework of the system

Figure 1 Overall framework of the system

The design of the entire system is divided into hardware design and software design. The hardware design can be divided into three parts: power supply drive module, automatic measurement and control and display module.

The process of power supply drive module is as follows: 12~24 V DC power supply input, after passing through the overvoltage protection circuit, provides safe voltage to the LED drive circuit composed of SN3350 chip, and the drive circuit drives the LED lighting to work normally. The automatic measurement and display module mainly includes light intensity sensor, temperature sensor, infrared wireless sensor and LCD display. The light intensity sensor uses silicon photocell and integrated operational amplifier to form a photoelectric conversion circuit, which converts the light intensity in the environment into a voltage signal. After A/D conversion by the single-chip microcomputer, according to the relationship curve between the measured voltage and light, the corresponding voltage value is converted into illumination and displayed through LCD1602 liquid crystal; the temperature sensor uses DS18B20 chip circuit to convert the real-time ambient temperature into an electrical signal and transmit it to the single-chip microcomputer for analysis and processing, and it is also displayed through LCD1602 liquid crystal; the infrared wireless sensor uses a pyroelectric infrared wireless sensor circuit with BISS0001 as the core. After receiving the signal, the sensing circuit transmits it to the single-chip microcomputer to control the switch of the LED lighting.
The system realizes energy saving and automatic measurement and control functions by the single-chip microcomputer C8051F020. The idea of ​​software programming is: the PWM signal generated by the microcontroller controls the ADJ pin of the SN3350 driver chip. By changing the duty cycle of PWM, any voltage can be input to ADJ to control the switch and brightness of the LED lighting.

2 Hardware Circuit Design

2.1 Microcontroller C8051F020

This system uses the single-chip microcomputer C8051F020, which contains the CPU core of CIP-51 and the instruction system is fully compatible with MCS-51. It contains 64 kB of on-chip Flash program memory, 4 352 B of RAM, 8 I/O ports with a total of 64 I/O lines, 1 12-bit A/D converter, 1 8-bit A/D converter, and 1 dual 12-bit D/A converter, 2 comparators, 5 16-bit general-purpose timers, 5 capture/compare modules of programmable counter/timer array, watchdog timer, VDD monitor and temperature sensor. The C8051F020 single-chip microcomputer supports dual clocks and its operating voltage range is 2.7 to 3.6 V (the voltage resistance of the port I/O, RST and JTAG pins is 5 V).
2.2 LED drive circuit

This system uses the SN3350 chip as the core of the LED driver circuit. The SN3350 is a step-down inductive current continuous mode driver chip suitable for applications where the power supply voltage is higher than the voltage required for one or a string of LEDs. The chip has an input voltage range of *0 V, an output current of up to 750 mA, and an output power of up to 30W. Figure 2 shows the LED driver circuit used in this system.

LED drive circuit

Figure 2 LED drive circuit

In Figure 2, pin 3 ADJ is a multi-function switch/brightness control pin, and its pin characteristics are:

1) Pin floating: working in normal mode. (In normal mode, VADJ = VREF = 1.2 V, working current IOUTnom = 0.1/R1);

2) Input voltage is lower than 0.2 V: turn off the output current;

3) Input DC voltage from 0.3 to 1.2 V: output current adjustment range from 25 to 100%;

4) Control the output current through PWM signals with different duty cycles;

5) When the ADJ pin voltage exceeds 1.2 V: the current is automatically clamped at 100%.

The output current of SN3350 can be set by adding a control signal to the ADJ pin. This system uses a single-chip microcomputer to generate a PWM signal and input it to the ADJ pin. The drive circuit enters different working modes at different voltage values ​​according to the above pin characteristics.

2.3 Light intensity sensor

The light intensity sensor of this system adopts a photoelectric conversion circuit, and its schematic diagram is shown in Figure 3. The function of the circuit is to convert the current output by the silicon photocell (equivalent to a light-controlled constant current source) into a voltage signal output through the integrated operational amplifier LM324 and the feedback resistor Rf. By adjusting the value of Rf, the output voltage value can be changed, so as to meet the requirements of the input signal voltage value of the subsequent control circuit. In actual application, the light intensity affects the size of Is, which in turn causes the change of Vout, thereby realizing the conversion of the light intensity signal into a voltage signal.
Photoelectric conversion circuit

Figure 3 Photoelectric conversion circuit

Table 1 and Figure 4 show the illuminance-voltage relationship measured using an illuminance meter and a voltmeter in an actual photoelectric conversion circuit.

Table 1 Photoelectric conversion circuit test results

Photoelectric conversion circuit test results
Illuminance-voltage relationship

Figure 4 Illuminance-voltage relationship

As shown in Figure 4, as the ambient light increases, the output voltage of the photoelectric conversion circuit also increases linearly, with a correlation of 99.1% and good linearity. This shows that the actual test results of the photoelectric conversion circuit made according to Figure 3 are in good agreement with the theoretical expectations. At the same time, the light intensity-voltage relationship straight line in Figure 4 also provides an important basis for the program design of the software part.

2.4 Infrared wireless sensor

The infrared wireless sensor of this system adopts the pyroelectric infrared wireless sensor circuit with BISS0001 as the core. BISS0001 is a digital-analog hybrid special integrated circuit composed of an operational amplifier, a voltage comparator, a state controller, a delay timer, and a blocking timer. The pyroelectric infrared wireless sensor with BISS0001 as the core adopts a passive detection method, and its circuit principle is shown in Figure 5. The Fresnel lens (DSG) receives the infrared light with a wavelength of 8 to 12 μm emitted by the human body entering the detection area, and converts the optical signal into an electrical signal through the pyroelectric sensor (PIR), which is amplified and filtered by the circuit system and finally outputs the signal.
Pyroelectric infrared wireless sensor circuit

Figure 5 Pyroelectric infrared wireless sensor circuit

2.5 Other circuit modules

There are also two simpler circuit modules in this system: overvoltage protection circuit and temperature sensor circuit.

The significance of overvoltage protection is that when the internal voltage stabilization loop of the switching power supply fails or the output overvoltage phenomenon is caused by improper operation of the user, the overvoltage protection circuit can protect to prevent damage to the subsequent electrical equipment. In addition, a self-recovery fuse can be connected in series in the system power supply circuit to play the role of overcurrent protection.

The temperature sensor of this system adopts the digital temperature sensor DS18B20 from Dallas Semiconductor. This is the world's first temperature sensor that supports the "one-line bus" interface. The circuit using DS18B20 as the temperature sensor is very simple. The 9-bit temperature signal is directly transmitted to the microcontroller for processing via a bus.

3 Software Design

The idea of ​​software design is to design the modules independently first, and then organize the modules comprehensively. The flowchart of the system program design is shown in Figure 6.

System programming flow chart

Figure 6 System programming flow chart

The program is mainly divided into five modules: brightness control module, temperature detection and processing module, light intensity detection and processing module, infrared wireless detection and processing module, and LCD display module. The first three more complex modules are described below.

1) The brightness control module can control the brightness of the LED by controlling the voltage of the signal on the ADJ pin according to the pin characteristics of the given LED driver circuit chip SN3350. The single-chip microcomputer 80C51F020 can generate a PWM signal with Vpp=5 V by itself, so the brightness of the LED lamp can be controlled by controlling the duty cycle of the PWM signal. By setting the judgment program based on the illuminance-voltage relationship straight line in Figure 4 and obtaining the corresponding duty cycle, the brightness can be controlled.

2) Temperature detection and processing module Since the signal output pin of the DS18B20 chip outputs a digital signal, the content of this module is mainly to decode the digital signal obtained from the DS18B20 to obtain the actual ambient temperature value.

3) The light intensity detection and processing module uses the photoelectric conversion circuit in Figure 3 to detect the ambient light intensity and output a voltage signal. This signal is an analog signal, so it needs to be converted to digital before it can be processed by a single-chip microcomputer. Using the A/D conversion module built into the 80C51F020, analog-to-digital conversion can be achieved. The voltage signal corresponding to the light intensity is between 0 and 2.4 V, so a certain voltage value is converted into an 8-bit digital signal, and then the light is controlled through processing similar to the temperature signal.

According to the ADJ pin characteristics of the SN3350 driver chip control terminal described in Section 2.2 of this article, the specific program design scheme is as follows:

The LED light automatically adjusts and controls according to the external environment illumination: when the actual illuminance is greater than 2 000 lx (the illuminance value can be set according to needs, the same below), the input voltage of the ADJ pin is set to 0 and the LED is off; when the actual illuminance is less than 1 000 lx, the input voltage of the ADJ pin is set to 0.3 V and the LED is on; when the actual illuminance is greater than 1 000 lx and less than 2 000 lx, the input voltage of the ADJ pin is changed accordingly between 0.3 and 1.2 V.

The LED light automatically adjusts and controls according to the external ambient temperature: when the temperature of the LED is greater than 80℃ (the temperature value can be set according to needs, the same below), set VADJ=0; when the temperature of the LED is less than 50℃, set VADJ=1.2 V.

The LED light is automatically adjusted and controlled according to the external infrared radiation signal: when the pyroelectric infrared wireless sensor sends a sensing signal, set VADJ=1.2 V, and when no signal is sent, set VADJ=0.

4 System Testing

4.1 Basic working test

The power supply is 15 V; the measured working voltage across the three LED lamps is 14 V; the output current of the drive circuit is 320 mA; when the overvoltage protection test adjusts the input voltage to be greater than 24 V, the voltage across the LED drops rapidly; when the input voltage rises to 27 V, the voltage across the LED has dropped to 0 V.

The test results show that the system can work normally and stably under low voltage conditions and has overvoltage protection function.

4.2 Functional Testing

1) Measurement and display functions

Can it display the ambient light intensity: Yes, the LCD can display the ambient light intensity accurately to 1 lx;

Can it display the ambient temperature: Yes, the LCD can display the ambient temperature accurately to 0.1℃;

2) Automatic control function

Can the light be turned on and off when the light intensity changes: Yes, the light will be automatically turned off when the light intensity is greater than 2170 lx; ​​the light will be automatically turned off when the light intensity is less than 1040 lx (the design thresholds are 2000 lx and 1000 lx respectively);

Can the light be turned off when the temperature changes: Yes, the light will be turned off automatically when the temperature is higher than 82.5℃;

The light will automatically turn on when the temperature is below 49.3℃ (the design thresholds are 80℃ and 50℃ respectively);

Can the ambient light intensity be maintained basically stable? Yes. When the ambient light intensity decreases but is not less than 1 000 lx, the LED's luminous intensity will be automatically increased; when the ambient light intensity increases but does not exceed 2 000 lx, the LED's luminous intensity will be automatically reduced.

Can it sense infrared radiation and turn the light on and off: Yes. When someone enters a certain distance (maximum radius 3.5 m) of the LED light, the light will be automatically turned on and maintained for 10 seconds before gradually decreasing in brightness until it is turned off.

The test results show that the system has the function of automatically controlling the switch and adjusting the light intensity according to the changes in ambient light intensity, temperature and infrared radiation, and the measured data is in good agreement with the theoretical design value.

5 Issues that need to be paid attention to during the design process

The characteristic of this system is that there are many hardware module circuits. When designing, attention should be paid to the common ground and interface matching. Specifically, the six modules, including the single-chip microcomputer C8051F020, the SN3350 chip of the LED driver circuit, the integrated operational amplifier LM324 in the photoelectric conversion circuit, the core BISS0001 chip of the pyroelectric infrared wireless sensor circuit, the DS18B20 temperature sensor circuit and the overvoltage protection circuit, must share the same ground with the DC power supply. The interface matching problem mainly exists between the output ports of the three sensors of light intensity, infrared radiation and temperature and the input ports of the single-chip microcomputer, as well as between the output ports of the single-chip microcomputer and the control pins of the LCD LCD1602 and the LED driver chip SN3350. In addition, since the operating voltage of chips such as LM324, BISS0001, and DS18B20 is 5 V, which is lower than the 15 V operating voltage of the LED lighting system, a 5 V power supply must be connected during testing, and when the finished product is actually made, a level conversion circuit must be added to convert the unified 15 V power supply voltage into a 5 V regulated output to the relevant chips.

When writing a program, you need to consider the priority of the information transmitted by each sensor being processed by the microcontroller. According to actual needs, the reference priority order of the signal received by this system is: temperature signal, infrared signal, light intensity signal.

6 Conclusion

The LED lighting system designed in this paper uses the single-chip microcomputer C8051F020 as the control core, and realizes the functions of automatic switching and brightness adjustment according to the changes in ambient light intensity, infrared radiation, and temperature conditions, highlighting the advantages of LED energy-saving lighting, and thus has a good practical reference value. The biggest feature of this system is its high functional integration, integrating measurement, control, and display, including three sensors: light intensity, infrared radiation, and temperature. In practical applications, relevant thresholds can be set or a certain function can be highlighted according to different needs. For example, when it is applied to corridor and toilet lighting, the infrared radiation sensing function is mainly used. The light is not on when no one is there, and the light is on when someone is there, achieving the effect of saving electricity; when it is applied to office and classroom lighting, the light intensity sensor and dimming function are mainly used to stabilize the ambient light intensity at a certain set value, the light is not on or darker during the day, and the light is on at night, thereby improving the utilization rate of electricity; when it is applied to smart desk lamps and workpiece processing table lighting, it can also monitor the working temperature (for example, the light is off when it exceeds 80℃); and so on.

Reference address:Design of automatic measurement and control LED energy-saving lighting system based on C8051F020

Previous article:Circuit diagram of TCM850,851,852 using feedback method for control
Next article:Design of LED control system based on synchronous DMX512

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号