When I saw the call for eSports competitions, I quickly signed up because the course design was relatively smooth, so I started this project immediately. Although I was pressed for time, I started working on this project seriously. This topic is the 2021 national competition question for higher vocational students. There are certain indicators in the competition questions that many people use photosensitive solutions. My first reaction at that time was to use photosensitive to complete various indicators, but later I wanted to use light sensors. If someone wants to do it together after open source, wouldn't they also be able to use sensors? , which discourages many people who want to do it. Here I put forward a requirement to my teammates who write programs. This question is all written in keil. I hope that most people can follow along and complete various indicators. At that time, I My teammates were a little reluctant, but they were still convinced by me. Anyone who is interested in this work can follow me. I have made all the technical details and source code open source. I have no experience in open source for the first time. I hope you can give me some advice if I have any shortcomings. Learn from each other. I would also like to thank Jialichuang for proofing. I placed the order the afternoon before and arrived on time the next night, so that my work could be completed smoothly and quickly.
I mainly studied with the teacher in the microelectronics technician class, and I have rich practical learning. I have done many project designs with my classmates, such as detectors, AD conversion, audio amplifiers, etc.
Captain: Cui Zhifeng
Team members: Lu Guangxin Qi Bin
Instructor: Xu Liange Yang Yiman
Liaoning Mechanical and Electrical Vocational and Technical College "Microelectronics Excellent Technician Class"
The technician class is a professional tutoring training class for microelectronics. Mainly researching circuit electronics, instruments, hairspring balance gears, switching power supply inverters, etc., won the second prize in the country in this competition .
Design and produce an LED desk lamp with stable and adjustable illumination and a digital display illumination meter. The dimming desk lamp is composed of an LED light panel and an illumination detection and adjustment circuit.
1. basic requirements
(1) The digital display illuminance meter is powered by a battery. The relative illuminance digital display is no less than 3 and a half digits and does not require illumination calibration. The detection head of the digital display illuminance meter is placed 0.5 meters directly below the dimming desk lamp. Adjust the brightness of the desk lamp. When the maximum illumination is reached, the display number is greater than 1000; when the detection head is blocked and reaches the minimum illumination, the display number is less than 100. When the brightness of the desk lamp changes continuously, the digital display also changes continuously. When the brightness is stable, the digital display is stable and the jump is no more than 10. There cannot be any exchange of information between the digital display illuminance meter and the dimming desk lamp.
(2) Dimming table lamp input voltage Vi: DC 10V ~ 15V, changes in Vi do not affect the brightness.
(3) The brightness is continuously adjustable from the brightest to completely extinguished, without flickering (the LED light panel power supply voltage ripple is less than 5%). (4) When the power supply voltage of the desk lamp 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%.
2. play part
(1) Adjust the desk lamp to the maximum brightness, and place a piece of A4 white paper 0.5 meters below it. The brightness of the entire area of the white paper is required to be uniform and stable, and the illumination difference at each point is less than 5%. There can be multiple illumination detection heads of the desk lamp, located at any position other than the A4 paper.
(2) Use another LED light panel adjusted to maximum brightness as the environmental interference light source for testing, and change the distance to achieve changes in interference light intensity. When the ambient light changes slowly, the duration of the weakest and strongest changes is not less than 10 seconds. The desk lamp can automatically track the changes in ambient light and adjust the brightness to keep the illumination change in the center of the paper no more than 5%; when the ambient light suddenly changes, the duration of the weakest and strongest changes is not less than 10 seconds. The change duration is no more than 2 seconds, and the sudden change in illumination in the center of the paper is no more than 10%. When the ambient light increases until the desk lamp goes out, the illumination change in the center of the paper is no more than 10%.
After reading the above requirements, I have a basic understanding of the topic. Stable illumination adjustable LED desk lamp device. I was not sure about this question at first, but with the help of my teacher and teammates, I finally overcame the difficulties and made up my mind to do this question well. Before noon, we confirmed the question, and then We kept doing tests. At the beginning, we tried to lay out LED light tubes on the reflector of the desk lamp , and then used a homemade handheld illuminance meter to collect the uniformity and intensity of the light . We found that the light was uneven, strong in the middle and weak around the edges. On the first day, we had not completed other mechanical structures. After constantly trying other solutions, we made a model and finally found that the best lighting was in the form of " 8 " around the reflector of the desk lamp . After that, I used this to debug some small programs. I had a preliminary understanding of the question and a certain thinking, and I firmly believed in the confidence to do it well.
It was finally determined that the LED desk lamp with stable and adjustable illumination is composed of a single-chip microcomputer control system, an LED lamp drive circuit, an illumination adjustment circuit, an illumination sensor and an LCD1602 liquid crystal display. It can automatically adjust the illumination intensity by sensing light, stabilize the lighting function, and apply hardware adjustment. And the microcontroller software algorithm eliminates environmental photoelectric interference, and adaptively adjusts the illumination according to changes in ambient light, making the desk lamp lighting stable. The system block diagram is shown below.
5. Theoretical analysis and calculation
The control principle of the LED desk lamp with stable and adjustable illumination is to use a self-made digital illumination sensor to sense the illumination of the environment, convert it into a digital quantity, input it to the microcontroller through IIC communication, and perform PI calculation together with the set illumination . The calculation result is used to adjust the PWM output occupancy. The air ratio changes the power supply current of the LED , changes the brightness, and realizes the function of automatically stabilizing the brightness.
PI控制过程说明: r(t)为给定照度值,y(t)是通过数字照度传感器检测的LED台灯照度值,两值相减得到偏差信号值e(t),该值通过自适应PI调节器进行PI运算后输出值为u(t),该信号为时间占空比信号,使LED台灯照度稳定可调。即当偏差e(t)≠0时,通过自适应PI调节器进行PI运算,根据该值大小,控制电流变化。为了使控制稳定,当偏差|e(t)|≤7时,增加死区控制,此时的PI控制输出u(t)为0 。通过工程整定法确定比例系数和积分系数,通过这样不断的调节控制,使LED台灯照度达到稳定。
6.各原理图电路分析
PWM可控电流源是结合开关电源芯片、单片机PWM功能和软件程序设定调光策略,使LED驱动电路可以动态调节。PWM可控电流源设计采用德州仪器开关电源驱动芯片TPS5433,该芯片工作频率可达2.7MHz,工作电流仅为110uA。该设计具有高效率,低功耗的优点。PWM可控电流源电路如图4所示。
采用LCD1602作为液晶显示器,可显示2×16字符,它的特点是体积小、重量轻、功耗低、显示质量高和无电磁辐,且接口采用数字式,与单片机之间的连接简单方便。系统设计始终将节能环保放在首要位置,故选择LCD1602液晶显示器。在手持的数字显示照度表和照度控制系统中均采用LCD1602作为显示器件。LCD1602液晶显示如图5所示。
数字照度传感器通过IIC接口与单片机连接,利用IIC通讯协议实时读取环境光线照度并通过液晶显示器件LCD1602显示,显示数值范围0~65535lux,本装置采用三节1.5V干电池供电。数字显示照度表的硬件电路图如图6所示。
看到之前学哥的经验总结,我们也发现电源电路pcb布线非常关键,要关注大功率下正常运转和做好电源与控制器的隔离,我在设计pcb的时候特别注意这些问题。
首先是电源电路的大电流回路必须要粗并且互相不会感染这里我用立创的时候用到描绘形状的功能,并且让大电流回路导线开窗处理,为后续覆铜。因为时间和成本问题,只有一部分的板子是工业制版,大部分的板子都是手工按图接制的,大功率电源电路一般不覆铜,但是为了防止EMI干扰,在信号控制区域采用覆铜处理并且做好隔离采用边框裁切来隔离高压和信号。
为了方便灯管电压,电流的读取,我们在板子上焊接出线,直接用万用表读取。同时为了去除干扰等不良因素还运用放大电路进行了过度。制板时过于粗糙,但使用正常。
9.程序设计
主要由照度采样程序、PI调节器程序、PWM控制程序组成。
PI运算程序
err = lum -gd; //给定值
if((err <7)&&(err > -7))err=0; //死区控制
err /=2.0f; //积分常数
kp = err * 0.1f; //比例系数
pi = pi + kp +err; //积分运算
if(pi<100.0f) pi=100.0f; //下限幅9.0%
if(pi>1100.0f) pi =1100.0f; //上限幅99.45%
4.2 PWM控制占空比程序如下:
Void UpdatePwm(u16 pwm_value_DC,u16 pwm_value_f)
{
P_SW2 |= 0x80;
PWMB_CCR5H = (u8)(pwm_value_DC >> 8); //设置占空比时间
PWMB_CCR5L = (u8)(pwm_value_DC);
PWMB_ARRH = (u8)(pwm_value_f >> 8); //设置周期时间
PWMB_ARRL = (u8)(pwm_value_f);
程序框图如下图所示
Finally, the LED desk lamp device with stable and adjustable illumination was successfully produced. It has the functions of independently detecting the illumination, controlling the output current of the LED drive circuit through PI adjustment and PWM duty cycle modulation , making the LED desk lamp illumination adjustable and stable. The data of each task was collected and processed, and all test tasks were completed excellently. A handheld digital display illuminance meter was also made to test the lighting. After experimental testing, it was found that the LED desk lamp device with stable and adjustable illumination has the advantages of high efficiency, low power consumption, and simple operation.
After this competition , we are familiar with this competition and understand that the production process of a product is not easy. It requires its own design and technical support and team cooperation in order to exert its greatest strength . Psychological quality is also very important. When encountering problems We learned to respond calmly and not to escape . Then we learned a lot and gained a lot of knowledge , including the manufacturing principles of various sensors and desk lamps. Although there are some shortcomings in the production process of the production device , it should still be very . After this competition, the teacher’s suggestions made me remember the importance of debugging programs, strengthen the study of corresponding basic knowledge, and learn more about modules and basic circuits. We have put in our best efforts to train ourselves, understand our own abilities, and feel that we still have shortcomings. Next, we will continue to work hard and study seriously. There is a long road ahead. We will not stop and will work harder to move forward .
Video link extraction code: 1111 Link: https://pan.baidu.com/s/1nWSkzSeDMy2c2_f6YB03YA
All reference designs on this site are sourced from major semiconductor manufacturers or collected online for learning and research. The copyright belongs to the semiconductor manufacturer or the original author. If you believe that the reference design of this site infringes upon your relevant rights and interests, please send us a rights notice. As a neutral platform service provider, we will take measures to delete the relevant content in accordance with relevant laws after receiving the relevant notice from the rights holder. Please send relevant notifications to email: bbs_service@eeworld.com.cn.
It is your responsibility to test the circuit yourself and determine its suitability for you. EEWorld will not be liable for direct, indirect, special, incidental, consequential or punitive damages arising from any cause or anything connected to any reference design used.
Supported by EEWorld Datasheet