As a human presence
sensor, it should perform its duties quietly and low-key. But this sensor is too unserious. In addition to sensing ambient light (TEMT6000) and presence (HLK-LD2410B), it also uses colorful lights (WS2812B-2020) to show its presence to the world.
The colorful LED under the color ring can statically display a total of 16777216 true colors, and can also dynamically display more than 50 dynamic lighting effects including breathing lights (mode 2), gradient colors (mode 7), and marquees (mode 47).
Disclaimer:
This solution uses 220V AC power. There may be risks of electric shock, high temperature burns, and other possible injuries, disabilities, and deaths during production and use. Please strictly follow the safety regulations and provide adequate protection. Minors should operate with the assistance of a guardian. Using this solution to make it yourself means that you have sufficient knowledge of safety risks. Please make sure that you have sufficient knowledge reserves before operating. Any losses and consequences caused are at your own risk, and I do not bear any legal responsibility.
I am a software enthusiast, not a student of electronic hardware. Therefore, I may not know a lot of basic hardware knowledge. If there is anything wrong with the circuit diagram, I hope you will give me some advice. Thank you.
Hardware Description:
1. The ambient light uses the TEMT6000 sensor, which can output the illuminance value in the range of 0-1024lux.
2. The human presence sensor uses the 24G microwave radar HLK-LD2410B, which is currently a popular radar module. In addition to sensing moving human bodies, it can also sense stationary, micro-moving, sitting and lying human bodies. Although it is found that there are still false alarms in actual use, it is not perfect. But it is much stronger than infrared human body sensing. I feel that it has achieved 95% availability.
3. The colorful light display uses WS2812B-2020. The IC control circuit and the RGB light-emitting unit are integrated in a 2020 package component to form a complete external control pixel point. The three primary colors of each pixel can achieve 256 levels of brightness display, and can complete a total of 16777216 colors of true color display. 4. MCU still uses the common ESP12S (ESP12E, ESP12F compatible).
5. It must be plugged into the plugboard for testing during debugging, please cherish your life.
6. If during the PCB board making process, the manufacturer prompts: the middle milling slot connection is too small, the board will break, etc., please reply: I have known and accepted the risks brought by this reason, please produce directly according to the Gerber file, thank you!
Software Description:
1. The compilation environment is VScode+PlatformIO2. Using the open source MQTT solution, you can get a cloud server with unlimited device quantity and service life without spending a penny.
3. In actual use, it is found that although the public and free MQTT server can be used, the delay is relatively large. If the real-time requirements are relatively high, it is recommended to build a MQTT server on the cloud server or router (recommended software EMQX, free and powerful).
4. Use IoT MQTT Panel_0.45.18_Apkpure.apk on the mobile phone. This APP interface is OK, easy to use, and fully supports JSON, but it has ads. (If you have a more suitable mobile APP, please leave a message in the comment area)
Main functions of the software:
1. Support web page network configuration.
2. Support web page firmware upload. A new upload function has been added to the web page network configuration interface, which can upload and update the firmware and file system. (In case of OTA firmware update error and failure to connect to the network, you can also upload to the web page to save the brick) 3. Support WeChat QR code scanning network configuration (not recommended, not guaranteed to be 100% successful). 4. Support NTP network automatic time synchronization. 5. Support MQTT, which helps to have a more thorough understanding of the working mechanism of the Internet of Things. 6. Support OTA online firmware upgrade, which can be upgraded through the network. 7. Support LittleFS local file system, which can save various parameters when power is off. Even if the power is off and restarted, the original parameters are still there.
8. Support the adjustment of WS2812B light color, brightness and display mode through the mobile phone APP, and independent display. You can also set the WS2812B as the indicator light of the human sensor and link it with the sensor.
9. Supports display of the current ambient light value, ranging from 0-1024, unit lux.
10. Supports human presence sensor to display whether there is someone, human motion energy and human distance.
Related component sources:
1. Sensor housing -> Buy more than 2 at a time on Alibaba
2. AC220V TO DC5V switching power supply module I have bought all the links on the right (note: buy 5V with feet) -> Link 1 Link 2 Link 3

