Go Down

Topic: Neopixel ws2812 ldr controlled (Read 332 times) previous topic - next topic

DAVEROSS81

Hi, I am planning my first project with getting neo pixels to come on when light get lower and off again when brighter. I am planning using a 5v solar panel i have and powering via a 18650 battery, solar charged via charge board.

My question is how do i get the lights to come on via ldr sensor and arduino nano?

the charging side i am ok with

hope someone can help

Grumpy_Mike

Quote
how do i get the lights to come on via ldr sensor and arduino nano?
Wire the LDR between an analogue input and ground. Wire a 20K resistor between that input and 5V.

Use analogRead to get a number that depends on brightness. Use an if statement to see if that number is in the region that means it should light up, if it is light the lights, if not then turn them off.

Note do not let the lights fall on the LDR otherwise you will have made an oscillator.

Go Up