MartinFowler

2021-K Question-LED Stable and Adjustable Desk Lamp-Niuzi Team

 
Overview

I. Introduction

This is my first time to participate in a large-scale competition. Some of the competitions I signed up for before were unfortunately aborted, but this gave me plenty of time to prepare for the electronic design competition. Because it was our first time to participate, our foundation was not very good, so the teacher's guidance was very important. The teacher's careful teaching was one of the reasons why we won the award. During the summer vacation, my teammates and I studied microcontroller technology and some analog electronics knowledge in the laboratory. Because the competition was postponed, this gave us more time to study and prepare for the competition. When it came time to choose a topic for the competition, we chose question K. We chose question K because this question was similar to the question in our school competition, and the method of solving the problem was also simple and crude - go directly to the module.

2. Team introduction

Wen XX: That’s me. I am the commander in the team. I know a little bit about various things, but I am not very proficient. The electronic competition is mainly about software debugging and designing schematic diagrams of some simple modules.

Farmer XX: My roommate, who is responsible for the design and welding of the team’s works, can make the works more beautiful and practical. He put a lot of effort into the construction of the work and is the master craftsman in the team.

Tan XX: As a teammate who got to know each other because of similar interests, he is indispensable in the conception of the work. The choice of modules has never let us down.

3. Topic analysis

According to the requirements of the topic, the first thing we thought of was to make two things, one was a digital illumination meter, and the other was an LED desk lamp with stable and adjustable illumination. Since we are doing a question about light perception, naturally the light intensity sensor is indispensable. At first we thought of a photoresistor, but the data was very inconsistent during the experiment. Just when we were at a loss, our senior told us that he had used a very good sensor. The light sensor used is a light sensor module based on BH1750. Because the senior has done it before, we directly used the module he made before to test, and found that the experimental results were very good. Then we established the use of BH1750 light intensity sensor. For the subsequent light source control module, we used the MV-AP1024-2T light source controller existing in our laboratory. This module requires the rs232 module to realize communication between the microcontroller and the light source controller. Because this light source controller requires 24V to work properly, we equipped this controller with a boost constant current module, so that the controller can work normally. As for the light panel, we chose the 24V LED light panel that is matched with the controller (originally we planned to buy a large LED light panel to deal with the problem of uniform lighting, but a big mistake occurred when we bought the materials. We originally asked the merchant The agreed 30x30cm became a 30x30mm LED light panel. In addition, none of the matching light panels we bought worked efficiently, so we chose the LED light panel matched with the controller). As for the choice of microcontroller, we seemed to be much more casual. Considering that the school uses Arduino microcontrollers for teaching, we asked the teacher for some ATMEGA328 core boards to do the questions. I would like to thank the teacher and the school for their support. Without their support, there would be no presentation of the work. Because the core board of the microcontroller is powered by 5V, for the question requirement that it can only output 10~15V (the controllable desk lamp part), we arranged a 5V voltage stabilizing module for the microcontroller to ensure that the microcontroller will not be burned. In order to achieve adjustable brightness, we designed an additional button module to switch the system functions and increase and decrease the brightness. Finally, there is the display screen. We chose our commonly used 1602 display screen to reduce the pressure of programming. The block diagram is as follows:

4. Theoretical analysis and calculation

1. Power efficiency design

(1) The design requires that the lighting emphasis display number at a height of 0.5m of the light panel can reach more than 1,000;

(2) When the desk lamp power supply voltage is 12V, the power efficiency (the ratio of the power consumption of the LED light panel to the output power of the power supply) is not less than 90%.

 

After calculation and data review, it can be concluded that the lamp panel power of 24W can meet the requirements. The rated operating voltage of a single LED lamp bead is 3V. If 12V is used to directly power the lamp board, each branch can only carry 3-4 lamp beads. In order to ensure the illumination, it can only be achieved through multiple parallel branches, which will inevitably cause a large operating current, more than 2A. The high working current will cause large power loss and heat generation along the way, and will also affect the arrangement of lamp beads and electronic components, making it impossible to ensure that the illumination meets the requirements.

I=P/U=24/12=2A (Formula 1)

P=I2*R (Formula 2)

It is calculated from the formula that the 12V light panel cannot achieve sufficient illumination and the working efficiency cannot meet the requirements. Directly using 12V light panels cannot meet the design requirements.

Desk lamp working efficiency 

η=P light panel/P power supply (Formula 3)

According to the formula, it can be concluded that there are two main ways to improve the working efficiency of the desk lamp: one is to increase the working power of the lamp board, and the other is to reduce the power loss of the driving module.

