hy349Uy4

Smart night light human presence sensor ESP32

 
Overview
This project
utilizes sensors to achieve automatic light switching . Key features include : Intelligent Human Detection: Utilizing millimeter-wave radar technology, it detects surrounding human activity, optimizing energy use intelligently. Ambient Light Detection: An ambient light sensor automatically detects ambient light intensity and adjusts the nightlight's brightness based on whether it's nighttime or dimly lit. Vibration Sensing: A vibration sensor detects if the nightlight has been manually picked up or moved, adding a manual switching option. Comprehensive Intelligent Judgment: The system automatically decides whether to turn on the light based on a comprehensive analysis of whether someone is present, whether the light has been picked up, and ambient light conditions. Dimming and Color Adjustment: Users can freely adjust the nightlight's brightness and color. Mini-Program Control: Seamlessly connects to a mini-program via the MQTT protocol. Magnetic Base Design: The lamp head connects via a magnetic base, allowing users to easily adjust the lighting angle as needed. Optimized Optical Design: A light diffuser plate conceals the LED chips. Rendering and Physical Image Production Process (Part 1) Material Preparation PCB Board PCB1 Main Body Note: Choose white solder mask, less than 10x10cm, can be obtained from JLCPCB. Figure 10: Main PCB PCB2 Serial Port Debugging Board Less than 10x10cm, can be obtained from JLCPCB. Electronic Components See BOM, all available on JLCPCB. Light Diffuser Board from JLCPCB. Panel Customization 3D Printed Shell from JLCPCB. 3D Printed CNC Steel Plate Made of 45# Steel, can be attracted by magnets, used to make a steplessly adjustable magnetic base. Millimeter Wave Radar Module Model HLK-LD2420 Battery 18650 Battery ph2.0 Interface Screws and Nuts M2 * 12 Magnets (II) Creating a Bafa Account Log in to the Bafa official website and register an account. Create a theme in the MQTT device cloud. The theme name must end with 002. (III) Software Burning Connect the computer to the motherboard using the serial port debugging board. Use the ESP official flash download tool to burn the micropython firmware . Unzip the software.zip file and fill in your own Wi-Fi name, Wi-Fi password, Bafa key, and theme by modifying the code (or by filling in the Bafa configuration applet). Software.zip file directory: ├── boot.py # Empty ├── config.py # Initial configuration file (you must fill in your own Wi-Fi and key in this file, or fill in the Bafa configuration applet) ├── hardware.py # Hardware code ├── link.py # Network connection code ├── main2.py # Main program entry point (rename main2 to main after debugging) Fill in the private key as client_id Fill in the theme name as my_topic Fill in the Wi-Fi name as wifi_name Enter the Wi-Fi password as wifi_password. Use Thonny to upload each file to ESP32. (IV) Create a WeChat Mini Program. Download the WeChat Developer Tools. Modify the functions and interface based on the Mini Program example provided by Baffa. For details, please refer to Baffa's official "Access Documentation" and Mini Program Example. Supplementary Component Selection : Millimeter Wave Radar Types : Number of Targets: Non-multi-target, Multi-target ; Power Consumption: Low Power Consumption, Normal Power Consumption (High Performance); Frequency: 5.8G, 10G, 24G, 60G. Advantages and Disadvantages: It can detect stationary people, but may misjudge people due to electric fans or wind blowing. HLK-LD2420 is a high-performance 24GHz radar module with one transmit and one receive antenna from Hailing Technology, which can accurately sense moving, micro-movement, and standing human bodies. Hailink provides debugging software via serial port debugging, or you can write your own program according to the protocol. Debugging interface diagram: Protocol document. High level on the IO pin indicates someone is present, low level indicates no one is present. Infrared pyroelectric sensor types: Direct digital signal output type, analog signal output type (requires additional amplification/analog-to-digital conversion chip). Advantages and disadvantages: It will not be misjudged by slight movement of objects, but it cannot detect stationary people. XYC-PIR223D-S0 DC-DC power supply : Considering the large current of multiple LEDs and the need for low power consumption, an LDO is not used; instead, a DC-DC TLV62569 is used . Input voltage range: 2.5V to 5.5V, adjustable output voltage: 0.6V. The TP4056X battery management chip , with a maximum output current of 2A, is used for single-cell lithium-ion batteries. It features a constant current/constant voltage linear charger with reverse polarity protection and a maximum charging current of 1A. Schematic and PCB layout diagrams are provided. According to the datasheet, each LED channel uses a separate resistor: green and blue are connected to 15 ohms, and red to 68 ohms. [Image: LED datasheet] PCB layout diagram : Through-holes are required under the LEDs for heat dissipation. [Image: PCB layout of the LED area] DC-DC feedback lines should avoid interference. [Image: PCB layout of the DC-DC converter] Software development: ESP32 software using Thonny development. [Image: Development environment: Thonny] 3D shell design using Fusion360 development. [Image: Fusion360 design interface] Areas for improvement : A thicker light diffuser board might yield better results, but this would require modification of the 3D shell file.































































































































































































Using LEDs with built-in control chips can significantly simplify the peripheral circuitry.
A microphone circuit is pre-installed on the PCB, which can add speech recognition functionality, but requires ESP-IDF development, making the software more complex.
It is recommended to replace the HLK-LD2420 with the HLK-LD2410s, which has lower power consumption and easier debugging software.
Infrared pyroelectric sensors require Fresnel lenses; however, due to the unattractive design of standard Fresnel lenses and the high cost of custom ones, the infrared pyroelectric sensor was ultimately abandoned.
参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2026-03-27 13:17:25

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号