Arduino Inputs

Hiya,

Just a quick question. If I wanted the Arduino to continuously check an input to see if a 12v line was high, I could Just plug the 12v Line into the input pin (as the input can take up to 12v). The thing I'm worried about is that the 12v is from a car when its on. Is it still ok to plug the 12v straight in, Or should I do something that lowers it safely for the Arduino? I don't want to measure it, Just to see whether it is high or low..

Thanks!

James

If I wanted the Arduino to continuously check an input to see if a 12v line was high, I could Just plug the 12v Line into the input pin (as the input can take up to 12v).

In other words, if the Arduino is running, the 12V source is present? What is that going to tell you?

I don't want to measure it, Just to see whether it is high or low.

Isn't that a form of measuring?

I could Just plug the 12v Line into the input pin (as the input can take up to 12v).

Don't know where you read that but Arduino inputs can most definitely not take inputs up to 12V. You will destroy your Arduino.

Use a voltage divider to divide the voltage down by at least a factor of 3, so maybe a 22k and 10k resistor (22k from 12V to input, 10k from input to ground).

--
The Gadget Shield: accelerometer, RGB LED, IR transmit/receive, speaker, microphone, light sensor, potentiometer, pushbuttons

jpwsutton:
Hiya,

Just a quick question. If I wanted the Arduino to continuously check an input to see if a 12v line was high, I could Just plug the 12v Line into the input pin (as the input can take up to 12v). The thing I'm worried about is that the 12v is from a car when its on. Is it still ok to plug the 12v straight in, Or should I do something that lowers it safely for the Arduino? I don't want to measure it, Just to see whether it is high or low..

Thanks!

James

Arduino input pins can only read voltages between 0vdc and +5vdc. Appling +12vdc to any pin other then the Vin pin will damage your board.

(as the input can take up to 12v)

Do you mean the external power input connector of your board? That is the only arduino 'input' designed to handle the voltage level.
Lefty

Brilliant!

Thanks everyone, that helps a lot!

PaulS, I needed to know whether the battery my Arduino is being powered by was being charged or not. I probably should have included that, sorry! And yeah it is measuring, It sounded better in my head lol..

retrolefty and RuggedCircuits, Thanks, yeah I think I got confused with the Input jack, I was a bit suspicious (thus my post here :P). Will the voltage divider be enough to protect against any spikes? Or Do I not need to worry about that?

It depends, are you worried about "spikes" or "SPIKES". The car battery can get up to ~15V when charging, and the 10k/22k combo should be probably be changed to 10k/33k to allow for that. Now if you're worried about a worst-case-type event like load dump (>100V) then you've got another problem entirely. I might use 100k/330k to protect against that case.

--
The Rugged Motor Driver: two H-bridges, more power than an L298, fully protected

Ahhh I see, Would the Arduino Still be able to register the input if the Divider was 100k/330k though?

jpwsutton:
Ahhh I see, Would the Arduino Still be able to register the input if the Divider was 100k/330k though?

Less accurately perhaps. The arduino analog input pins are designed for 10k ohms or less source drive impedance.

For spike protection I would just hang a big old 16-20 volt 5 watt zener diode on it and call it good. Cathode to the analog input pin, anode to ground.

Lefty