A 24V light panel is used. Under the same operating current, an increase in voltage can double the power of the light panel that can be carried.

Meet the first of the above methods.

Using a 24V light panel, compared to a 12V light panel, the current is reduced by half under the same lighting power. According to formula (2),

The power loss of the drive module can be significantly reduced, satisfying the second condition of the above method.

In summary, this design uses a 24V light panel, uses a high-efficiency boost module to boost the 12V DC voltage to 24V, and then controls the light panel through a 24V DC drive module. According to experience, the efficiency of the 12V to 24V boost module can reach 96%, the maximum efficiency of the light panel driver module can reach 96%, and the overall efficiency η can reach 92%, meeting the design requirements.

2. CNC constant current source design

MV-AP1024-2T light source controller uses the MCP19114/5 chip to control brightness. The chip is a digital enhanced power supply analog synchronous lower-side PWM controller. The switching frequency of the MCP19114/5 is generated by the single-edge 8MHz internal clock. Set the MCP19114/5 switching frequency by configuring the PR2 register. The maximum duty cycle allowed by the driver is adjustable and controlled by the PWMRL register. The programmable range is 31.25kHz~2MHz. The available switching frequency below 2MHz is defined as FSW=8MHz/N, where N is an integer (4≤N≤256). The duty cycle of PWM is determined by the register input to PWMRL, and is generally calculated using the following formula:

PWM=PWMRL×TOSC×TPrescalevalue

The PWMRL bit can be written to at any time, but after a match between PR2 and TMR2, the duty cycle is latched into PWMRH .

5. Circuit design

1. Structural framework

The overall module of the circuit is shown in the figure. The content of this design is an LED desk lamp with stable and adjustable illumination and a digital display illumination meter. The hardware design uses ATMEGA328 as the main control chip. The desk lamp mainly includes three parts: illumination detection circuit, control circuit, and LED light board. The control module controls the illumination according to the collected illumination. Real-time control of the brightness of the LED light panel to ensure stable illumination in the irradiated area, forming a closed-loop control system. The illuminance meter mainly includes an illuminance detection circuit and an LCD1602 liquid crystal display . The power supply is powered by a mobile rechargeable power supply. The LCD screen displays the illuminance value of the environment in real time. The dimming desk lamp is composed of an LED light panel and an illumination detection and adjustment circuit. The illuminance meter is used to detect the dimming level of the desk lamp, so the two can use the same specification of illuminance detection sensors.

2.Button circuit

 

 

The buttons are mainly used for +/- brightness, automatic light control mode switching, and one-click maximum brightness (convenient for measuring efficiency). When connecting the circuit, pay attention to using the diagonal connection method of the keys to ensure that the keys can function.

3. Illuminance meter LCD1602 display circuit

 

 

LCD1602 is mainly used to display light intensity. R1 is mainly used to adjust the backlight. I chose a larger resistance value because there is no 10K potentiometer in the laboratory, so it is best to use a 10K potentiometer when selecting the potentiometer, otherwise it will be very troublesome.

4. Module selection (including purchase link)

(1) Boost module

The boost module I chose is the existing 400W boost constant current module in the laboratory. I chose this boost module because it has a conversion efficiency of up to 96%. The input voltage can be DC8.5V~50V and the output voltage is 10 ~60V adjustable, fully meets our needs. Link:  https://m.tb.cn/h.fjewtoV?sm=394f45

(2)GY-302 BH1750 module

BH1750 is a digital light intensity sensor integrated chip. BH1750 is internally composed of photodiodes, operational amplifiers, ADC acquisition, crystal oscillators, etc. The PD diode converts the input optical signal into an electrical signal through the photovoltaic effect. After amplification by the operational amplifier circuit, the voltage is collected by the ADC, and then converted into a 16-bit binary number through the logic circuit and stored in an internal register. BH1750 leads to the clock line and data line. The microcontroller can communicate . You can choose the working mode of the BH1750 and extract the illumination data from the BH1750 register. Link: https://m.tb.cn/h.fRU5bun?sm=a54859 

(3)MV-AP1024-2T light source controller

See theoretical analysis for details. Link: https://m.tb.cn/h.fRUgAsM?sm=8d3a9f

(4)RS232 module

The main purpose of using the RS232 module is to communicate with the light source controller so that the light source controller can identify the data of the lighting sensor and adjust the light. Link: https://m.tb.cn/h.fQWypId?sm=aca481

(5) Buck module

Considering that the microcontroller cannot withstand a voltage of 10~15V, we equipped the microcontroller with a step-down module, so that the microcontroller will not be burned when working.

