12V analog input

My electronics skills are a bit lacking, so I'd really like some help so that I don't blow up my board. :)

So, I've got a 12V analog input and, as to my understanding the analog input on the Arduino only reads up to 5V.

It is a 12V wire with a variable amount of resistance put on it.

My thought was to build something like this where Rx is a variable resistance:

12V -> Rx -> R1 -> Testlead -> R2 -> Gnd

R1 would be a resistor to step down the voltage from 12V maximum to 5V max. R2, as I would see it, would be R1 + max (Rx).

I'm not sure what R1 needs to be, nor what the range of Rx is.

Does this sound doable? Thx!

Take a look at this: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1198965521

Or this: http://www.arduino.cc/playground/uploads/Learning/Level_shifting_4_arduino.pdf

The solution is better than only using resistors.

There is a difference on what you're thinking, because when you have 12v. signal, arduino input receives 0v., and when 12v. becomes 0v., arduino input is 5v.. It's just a question on Arduino logic, but you can change the software to sense 0v (instead of 5v.), or change the circuit. But the original circuit is better, because of Atmega internal configuration.

Awesome! That rocks. Thanks.

jack,

is your 12V signal analogue or digital?

It looks to me like the solutions posted are intended for digital type inputs and won't work well or at all for analogue.

Mike

Yes, the links are for a digital solution. For analog input you can use a resistor divider. You want to divide the input voltage by approx 1/3 to ensure that a 12v input will not exceed 5v on the arduino. There is a java voltage divider calculator here http://ourworld.compuserve.com/homepages/Bill_Bowden/r2.htm but values of 10k for R1 and 4.7k for R2 will be approximately correct. You can use a 10k trim pot for R1 if you want to adjust for an exact value.

Sorry for that. It was my fault. I didn't read it correctly, read it too fast.

You all are correct, in this case the easier solution is to use an Attenuator, like mem described.

Well, honestly I'm not sure how the signal is comign down. I'm trying to translate the steering wheel controls in my new car into something that my computer can understand.

It's the GMLAN protocol. I was planning on experimenting when I got that far. :)

Jack

PS - Thanks for all the help.

I have a question that relates to this topic…

Having a similar situation where I want to interface with a 12V sensor. I got as far as the voltage divider and that is all good, but I would also like to be able to write back to the original instrumentation a 0-12V analog signal. I could keep the sensor connected to the instrumentation in parallel, however I want to also be able to send my own signals so I can use the gauge to view logs

I am fairly new to electronics, so perhaps I am using the wrong terminology in my searches because I am finding it very difficult to find a simple electronic circuit that will let me basically to the reverse of a voltage divider.

Can someone help with this? I would have thought it a fairly common requirement…

Any help or pointers in the correct direction are much appreciated :slight_smile:

Hi Kenny,

It would be better to start a new thread with a new question, but what you are looking for is a non-inverting amplifier with a gain of 2.4 like this opamp circuit:

+---24k------+ | | | | | +------+ | GND --10k---+--|- | | | | | | OUT+--+-- 0-12V | | Output 0-5V --10k---+--|+ | Input | +------+ | 24k | | GND

Regards, David

Hi David,

Thanks for your advice, will definitely try it that way.

I was also thinking that it might be possible to use an opto-coupler connected to an analog pin and switching the 12V reference... seeing as the analog output is PWM, wouldn't this also cause PWM of the 12V?

Regards, Kenny

Hi Kenny,

It would be better to start a new thread with a new question, but what you are looking for is a non-inverting amplifier with a gain of 2.4 like this opamp circuit: . . . Regards, David