Wifi-based Internet of Things LED color lamp control system
Through the Internet of Things LED color light control system based on STM32F103C8T6 chip, combined with FreeRTOS and MQTT protocols, multi-light collaborative work, precise brightness adjustment and adaptive scene switching are achieved, solving the problems of limited remote operation, high hardware cost, poor compatibility and high energy consumption of traditional LED light control systems, improving user experience and system stability.
Patent Information
- Application Number
- CN202510846170.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-24
- Publication Date
- 2025-09-05
AI Technical Summary
Traditional LED lighting control systems have problems such as limited remote operation, high hardware cost, poor compatibility, high energy consumption, lagging response, and low safety, making it difficult to achieve intelligent and personalized lighting control.
It uses the STM32F103C8T6 chip to be equipped with the FreeRTOS real-time operating system, combines the MQTT protocol to interact with the cloud, connects the WiFi communication module and the LED driver module through the SPI bus, integrates the photosensitive sensor and human infrared sensor, realizes hybrid dimming and adaptive scene algorithms, and supports OTA upgrades and low-power designs.
It realizes collaborative work of multiple lamps, precise brightness adjustment, adaptive scene switching, low-power operation and cross-platform compatibility, improving user experience and system stability.
Smart Images

Figure CN120603103A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of intelligent lighting and Internet of Things, and in particular to a Wi-Fi-based Internet of Things LED colored light control system. Background Art
[0002] Traditional LED lighting control systems suffer from numerous issues. For communication, they rely heavily on Bluetooth or infrared technology. Bluetooth has a control range of approximately 10 meters, while infrared requires line of sight and a control distance of no more than 5 meters, limiting remote operation and making it difficult to use. Regarding compatibility, protocols for devices from different brands are not interoperable, making cross-platform collaboration difficult and increasing the complexity of device management. Furthermore, the static dimming mode results in high system energy consumption. Even at low brightness, lamps still consume significant power and experience high standby power consumption, which is inconsistent with energy conservation and emission reduction trends. Furthermore, the system's limited functionality prevents dynamic lighting adjustments based on the environment and human activity, diminishing the user experience.
[0003] Existing WiFi control solutions also have flaws. On the hardware side, additional gateway devices are required to connect lamps to the internet, increasing hardware costs and deployment difficulties. When networking multiple devices, data transmission and command processing are complex, with command synchronization delays exceeding 200ms. This results in delayed lamp responses and inconsistent operation, making it difficult to meet real-time requirements. Regarding security, some solutions use unencrypted or weakly encrypted data, making them vulnerable to cyberattacks and posing a threat to user privacy and security. Summary of the Invention
[0004] In response to the shortcomings of the existing technology, the present invention provides a WiFi-based Internet of Things LED colored light control system. Through this system, users can control LED colored lights from anywhere with a network connection, achieve collaborative work between multiple lights, reduce system energy consumption, and automatically adjust lighting parameters according to environmental changes, creating an intelligent and personalized lighting environment for users.
[0005] To achieve the above goals, this system consists of the following core modules:
[0006] The main control module includes a microcontroller unit (MCU) and a real-time operating system (RTOS). The MCU uses the STM32F103C8T6 chip, which integrates an ARM Cortex-M3 core and offers excellent performance and a rich set of peripheral resources. Its main frequency can reach 72MHz, enabling rapid processing of various control commands. It also includes 64KB of built-in Flash memory for program code storage and 20KB of SRAM for temporary data storage, providing ample storage space for stable system operation. The RTOS is equipped with FreeRTOS, which supports multi-tasking scheduling and effectively manages various tasks within the system, ensuring real-time response to control commands. For example, while receiving commands from the cloud, it can also promptly process sensor data, ensuring efficient system operation.
[0007] Main control module: The hardware adopts high-performance microcontroller, equipped with FreeRTOS real-time operating system, supporting multi-task scheduling (such as synchronous processing of cloud instructions and sensor data); the interface is connected to the WiFi communication module through SPI bus, and through GPIO / I 2 The C interface connects the LED driving module and the environment sensing module.
[0008] WiFi communication module: The communication protocol is based on the MQTT 3.1.1 protocol to interact with the cloud, and supports JSON format command parsing (such as extracting RGB values or scene modes); (Modification: Supplementary protocol version and data format); scalability supports HTTPS protocol OTA firmware upgrades, and a dual-partition backup mechanism is used to ensure upgrade reliability.
[0009] LED driver module: The core components are the TLC5940NT driver chip (16-channel PWM output, 12-bit resolution) + constant current source circuit (LM317 + 0.1Ω precision resistor, outputting 20mA±2% stable current); the dimming technology is a hybrid PWM dimming and constant current drive to achieve 0.1% precision brightness adjustment and color switching; the protection mechanism is integrated overcurrent protection (BLANK pin emergency shutdown) and a copper-based heat sink (temperature ≤ 60°C).
[0010] Environmental perception module: Light sensor (BH1750FVI) is through I 2 The C interface collects real-time light intensity data from 1-65535 lux (accuracy ±20%) for dynamic adjustment of the PWM duty cycle; the human infrared sensor (HC-SR501) connects the signal to the main control PA0 pin after being shaped by the LM393 comparator, detecting human activity to trigger scene switching or sleep.
[0011] (5) Power management module
[0012] Power supply architecture:
[0013] The 12V DC input is converted to 3.3V by the LM2596-3.3 step-down chip to power the control modules;
[0014] 12V is directly connected to the LED driver module and is reduced to 5V by the internal LDO to power the TLC5940NT;
[0015] Low power consumption design: The main controller controls the power supply of the WiFi module through the PA1 pin. After 10 minutes of no operation, the standby current drops to 5mA.
[0016] IoT Interaction Module: The platform is compatible with third-party platforms such as Alibaba Cloud IoT and Home Assistant through the MQTT protocol, and supports remote command issuance (such as "sleep mode") via mobile apps. Cross-device linkage: After parsing JSON data packets, it can trigger lights to work together with temperature and humidity sensors, security equipment, etc.
[0017] The present invention provides a Wi-Fi-based IoT LED color light control system, which has the following advantages compared with the existing technology:
[0018] 1. Hybrid dimming technology: Combining PWM dimming with constant current drive, through precise algorithms and circuit design, it achieves 0.1% brightness adjustment accuracy, providing users with an extremely delicate light brightness adjustment experience and meeting the precise requirements of light brightness in different scenarios.
[0019] 2. Adaptive scene algorithm: Based on light intensity and human body signals, the system can automatically switch between scenes such as "Reading Mode" and "Sleep Mode". For example, in Reading Mode, the system automatically adjusts the light brightness based on the ambient light intensity to provide the perfect reading light; in Sleep Mode, the light gradually dims to create a comfortable sleeping atmosphere.
[0020] 3. OTA Upgrade Mechanism: This allows for remote system upgrades via HTTP block-by-block firmware downloads. A dual-partition backup mechanism ensures that even if an upgrade fails, rollback to the previous stable version is possible, ensuring system stability and reliability. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 This is the system architecture diagram.
[0022] Figure 2 This is the schematic diagram of the LED driver circuit.
[0023] Figure 3 This is a flowchart for multi-device networking.
[0024] Figure 4 This is a schematic diagram of the mobile phone APP control interface.
[0025] Figure 5 This is the logic diagram of the main control module. DETAILED DESCRIPTION
[0026] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0027] Figures 1 to 5 The core modules of the system and their interaction logic are shown. Figure 1 and Figure 5 In the system architecture, the power management module uses a 12V DC input that is divided into two paths: one path is converted to 3.3V by the LM2596 step-down chip to power the WiFi module (ESP8266-12F) and the environmental sensing module; the other path is directly connected to the LED driver module (TLC5940NT) to provide 12V drive voltage. The WiFi module receives control commands through the SPI bus and communicates with the cloud server via the MQTT protocol. The light sensor (BH1750FVI) in the environmental sensing module is connected to the SPI bus. 2 The C interface and human infrared sensor (HC-SR501) feed environmental data to the control logic unit via GPIO. After the control logic unit analyzes the data, it outputs a PWM signal to the LED driver module, driving the RGB light group to display the target color. Figure 2 The LED driver module is further refined, demonstrating how the PWM signal is converted into a stable current output through a constant current source circuit (LM317), while also integrating an overcurrent protection mechanism; Figure 3 Describes the process of master device broadcasting network request, dynamic IP allocation and timestamp synchronization when multiple devices are networked, ensuring that the instruction synchronization error is less than 30ms; Figure 4 User operations are mapped through the mobile phone APP interface, and the color wheel color picking area and scene mode instructions are sent to the main control via the cloud, ultimately realizing lighting control.
[0028] Working principle: The system realizes intelligent dimming through the collaboration of multiple modules. The environmental perception module collects light intensity and human activity signals in real time, and after processing by the control logic unit, dynamically adjusts the PWM duty cycle (such as automatically increasing the brightness when the light intensity is lower than 100 lux). The WiFi module is responsible for interacting with the cloud and mobile phone APP. The scene mode selected by the user (such as "cinema mode") is transmitted to the control logic through the encrypted MQTT protocol to trigger the preset lighting parameters. The LED driver module converts the PWM signal into a high-precision constant current output, combined with the self-recovery fuse and TVS diode protection circuit to ensure the stable operation of the RGB lamp group. In multi-device scenarios ( Figure 3), the master device broadcasts synchronization commands via UDP, utilizing a timestamp mechanism to coordinate multiple lighting effects and avoid visual delays. The power management module uses dynamic sleep technology (e.g., shutting off Wi-Fi power after 10 minutes of inactivity) to reduce standby power consumption to below 0.5W. The entire system utilizes a modular design and adaptive algorithms to achieve low power consumption, high reliability, and cross-platform compatibility for intelligent lighting control.
[0029] Specific implementation one: The smart home system realizes intelligent dimming through the collaboration of multiple modules. The environmental perception module collects light intensity and human activity signals in real time, and after processing by the control logic unit, dynamically adjusts the PWM duty cycle (such as automatically increasing the brightness when the light intensity is lower than 100 lux). The WiFi module is responsible for interacting with the cloud and mobile phone APP. The scene mode selected by the user (such as "cinema mode") is transmitted to the control logic through the encrypted MQTT protocol to trigger the preset lighting parameters. The LED driver module converts the PWM signal into a high-precision constant current output, combined with the self-recovery fuse and TVS diode protection circuit to ensure the stable operation of the RGB lamp group. In multi-device scenarios ( Figure 3 ), the master device broadcasts synchronization instructions via UDP and uses a timestamp mechanism to coordinate multiple lighting effects to avoid visual delays. The power management module reduces standby power consumption to below 0.5W through dynamic sleep technology (such as turning off WiFi power after 10 minutes of inactivity). The entire system achieves low power consumption, high reliability, and cross-platform compatible intelligent lighting control through modular design and adaptive algorithms.
[0030] When applied to a living room lighting scenario, this system connects to a home router via a WiFi module (ESP8266-12F). After the user selects "Cinema Mode" using a mobile app, the cloud server sends a command to the main control module (STM32F103) via the MQTT protocol. After parsing the command, the main control module outputs a PWM signal (30% duty cycle, 1kHz frequency) to the LED driver module (TLC5940NT), driving the RGB light array to a dim blue (R:0, G:0, B:153). Simultaneously, the ambient sensing module (BH1750) automatically increases the brightness to a 40% duty cycle when the ambient light intensity drops below 50 lux. If the human infrared sensor (HC-SR501) detects no activity for 10 consecutive minutes, the main control shuts off the WiFi module via the PA1 pin, and the system enters low-power mode (standby current 5mA). This embodiment implements adaptive dimming and energy-saving control, reducing power consumption by 35% compared to traditional systems.
[0031] Specific implementation 2: dynamic lighting of commercial stores
[0032] When this system is deployed in a clothing store's display area, multiple groups of LED colored lights form a self-organized network via power line carrier communication (PLC). After receiving the "promotion mode" command from the cloud, the master device synchronously controls all lamps to cycle between red and gold (RGB values are 255, 0, 0 and 255, 215, 0, respectively) at a 0.5Hz frequency. The environmental sensing module monitors the store's light intensity in real time. When natural light exceeds 300 lux, it automatically reduces the LED brightness to a 70% duty cycle to prevent overexposure. If a lamp's driver module (TLC5940) detects an abnormal current (exceeding 22mA), it immediately triggers the BLANK pin for emergency shutdown and sends a fault code to the master control via the SPI interface. This implementation demonstrates multi-device collaboration and safety protection mechanisms, with network synchronization error less than 30ms.
[0033] Specific implementation three: Intelligent lighting for industrial warehouses
[0034] In large warehouses, this system is linked to temperature and humidity sensors. When the IoT interaction module receives a "night patrol" command from the Alibaba Cloud IoT platform, the main control module initiates the following process: 1) Outputs a PWM signal (80% duty cycle) through the PB8-PB10 pins, illuminating a high-brightness white light (RGB: 255, 255, 255); 2) After the human infrared sensor detects movement, the lights automatically turn on group by group in the direction of movement; 3) Lights in inactive areas enter sleep mode (0% duty cycle). The power management module (LM2596) provides a stable 3.3V output voltage in an environment of -20°C to 60°C, ensuring the normal operation of the WiFi module. This embodiment verifies the reliability of the system in extreme environments, reducing average power consumption by 42% compared to traditional solutions.
[0035] Example 4: Smart Home Scenario Application
[0036] When this system is applied to the home living room lighting scene, the steps for each module to work together are as follows:
[0037] System initialization:
[0038] The main control module (STM32F103) establishes a connection with the WiFi module (ESP8266-12F) through the SPI bus (20 MHz clock, 8-bit MSB first). The WiFi module is connected to the home router and subscribes to the Alibaba Cloud IoT platform topic " / device / 001 / control".
[0039] In the environmental perception module, the BH1750FVI photosensor collects ambient light intensity (initial value is 200 lux) at 100ms intervals through the I2C interface (PB10-SCL, PB11-SDA), and the HC-SR501 human infrared sensor monitors human activity in real time through the PA0 pin.
[0040] The power management module converts the 12V input into 3.3V through the LM2596 step-down circuit to power the main control, WiFi, and sensors. The LED driver module is directly connected to the 12V power supply. The initial standby power consumption of the system is greater than 0.5W.
[0041] Command reception and dimming control:
[0042] When users select "Cinema Mode" through the mobile app, the cloud sends the command in JSON format (with the content "{mode:cinema}") to the WiFi module via the MQTT protocol. The WiFi module parses the command using the AES-128 encryption algorithm and transmits it to the main control module.
[0043] After interpreting the command, the controller outputs a PWM signal (30% duty cycle, 1kHz frequency) to the TLC5940NT via pins PB8-PB7, driving the RGB light cluster to a dim blue (R:0, G:0, B:153). Simultaneously, the BH1750FVI detects that the light intensity has dropped to 50 lux, and the controller automatically increases the PWM duty cycle to 40% to adjust to the ambient light.
[0044] Low power management:
[0045] If the HC-SR501 detects no human activity for 10 consecutive minutes, the controller pulls the PA1 pin low to cut off power to the WiFi module, reducing the system's standby current to 5mA and power consumption to ≤0.5W. When the user returns to the living room, the human infrared sensor triggers a signal, causing the WiFi module to reawaken and connect to the cloud.
[0046] Technical effects:
[0047] In this embodiment, hybrid dimming technology (PWM + constant current drive) achieves 0.1% brightness adjustment accuracy, dynamic sleep technology reduces power consumption by 35% compared with traditional systems, and the multi-device network synchronization error is less than 30ms (if expanded to multiple lamps).
[0048] Example 5: Dynamic lighting of commercial stores
[0049] When deploying this system in the display area of a clothing store, the workflow is as follows:
[0050] Multi-device network synchronization:
[0051] The master device initiates a networking request via UDP broadcast. After the slave devices (each group of LED lights) respond, the master device dynamically assigns an IP address. The master device synchronizes commands using a timestamp mechanism, ensuring that the time difference in receiving the "promotion mode" command for all lights is less than 30ms.
[0052] Scene-based lighting control:
[0053] After the cloud sends the "promotion mode" command, the main control module transmits PWM signals to all TLC5940NT driver chips through the SPI bus, causing the lamps to cycle between red (R:255, G:0, B:0) and gold (R:255, G:215, B:0) at a frequency of 0.5Hz.
[0054] The BH1750FVI monitors natural light in real time. When the light intensity exceeds 300 lux, the main controller automatically adjusts the PWM duty cycle to 70% to avoid overexposure.
[0055] Fault protection mechanism:
[0056] If a lamp driver module detects a current exceeding 22mA (e.g., an LED short circuit), the BLANK pin of the TLC5940NT immediately shuts down the output and simultaneously feeds back a fault code "E01" to the main controller via the SPI interface. The main controller then reports the fault information to the cloud and triggers an audible and visual alarm.
[0057] Technical effects:
[0058] Power line communication (PLC) self-organizing networking reduces hardware deployment costs, constant current source accuracy (±1%) ensures extended lamp life, and overcurrent protection mechanism improves system safety.
[0059] Example 6: Intelligent Lighting for Industrial Warehouses
[0060] In the nighttime inspection scenario of a large warehouse, the system works as follows:
[0061] Command triggering and linkage control:
[0062] After the IoT interaction module receives the "night inspection" command from the Alibaba Cloud IoT platform, the main control module outputs a PWM signal with an 80% duty cycle through the PB8-PB10 pins, driving the LED light group to emit high-brightness white light (R: 255, G: 255, B: 255).
[0063] When the HC-SR501 detects the movement of the patrol personnel, the main control turns on the lights in groups according to the movement direction (5 seconds between each group), and the lights in the area where no activity is detected enter the sleep state (PWM duty cycle 0%).
[0064] Adaptability to extreme environments:
[0065] The power management module (LM2596) stably outputs 3.3V voltage within the temperature range of -20℃ to 60℃, ensuring normal communication of the WiFi module in an industrial environment.
[0066] The system's average power consumption is 42% lower than traditional solutions, meeting the warehouse's 24-hour low-energy operation requirements.
[0067] Technical effects:
[0068] The adaptive scene algorithm (light intensity + human body dual trigger) reduces invalid lighting, and the OTA upgrade mechanism (HTTPS protocol + dual partition backup) supports remote firmware updates without the need for on-site maintenance.
[0069] While embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions, and variations may be made to these embodiments without departing from the principles and spirit of the invention, and that the scope of the invention is defined by the appended claims and their equivalents.
Claims
1. A WiFi-based IoT LED color light control system, characterized in that: It includes the main control module, WiFi communication module, LED driver module, environmental perception module, power management module and IoT interaction module. Each module works through the following connection relationships and collaborative logic: The main control module is connected to the WiFi communication module via an SPI bus for transmitting encrypted MQTT protocol instructions and control logic data; The main control module and the LED driver module input serial data, shift clock and latch signal to the driver chip through the GPIO pin, and the driver chip outputs a stable current to the RGB LED lamp group through a constant current source; The main control module and the environment perception module use a light sensor to 2 The C interface transmits light intensity data; The output signal of the human infrared sensor is shaped by the comparator and then connected to the pin of the main control module to trigger scene switching or low power consumption mode; The power management module and other modules convert the DC input into working voltage through the step-down chip, and dynamically control the power supply of the WiFi communication module through the pins of the main control module; The power supply is directly connected to the power supply pin of the LED driver module and supplies power to the driver chip through internal voltage reduction; The IoT interaction module is connected to the cloud and a third-party platform via the MQTT protocol, and user instructions are transmitted to the main control module via encrypted data packets.
2. The system according to claim 1, wherein: The workflow of the WiFi communication module includes: The encrypted data is exchanged with the main control module through the SPI interface to parse the instructions sent by the cloud.
3. The system according to claim 1, wherein: The LED driver module includes: The driver chip analyzes the PWM signal output by the main control module through the internal PWM controller; The constant current source circuit integrates an overcurrent protection mechanism, which shuts down the output and feedbacks a fault code when the current is abnormal; Hybrid dimming technology combines PWM dimming and constant current drive to achieve high-precision brightness adjustment and color switching.
4. The system according to claim 1, wherein: The working logic of the environment perception module includes: The light sensor collects light intensity data at fixed intervals and uses I 2 C interface to the main control module; The human infrared sensor detection signal is shaped and then triggers the main control module pin, and sends a sleep signal when there is no human activity.
5. The system according to claim 1, wherein: The power management module includes: The step-down chip converts the input voltage into an operating voltage to power the main control module, the WiFi communication module and the sensor; Dynamic sleep technology controls the power supply of the WiFi communication module through the pins of the main control module to reduce standby power consumption; The output voltage is stable under a wide temperature environment, and the direct connection power supply of the LED driver module is supported.
6. The system according to claim 1, wherein: The main control module is equipped with a real-time operating system, communicates with the WiFi communication module via an SPI bus, and supports multi-tasking scheduling to process cloud instructions and sensor data.
7. The system according to claim 1, wherein: The multi-device networking coordination mechanism includes: The master device initiates a networking request through broadcasting, and the slave device dynamically allocates an IP address after responding; Synchronize instructions based on the timestamp mechanism to ensure that the dimming synchronization error of multiple devices is within the allowable range; Supports self-organizing networks and is suitable for complex scenarios.