# want to tell if a 12V source is on or not

I want to tell if a 12V something or other is getting power. Basically I'd like to read 12V as on and 0V as off. The digital pins on the arduino take readings close to 5V as HIGH and those close to 0V as LOW. Do I need to use a DC-DC (12V to 5V) convert or is there another, simpler way?

hi

you can use something called a voltage divider. Happily, it will only cost a few pennies:

Vin------- 10K resistor--------arduino digital in----------- 5.6K resistor---- GND

With this circuit, 12V at the Vin will produce 4.3V at the Arduino input pin. This will read well as a logic “1”, and also it gives you a few volts of “headroom” before you exceed the 5V input.

D

Awesome, that is exactly what I was looking for.

In the name of science, curiosity, etc. How did you know what resistor to use from ground to IN?

hi

it's actually a matter of two resistors- together they can divide any voltage that is higher than the output.

To figure out yours, I just plugged these numbers into the google search window:

(5.6/15.6) * 12

This corresponds with the formula here...

The all-time EASY way to understand the voltage divider is that this configuration will give out half the voltage you put in:

Vin----10K resistor---- Vout------10K resistor--GND

And so will this, but it will consume (and be able to provide) less current for a given voltage input:

Vin----100K resistor---- Vout------100K resistor--GND

From there, if you lower the value of the GND side resistor, the output voltage will go lower, and vice versa.

Daniel