Previous version, https://oshwhub.com/47415Y/rgbww-bu-guang-deng
After several months of mental exhaustion, this time I filled the previous pit.
1) The hardware part
uses STM32F051C8T6 MCU, and I chose it because I had stock on hand.
MCU power supply. Because it uses lithium batteries, considering the voltage drop, a 3.0V LDO with enable is used for power supply, which is convenient for controlling the power supply of the whole machine.
The same circuit as the previous small flashlight.
When SW1 is pressed, EN gets a high level, LDO is turned on, POW-KEY gets a high level, and the MCU detects that it can be turned on, and at the same time controls POW_EN to be self-locked at a high level.
After turning on, SW1 can be used as a normal button. When USB is inserted, VUSB is powered and the power is also turned on.
When shutting down, control POW_EN to a low level to completely turn off the power.
24C02 simply records the setting data and battery data.
Simple buttons and drive piezoelectric ceramic buzzers.
The reference voltage is 1.25V, which is related to voltage and temperature acquisition. AD-T1 is the NTC temperature on the light board.
A 1.44-inch color screen LCD2 is used, and a universal color screen package LCD1 is also drawn. (1.33-inch 12PIN welding ST7789 240*240 TB common screen).
The LED light board uses 8 strings of LEDs. After repeated considerations, the driver part uses the SGM3732 boost constant current driver. The advantage is that it can be adjusted from a very low brightness.
Because the fill light is used, it must not flash.
For the charging part, IP5306 is used, 2A charging. IP3005 lithium battery protection IC, the maximum current is 7A.
For the current detection part, INA199A1 is used as the small flashlight to detect the battery current. The magnification is 50 times.
The REF of INA199 is connected to the 1.25V reference voltage generated by TL432. When charging, the current VBAT->BAT+ output voltage is 1.25V+(5mR/I)×50.
When discharging, the current BAT+->VBAT output voltage is 1.25V-(5mR/I)×50, so that bidirectional current can be detected. To count the power.
Q1, Q3 back-to-back PMOS can switch the power supply mode (to prevent backflow). When the battery is powered, Q3 is turned on, Q1 is turned off, and the battery is powered to drive the part.
When the USB is inserted, Q1 is turned on, Q3 is turned off, and the USB is directly powered to drive the part.
Fan drive, when the temperature of the light board is too high>50 degrees, the fan is controlled to turn on.
Here, MT3608 is used to boost the voltage required by the fan (4.8V). Due to the characteristics of the BOOST circuit, when EN is low, the voltage from L7 D6 will pass directly, so Q5 is needed to completely turn off the voltage.
PS: The fan can use 4010 or 4020 12V 5V, and the voltage can be adjusted lower to reduce noise.
The light board interface uses a 1.0mm 16PIN PFC cable with sufficient current.
Light board, the light board uses 2835 LED lamp beads.
RGB is 4 parallel and 8 series, single 0.5W. Pay attention to the packaging of the red lamp bead. The positive and negative poles are opposite.
Mall number C2843878, C2843880, C2843879.
Cold white and warm white use high color rendering lamp beads RA95, single 0.2W. 8 series and 8 parallel.
Mall number C516131, C516134.
----------------------------------------------------------------------------------------------
The shell part uses PCB to make the shell.
The panel uses PCB plus the panel printed by Jiali Chuang Group. The bulge button panel just participated in the first batch of public tests, and the effect feels good.
The touch button uses C843636, 6*6*7.5 100gf, which feels just right.
The USB seat uses C2686965 TYPE-C vertical female seat.
The battery socket uses XT30 to meet the current needs.
----------------------------------------------------------------------------------------------
The software
uses STM32CubeMX to generate some initialization codes.
DMA is used for AD conversion, and hardware SPI is used for screen driver.
Two groups of timers and 6 hardware PWMs are used. 5 channels control LEDs, and one channel controls buzzers.
The main program loops and processes AD data, power status management, and screen display.
Buttons, battery power statistics, LED brightness changes, and buzzers are all processed in timer interrupts.
----------------------------------------------------------------------------------------------
Key logic 1) Long press the POWER button to turn on the power, and press and hold the SET button to turn on the power and initialize EEPROM data 2) Long press the POWER button to turn off the power on page 1-2-3 3) Long press the SET button to switch pages 1, RGBWW gear mode 2, free mode 3, flashing, gradient... 4. Detailed gear setting 5. System setting 4) On page 1-2-3, short press the ADD/SUB key to switch the mode, and then short press the SET key to switch the RGBWC setting (the ADD/SUB key increases and decreases the value). 5) On page 4, short press the SET key to move the cursor up and down, short press the POWER key to move the cursor left and right, and the ADD/SUB key to increase and decrease the value. 6) On page 5, short press the SET key to move the cursor up and down and the ADD/SUB key to increase and decrease the value.
----------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------
Finally, thank you for watching and wish you all peace.