Software apps and online services
Hand tools and fabrication machines
For this project, I used.NET nanoFramework + an M5 ATOM LITE + HLK-LD2410B radar to achieve a battery-powered human sensor that triggered an effect on a WLED-controlled custom LED 'Welcome' sign, when people walked up to it at the venue for my wedding reception.End Result:
Why .NET nanoFramework + an M5 ATOM Lite?
Having previous experience tinkering with ESP32-based LED microcontrollers, the M5 ATOM Lite offered a familiar, feature-packed platform based on the ESP32-PICO chip, was cost effecting, and most of all, was a popular choice for development with.NET nanoFramework.
Being new to embedded development, but having a fair bit of experience in C#, I knew I wanted to try stick to C# when creating this project. After some searching,.NET nanoFramework seemed like the obvious choice, offering a familiar.NET environment and syntax, and having a very active and vibrant development community.
Very basic, the HLK-LD2410B radar sensor is connected to the M5 ATOM Lite using some jumper wires. Please forgive me mixing colours :)
The wires are connected as follows:
HLK +'ve -> M5 ATOM Lite +5V
HLK Ground -> M5 ATOM Lite GND
HLK I/O -> M5 ATOM Lite Pin 19
The M5 ATOM Lite power was supplied by a generic USB-C powerbank. I tried the M5 Tailbat (150mAH) but found its capacity was too limited for all-day application.
I did not bother with trying to customise the detection of the radar, as I found its default settings worked very well. It detected human presence/movement in quite a wide cone about 3-4 metres away from it.
The code is all contained in one main class (not including the NeoPixel interfacing), I'm firmly of the belief that when working with a microcontroller that is performing one job, you should be able to get it all into one file.
1. Connect to Wi-Fi
2. Setup user pin input (mainly used for debugging)
3. Start radar polling loop, checking if pin 19 is high (high=human detected)
4. Upon radar state change, send a JSON POST to the static IP of the WLED device that calls the device to run a preset
5. Track current state and return to radar-polling loop
Neopixel for easy debugging - I used colours on the M5 ATOM Lite's Neopixel to give instant user feedback when something happened (Bootup, Wi-Fi connected, Wi-Fi connect failed, Human presence detected, Human presence lost, try/catch error).
Manual polling - The radar sensor was triggering a pin changed event too frequently, so I changed to manual polling every second. This worked well.
Disposing HTTP requests - This is a requirement, to avoid weird bugs/memory issues.