4. ESP-12S module You can buy ESP12E/F/S, all three models are compatible. F is the cheapest and I often buy this, less than 5 yuan and free shipping.
5. I bought the HLK-LD2410B radar module at Youxin Electronics, but later I saw a store -> cheaper. Note that you should buy one without pins, you need to solder extension pins to lengthen the pins yourself.

6. 1.27 extended pin header -> purchase link (note to buy the 14mm pin length), and 1.27 female plug -> purchase link (note to buy 1*5P)
7. WS2812B-2020 -> purchase link
8. In addition to this, I basically bought other components (including TEMT6000, resistors, capacitors, AMS1117, light-emitting diodes LED, etc.) at Youxin Electronics -> Youxin Electronics Taobao Store
9. ESP8266 development test stand/burner (only needed by beginners), I bought this -> purchase link. I found that the burner I bought had problems and could not debug the HLK-LD2410B radar module. Later, I copied the burner from the square and it didn’t work. To be precise, it can provide 5V power supply, but it cannot receive the TX data transmitted from the radar module. After my continuous testing, I found that the radar TX port level is 3.3V, while the RX on the burner is 5V, and the TTL level is incompatible. It works if you plug HLK-LD2410B directly into the PCB this time. The TTL level on the PCB is 3.3V. If this project gets more than 50 likes, I will release another ESP8266 programmer that I modified to debug the HLK-LD2410B radar module.
Cost:
Calculated based on making 2 pieces, including postage, the cost is shared:
1. Sensor housing ¥13.9
2. 24G radar: HLK-LD2410B ¥17.6
3. Switching power supply module: AC220V TO DC5V ¥5.65
4. Colorful LED: WS2812B-2020 ¥6
5. Light sensor: TEMT6000 ¥2.65
6. MCU: ESP12F ¥4.8
7. Female and extended pin headers: 1.27 single-row pin with a total length of 14mm ¥1.93, female header ¥2.80
8. Other resistors, capacitors, AMS1117, etc., counted as ¥29. PCB, JLC wool, free
total: ¥57.33
Software and hardware installation steps:
1. First flash the firmware for ESP12S, refer to: https://oshwhub.com/article/ci-bao-chi-WIFIzhi-neng-cha-zuo-ruan-jian-gong-cheng-dao-ru-VSCODE-yi-ji-bian-yi-shuo-ming
2. Set the MQTT parameters for ESP12S network configuration, refer to: https://oshwhub.com/article/ci-bao-chi-WIFIzhi-neng-cha-zuo-ruan-jian-diao-shi-shuo-ming
3. Install the MQTT APP on your mobile phone and set the MQTT server parameters. Tutorial: https://oshwhub.com/article/bu-zheng-jing-de-ren-zai-zhuan-gan-qi-pei-tao-shou-ji-APPan-zhuang-ji-she-zhi-shuo-ming
4. Solder PCB (***Read the process before soldering***), first put the picture after soldering:

The soldering steps are as follows:

Precautions for soldering the colorful LED:

Precautions for soldering the radar and lighting modules:

5. Test (do not install the shell first, you can't remove it after installing it)

to see if the 8 colorful lights are displayed normally, and whether the lighting and radar modules can feedback data normally.
Only when everything is OK can the shell be installed.
6. Install the shell


(after hardware installation)
Hardware update instructions:
2023/3/15
1. Hardware release: main PCB V0.3 2023-3-14
Software update instructions:
2023/3/15
1. Software release: LD2410B_WS2812B (2023/3/15 20:00)
OTA steps:
1. Compile the firmware in VSCODE

2. Upload the compiled firmware to an HTTP address, which can be a website or your local router. The address is similar to: http://xxxx/data/esp12s.bin After uploading, be sure to open the browser to test it to see if this firmware address can be downloaded normally.
3. Set up the OTA firmware link in the WEB configuration network, which is the URL similar to: http://xxxx/data/esp12s.bin 4. Click Upgrade Firmware in the mobile phone APP During OTA upgrade, the LED will flash quickly with the download progress. It will automatically restart if the upgrade is successful.
Acknowledgements:
Thanks to Jiali Chuang YYDS, I get to make PCBs for you every month.
Thanks to: @xywl98 @unanxtg @shjdxhkxn @liang_work @tjdxryx @jeromeli @tfsuces and other big guys who left comments in the comment area. Because of your opinions and suggestions, I got a lot of inspiration and learned more knowledge.
Thank you very much!