他们逼我做卧底

# Fifth Lichuang Electronic Design Competition# Adjustable LED light source

 
Overview

1. Self/team introduction

Hello everyone, I am an electronics enthusiast. I do some of my own whimsical ideas in my spare time. The practicality may not be that strong. I mainly use them for my own debugging and hobbies. I hope everyone can like and support it. During college, I participated in some microcontroller competitions. Although I did not achieve very good results, I also laid a good foundation, which provided a lot of help for my future hobbies. Welcome all electronic enthusiasts to discuss and learn together.

2. Briefly introduce the project

The project I participated in this competition is customized: adjustable brightness LED. The project implements the following functions: i. LED brightness adjustment in different gears (three gears in total); ii. LED is controlled by PWM, and the brightness can be infinitely adjusted in each gear; iii. Lithium battery management; iv. Realization of RGB seven colors Carousel display; v. Implement command software that can be interacted with through SecureCRT, etc.;

3. Describe project details

3.1. Overall overview

**Overall overview**: The STC-based C51 microcontroller realizes stepless adjustment control of LED brightness and RGB color conversion control, and also realizes the management of lithium batteries;         Development environment :                         Code development : Keil C51;                         Language : C language                         code download : STC The official website provides ISP tool                         download method : serial port @115200n81                         dependent library : RTX51-Tiny operating system library, which must be compiled under Keil;                         hardware : main control: STC15 series microcontroller; minimum system configuration: STC15 MAX (35MHz); MOS: AO4803A dual MOS + SI2306 SOT23 lithium battery management: software method + AP5056 charging management

3.2. Hardware functions

** Main control chip **: STC15W408AS, realizes MOS driving of LED and RGB, realizes real-time collection of ADC data, realizes lithium battery management control, and realizes serial port input and output;           LED driver : uses MOS to cooperate with the PWM output of the microcontroller to build a simple switching power supply circuit to achieve buck output, while the ADC is connected to the output voltage of the LED, and negative feedback regulates the output voltage to ensure stable power supply to the LED;           RGB LED driver : implemented through MOS SI2306, and the color output is controlled by the MCU;           power management : consider the possibility It will be powered by lithium batteries, so a lithium battery charging management IC is added, as well as lithium battery voltage detection, whether to enable the charging function, etc.;           operating peripherals : buttons and adjustable resistors (knob type) are provided to achieve fixed mode LED control and modes Modulation;           external interface : There are two external interfaces: one interface is used for external DC 5V@2A external power supply input and code download signal line; the other interface provides lithium battery access and debugging serial port, the lithium battery can be unprotected Board access, the debugging serial port can be directly connected to the PC, and command line interaction can be performed through mainstream debugging tools such as SecureCRT;

3.3. Software functions

System adaptation : The timer of the RTX51-Tiny software uses the TIMER-0 of the MCU for system heartbeat. The heartbeat frequency is configured according to the 35MHz set by the MCU, and the ROM stack, internal Flash space adaptation, and code data location adaptation are etc., add operating system sleep entrance, etc.;         MCU configuration : MCU configuration is realized by directly reading and writing related registers. It is currently adapted to STC’s unique PCA module, ADC module, peripheral pin mapping and other modules to correspond to the current Hardware design;         configuration interrupt : TIMER0 hard interrupt is used for RTX51-Tiny rotation scheduling; serial port input interrupt is used to monitor user input information in real time and send signals to tasks to complete debugging and control;          configuration tasks : initialize the MCU task configuration as 0. The rest such as: ADC data real-time collection, external key scanning and control, user command analysis, system status indication, RGB control, etc. all exist in the form of independent tasks, and each task is implemented by system scheduling; each task is scheduled in turn, and each other can Send a signal to complete. The task function and interaction information are as follows:

Task ID Task function Mission entrance
0 Initialize the MCU submodule registers: PCA's PWM mode, ADC mode and pins, and serial port pin mapping. After the initialization is completed, each task is launched, and finally task 0 exits on its own; Automatic operation after power-on reset
1 System status indicator control, the LED flashing on the back indicates that the system is running normally, and the flashing can be turned on and off in real time through the command line; Pulled up by task 0 after MCU initialization is completed
2 User command line interaction, including command parsing and result echo, can control LED brightness, gear, RGB color, query ADC results, control RGB display order and delay, system light status control, etc. Task execution is triggered in real time through serial port interrupts; Pulled up by task 0 after MCU initialization is completed
3 The main LED's PWM, gear, etc. are controlled according to the button gear adjustment and the rotation of RL to adjust the brightness, thereby controlling the LED. The LED gear position is achieved by the number of lights on, and the LED brightness is adjusted by PWM control of the MOS tube switch; Pulled up by task 0 after MCU initialization is completed
4 RGB light control, wheel display of seven colors, color combination is realized by hexadecimal data, each unsigned char realizes a color combination, that is, RGB combination; Pulled up by task 0 after MCU initialization is completed
5 ADC data real-time collection and lithium battery management. The current system uses a total of 5 ADC channels, including the measurement and record update of system power supply type, main LED power supply voltage, lithium battery voltage, RL adjustment voltage and other voltages; Pulled up by task 0 after MCU initialization is completed

