This is a simple motion detect-triggered night light using arduino compatible micro module.
The following is the state machine of this device.
---
title: Motion Night Light State Diagram
---
stateDiagram-v2
state if_light <<choice>>
state if_motion <<choice>>
[*] --> Setup
Setup --> MainLoop
MainLoop --> if_motion
if_motion --> MainLoop: No motion detected
if_motion --> if_light: Motion detected
if_light --> Leds_ON: NO light (it's night)
if_light --> Leds_OFF: Light (it's day)
Leds_ON --> MainLoop
Leds_OFF --> MainLoop
The following diagram is illustrated the electronic componets and the related wiring.
Fell free to change the analog or digital ports as you like. Just remember to modify the code th mach your changes.
I designed a simple enclosure for this project.
You can find the STL files for front cover here and back cover here.
The Pro Micro pinout for reference:



