Arduino UNO analog read problem to control WS2812B

I have the following scheme, i want to do different animations with WS2812B leds based on the inputs from the car. Basically i want analog read to act like a on/off switch depending on the voltage coming from the car.

My problem is that i do not understand the analog pins properly, because when there is no voltage coming from the car( everything is off) analog read returns values ~300, however when one light is on for example night time light, the analog pin corresponding to it will have the value 1023 but the problem is that the analog pin for daytime light sometimes returns 1023 too, even if it’s turned off from the car, same as with the signal lights.

Can someone please explain what am i doing wrong?

OK lots wrong with this.

  1. You should not connect a 12V input to an 5V Arduino, even with large series resistors. The analogue inputs are basically floating, that is just picking up interference rather than signals. You need a potential divider on each input with pull down resistor at 10K and a top resistor of say 4K7. I haven't done any calculations for this but that will work. I would also put a 0.1uF ceramic across the bottom 10K resistor to try and mop up any voltage spikes. Cars are a very noisy environment.

  2. You can not power an LED strip longer than about 5 LEDs from the 5V on the Arduino. The regulator will not stand it.

  3. You need a large capacitor from +5 to ground on the input pins of the strip.

  4. You need a series resistor 220R to 470R in series with the data line from the Arduino to the data input of the strip.

scheme.jpg

I would call running even 5 NeoPixels from the "5V" pin when you are feeding 13.6 V into "Vin", extremely dodgy! The on-board regulator has virtually no heatsink and is essentially useless. You need a 5 V "buck" regulator to convert the 12 V to a regulated 5 V usable to power both the Arduino via the "5V" pin and the LEDs.

I think Mike got the resistors wrong too! 4k7 is the pull-down and 10k is the "upper" resistor between the voltage from the car and the analog input. But for simple on-off determination you use digital inputs or digitalRead on the analog pins (A0-A5).

Finally, both 5V power wires and the data wire should travel together as a bundle from the Arduino to the LED strip - with the 1 mF capacitor and resistor Mike mentions at the connection to the strip.

I think Mike got the resistors wrong too! 4k7 is the pull-down and 10k is the "upper" resistor between the voltage from the car and the analog input

Yes sorry, that's what you get for replying at 5:00 in the morning.