“In the intelligent transformation of street lights, the smallest unit of smart cities, low-cost and easy-to-deploy solutions are key to implementation. This article is based on the BearPi-HM-Nano development board and the E53-SC1 smart street light expansion board, constructing a standalone smart street light prototype that covers core functions such as environmental sensing, dynamic dimming, and fault reporting, providing beginners with a quickly reproducible IoT practical case.”
01
—
1. Minimal Hardware Configuration: A Complete Solution with One Board and One Expansion1. Core Hardware (1) BearPi-HM-Nano Development Board A development board exclusive to the HarmonyOS ecosystem, equipped with a Hi3861 WiFi SoC chip (160MHz main frequency / 2MB Flash), providing rich GPIO and PWM interfaces to meet the basic computing needs for street light control. (2) Smart Street Light Expansion Board (E53 Interface Standard) 1. Plug-in design, integrating a photoresistor: real-time monitoring of ambient light intensity, a passive infrared sensor (PIR): detecting human movement within 5 meters, high-brightness LED beads: supporting PWM dimming, status indicator: fault alarm and operational status visualization. 2. Cost advantage: total cost < 200 yuan, far lower than commercial smart street light modules. 3. No wiring power supply: Type-C interface directly connects to a mobile power source for operation.
02
—
2. Core Functionality Implementation of a Single Node
Scene Logic: During the day when there is sufficient light, the LED automatically turns off; at night, when no one passes by, it maintains 20% brightness for energy saving; when the PIR detects a pedestrian, it gradually brightens to 100% within 3 seconds, and after a delay of 30 seconds, it returns to low power mode.
Key Code
void main() { while(1) { int light = readLight(); // Read light value int motion = readPIR(); // Detect human movement if (light > DAY_THRES) { // Day mode setLED(0); // Turn off light } else { // Night mode if (motion == DETECTED) { // Someone passed fadeLED(100, 3000); // Gradually brighten to 100% in 3 seconds delay(30000); // Maintain for 30 seconds } else { setLED(20); // 20% brightness when no one is around } } checkFault(); // Fault self-check } }
03
—
Quick Integration with Huawei Cloud IoT Platform
Steps to Go Online in Ten Minutes
1. Create Product: Define the “Smart Street Light” product in Huawei Cloud IoTDA, adding attributes such as “Brightness” and “Fault Code”.2. Generate MQTT Tuple: Use device ID/key to generate connection parameters (the code library has encapsulated the connection function).3. Data Reporting: The development board uploads light/brightness/fault status via WiFi at regular intervals:
// Example: Report brightness value
char msg[50];sprintf(msg, "{\"brightness\":%d}", getLED());MqttPublish("$oc/devices/XXX/properties", msg);
4. Cloud Control: Issue commands in the IoTDA console to remotely adjust LED brightness or restart the device.
04
—
Teaching Reproduction Guide
Experimental Steps:
1. Hardware Connection: Plug the expansion board into the E53 interface of the development board (anti-reverse connection design).
2. Environment Setup: Use DevEco Device Tool to flash the HarmonyOS (including pre-installed drivers).
3. Business Logic Development: Modify the threshold and delay parameters in light_control.c (complete code attached).
4. Cloud Verification: Log in to Huawei Cloud to view real-time data streams (new users enjoy free quotas).Tip: The passive infrared sensor should avoid direct sunlight to prevent false triggering.

05
—
Extended Thoughts
1. Energy Saving Calculation: The dynamic dimming strategy reduces energy consumption by 67% compared to the always-on mode (measured 0.02 kWh over 8 hours).
2. Fault Diagnosis: By detecting current + light feedback, it can identify LED damage or sensor anomalies.
3. Urban-Level Extension: Theoretical expansion: Multiple nodes can be networked via WiFi Mesh (Hi3861 supports 256 nodes), but additional gateway support is required.
06
—
Conclusion
With just one development board and one expansion board, we have achieved a closed loop of core functions for smart street lights and completed cloud integration verification. This minimal configuration is suitable for classroom experiments (cost controllable) and provides municipal departments with a low-risk technical path of “validate before expanding.” Let the starlight of smart cities begin to shine from a single lamp.