(6) ATMEGA328 core board

Arduino is used because Arduino is a convenient, flexible, and easy-to-use open source hardware product. It has rich interfaces, including digital I/O ports, analog I/O ports, and supports SPI, IIC, and UART serial communication. It can sense the environment through various sensors, and feedback and influence the environment by controlling lights, motors and other devices. It has no complex microcontroller underlying code, no difficult assembly, just simple and practical functions, and has a simple programming environment IDE, with great freedom and high scalability performance. Link: https://m.tb.cn/h.fQ3ZEvr?sm=7d6d3b

6. PCB design

1. Button module PCB

 

 

The production of the button module is relatively simple, just pay attention to the electrical characteristics of the button.

2.1602 shows part of the PCB

 

PS: Since we make the boards ourselves, we are a little more casual.

7. Physical display

This product can achieve continuous brightness adjustment and automatic adjustment, but the power consumption can only be maintained at about 85%. The best performance depends on the placement of the desk lamp.

8. Work assembly

9. Programming

1. Program framework

The overall program design of the LED desk lamp software with stable and adjustable illumination, the flow chart is as follows.

Program function description

1) Key function: Set the illumination value of the LED light

2) Collect the ambient illumination of the desk lamp: the control system module reads the illumination value of the illumination sensor in real time

3) Automatic control and adjustment of LED light illumination: mainly control the constant current source through PID method, and the output current allows the LED light to adjust the brightness and keep the ambient illumination stable. 2.Button module

The button function module in this desk lamp system mainly adjusts the illumination value of the desk lamp to increase or decrease through the + and - buttons, so that the brightness can be continuously adjusted from the brightest to completely extinguished. Some procedures are as follows.

 if (digitalRead(2) == 0)

 {

 key = key + 2;

 delay(50);

 if (key > 255)

 {

 key = 255; 

 }

 sendVision();

 autoComm = 0;

 digitalWrite(13, LOW);

 }

 if (digitalRead(3) == 0)

 {

 key = key - 2;

 delay(50);

 if (key <= 0)

 {

 key = 0;

 }

 sendVision();

 autoComm = 0;

 digitalWrite(13, LOW);

 }

3. Collect desk lamp ambient illumination module

The desk lamp ambient illumination collection module in this desk lamp system is mainly responsible for reading the ambient illumination value of the desk lamp in real time. The main procedures are as .

Wire.beginTransmission(ADDRESS_BH1750FVI); 

 Wire.write(ONE_TIME_H_RESOLUTION_MODE); 

 Wire.endTransmission();

 delay(150);

 Wire.requestFrom(ADDRESS_BH1750FVI, 2); 

 highByte = Wire.read(); 

 lowByte = Wire.read(); 

 sensorOut = (highByte << 8) | lowByte;

 illuminance = sensorOut / 1.2;

4. Automatic control and adjustment of LED light illumination module

When the function is enabled, the brightness change of the LED is adjusted by referring to the light perception (the illumination at the brightest time ).

if (autoComm == 1)

{

if (illuminance > initlightValue +10)

{

key = key - 5;

if (key < 0)

{

key = 0;

}

sendVision();

}

else

{

key = key + 5;

if (key > 255)

{

key = 255;

}

sendVision();

}

}

PS: The source program file will be given in the attachment

10. Summary

For those of us college students who can only participate twice, we are really grateful to win the national award in the first competition. The second time we can only participate in the regional competition. Speaking of our work, it is a work that can lose its temper. Sometimes when we let it do some work, it will follow us and freeze directly. Sometimes it will not, which made us quite panic at that time. Well During the defense of the competition, it was in a very good mood and gave us a set of data that was better . Later, when it heard that our work was in the second grade of National Secondary School, it was extremely excited. Looking back at the electronic competition again, we also made a lot of mistakes. The modules we burned were piled up among the debris. Some modules were not friendly enough for us to use for the first time. The initial state of the boost module was directly 50V output, which we did not expect. Yes, the "meeting" of VCC and GND almost burned my computer port. Inexplicable problems occurred one after another, but fortunately they were all successfully solved. Overall, this is an unprecedented experience for me who likes hands-on operations. I study code writing with my teammates during the game, study the selection of modules together, and study the production of works together... After 4 days and 3 of the e-sports competition The night competition successfully cured my insomnia. If I were to compete again, I would definitely sleep all day after the competition!

 

Video link: https://pan.baidu.com/s/1KqpBIxHd_xCXDt_UbFXrag 

Extraction code: 0803

 

参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-06-23 15:14:55

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

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号