Hi everyone,
I’m working on a small Arduino project to control LED lighting based on ambient light levels and motion detection.
Goal
Create a system where:
LEDs gradually turn on when the room gets dark
LEDs brighten only when someone is in the room
LEDs fade off after no motion is detected for a set time
Hardware
Arduino Uno (or Nano)
LDR (photoresistor) or BH1750 light sensor
PIR motion sensor
WS2812 or simple RGB LEDs + resistors
Optional: potentiometer to adjust sensitivity
Current Setup
I have the sensors connected and reading values, but I’m stuck on:
Smoothing the ambient light readings (so lights don’t flicker)
Combining motion + light threshold logic
What I’d Like Help With
Example code snippet to read the light sensor and debounce flicker
Tips on managing power/LED brightness smoothly (PWM or library suggestions)
Best way to structure the logic (ambient threshold vs motion trigger)
Any suggestions or example sketches would be appreciated!
Thanks