4. Describe the challenges faced by the project and the problems solved

Problems faced and solved

Hardware

1. MOS driver implements a simple switching power supply: The pin output capability of STC theoretically meets the G requirement of MOS, but in practice it does not meet it. Later, when debugging the hardware, it was discovered that the LED strobes after PWM output, especially at low brightness, which increases the serial The inductor will be solved later; 2. RGB drive: The required current is smaller than in theory, and the RGB of the first version of the circuit designed and implemented is easy to burn; 3. The MOS selected for RGB is easy to burn at high temperatures during welding, and the welding time is wasted; 4. External DC When the power supply and battery power are switched, the MCU is prone to flash reset: caused by unstable power supply of the processor, so increase the capacitor to solve the problem; 5. Occurs when stabilizing the MCU power supply: When using tantalum capacitors, the capacitor welding temperature is too high and the circuit will break, and the entire board will break. When powering on the test circuit board, no components were hot. After removing the capacitors, it was found that the MCU power supply was short-circuited;

Software

1. RTX51-Tiny: adapted to STC and running; 2. PWM debugging: due to insufficient output current of the PWM pin, software and hardware debugging took a long time; 3. Command line implementation: due to the need to interact with the Shell tool, the serial port received The data may be a bit too much, and the buttons need to be processed. It takes a long time to debug to achieve Linux-like effects; 4. Command line commands are parsed and executed: there is no mailbox message queue and other mechanisms between tasks under RTX51-Tiny, so special methods are needed. Realize data transmission and interaction. After the command is passed, some can write registers directly, and some need to interact with tasks; 5. ADC, PWM, UART, TIMER, etc. run at the same time and can be controlled individually;

5. Describe the key points involved in the hardware and software parts of the project

Hardware part       pin configuration, MOS driver (including main LED circuit and RGB circuit), software part       RTX51-Tiny configuration, command line software implementation, PWM configuration implementation, ADC configuration implementation;

6. Project material list display

i. PCB: drawn by Lichuang EDA and sampled and made in Jialichuang; ii. BOM raw materials: purchased on Taobao; 1.jpg III. Welding: manual soldering iron, solder, solder paste

7. Project pictures

7.1. If the competition logo picture is printed on the PCB, it will be deemed as giving up the participation.

The 3D simulation PCB pictures of Lichuang EDA are as follows: image.pngimage.pngThe actual PCB pictures are as follows: WeChat picture_20200712002014.jpg

7.2. Other pictures of the project

Pictures of the finished project are as follows: WeChat picture_20200712002159.jpgSecureCRT software joint debugging

Interface picture: Screenshot(21).png

8. Demonstrate your project and record it as a video for uploading

8.1. Video upload contest official website

Currently, "Self-Introduction", "Project Introduction", "Function Demonstration & Performance Test", and "More" have been uploaded to the website and Station B.

8.2. Video title and link at Station B

A. Video name : The 5th Lichuang Electronic Design Competition - Adjustable LED Light Source - Self-introduction, Station B video number : https://www.bilibili.com/video/BV14D4y1U7mS B. Video name : The 5th Lichuang Electronic Design Competition Electronic Design Competition - Adjustable LED Light Source - Project Introduction, Station B video number : https://www.bilibili.com/video/BV1bV411z7gw/ C. Video name : The 5th Lichuang Electronic Design Competition - Adjustable LED Light Source - Function demonstration & performance test, B station video number : https://www.bilibili.com/video/BV1j54y1e7xC/ D. Video name : The 5th Lichuang Electronic Design Competition-Adjustable LED Light Source-More, B station video Number : https://www.bilibili.com/video/BV14v41117XP .

9. Whether it is released to the public for the first time

9.1. Please indicate whether the project has been published or won awards before.

Unpublished and has received no awards .

9.2. If the project is optimized on the original basis, please explain the optimization part

Optimization part : MCU driver for MOS and ADC data acquisition hardware design, software process design and startup process design.

10. Open source documents

There is currently no open source.

11. References

11.1. "STC15 Series Data Manual"; 11.2. "Proficient in Switching Power Supply Design";

Click the link for more details: https://www.szlcsc.com/go/dsxq

参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-06-23 13:01:59

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号