Car battery voltage divider

Hi. First post here, please be gentle!

Having recently discovered the Arduino, I've set about my first project - a fairly simple dual battery voltage monitor and indoor/outdoor temperature gauge for my campervan. My knowledge of electronics is basic at best, but I know my way around a page full of code and I've made surprisingly quick progress so far.

My question is about building a voltage divider, to drop the 12v battery down to a range the Arduino can cope with on its analogue inputs. I completely understand the principle, but am concerned about the consequences of bridging the positive to negative terminal on a 110Ah battery with a couple of tiny resistors like suggested on this page and other tutorials I've read.

Is this safe? Won't the resistors melt with all that power? Do I need special resistors?

If it is safe, how much power will be drawn from the battery by the voltage divider?

The arduino input will draw approximately no current so the total power dissipated by the resistors is E * E / R = 17 * 17 / 17000 = .017 watts. Those small resistors are rated at 1/8 to 1/4 watt so they will handle the power comfortably.

EDIT: add To be more specific, the current through the resistors is E/R = 17/17000 = .001 amps.

Power dissipated in the resistors is i * i * R so for the 12k p = .001 * .001 * 12000 = .012 watts and by the 5k resistor .001 * .001 * 5000 = .005 watts.

Edit2: I've seen voltage spikes on car battery voltage up to a couple of hundred volts on starting or switching heavy loads so in addition to the resistors shown I would add a third resistor in series with the arduino analog input (1k or so) and a diode from the analog input pin to VCC for the arduino with the cathode at VCC to clip the spikes.

Thanks, that's very helpful.

Is 'E' in your formula the max. voltage of the car battery?

Is 'E' in your formula the max. voltage of the car battery?

Yes

RoyK: Edit2: I've seen voltage spikes on car battery voltage up to a couple of hundred volts on starting or switching heavy loads so in addition to the resistors shown I would add a third resistor in series with the arduino analog input (1k or so) and a diode from the analog input pin to VCC for the arduino with the cathode at VCC to clip the spikes.

On starting... I've only ever seen the voltage drop significantly on cranking the starter motor ... any spikes should be absorbed by the battery....

Hell I've seen circuits using 12v zeners to protect them from induced voltage spikes!

If cars regularly produced several hundred volts even briefly, why is my car radio, electronics, lights not all BLOWN out from voltage spikes?!

cjdelphi:

RoyK:
Edit2:
I’ve seen voltage spikes on car battery voltage up to a couple of hundred volts on starting or switching heavy loads so in addition to the resistors shown I would add a third resistor in series with the arduino analog input (1k or so) and a diode from the analog input pin to VCC for the arduino with the cathode at VCC to clip the spikes.

On starting… I’ve only ever seen the voltage drop significantly on cranking the starter motor … any spikes should be absorbed by the battery…

Hell I’ve seen circuits using 12v zeners to protect them from induced voltage spikes!

If cars regularly produced several hundred volts even briefly, why is my car radio, electronics, lights not all BLOWN out from voltage spikes?!

There are voltage spikes all the time - back EMF from the coil, in cars that still have coils. Automotive voltage regulators are rated for transient input voltages in excess of 70V.

In diesels this isn’t a problem as there is no coil…

Of more importance is the charge voltage from the alternator - for a 12V car system this can easily top 15V or so, so be sure to take that into account with your voltage divider formula…

70v spike would be absorbed by the battery… since inductors will only briefly produce a transistient voltage the battery should be enough.

I’ll pull out the battery charger, oscilloscope, multimeter and I’ll crank over the engine and see if I can find these spikes which should be dampened by the battery?

Yes, the battery does provide some damping, but not 100%.

This is the scope trace for a car starting: See how it starts at 12V, drops right down, then rises gradually back through 12V up to around 14V as it charges.

Then zoom in to the trace (see how thick it is?) and you get: With the battery dampening the power there is still spikes there. Minor, yes, but still there.

Now imagine you have an electrical fault and the battery stops doing the dampening - such as a loose battery terminal, or a faulty battery - it happens - what would happen to those spikes? And what would happen to the devices attached to the car power that aren't able to cope with them...?

Nice pics, and yes lose of battery connection on a running engine is called a 'load dump' and can be about as bad an electrical event that a auto can see, short of maybe a direct lightning strike. Electrical devices designed for automotive applications do have to be designed with this in mind.

Load dump means the disconnection of a powered load. It can cause 2 problems: failure of supply to equipment or customers large voltage spikes from the inductive generator(s) In automotive electronics, it refers to the disconnection of the vehicle battery from the alternator while the battery is being charged. Due to such a disconnection of the battery, other loads connected to the alternator see a surge in power line. The peak voltage of this surge may be as high as 120 V and the surge may take up to 400 ms to decay.

http://en.wikipedia.org/wiki/Load_dump

If cars regularly produced several hundred volts even briefly, why is my car radio, electronics, lights not all BLOWN out from voltage spikes?!

They (the electronics) contain transient suppressors. They are designed for that environment. The transients are too short to have much effect on lights.

In that case a zener or 78xx should be fine then....

My suggestion was for protecting the analog input pin on the arduino. A zener (5v) could be used to do that also but a 78xx wouldn't be useful for that.

To protect the analog pin a zener could be used....

Another way might simply be an opamp / comparitor ic.

To protect the analog pin a zener could be used....

Believe that's what I said just above

Another way might simply be an opamp / comparitor ic.

And protect it's input how?

http://forum.arduino.cc/index.php?topic=170560.msg1268334#msg1268334

You need 3 resistors and a 20V Zener diode..

Couple of comments.

Noise in an autos DC system has many many components, and the battery is not able to absorb all of them. Here is a summary of some common ones:

Any auto device needs to be able to accept this type of conditions on their lines, both power as well as signal.

And one other thought: Be careful with using Zener clipping diodes with too high an impedance resister divider. Once you get into the 5K-10K+ range, the leakage of the Zeners can greatly impact the accuracy of your measurements. Better to use a couple of bypass diodes. One also needs to take care of too high of resister dividers into the A/D converts in the Arduino. They have a rather low input impedance themselves (several K's), and if your external divider is too high, you can end up with inaccuracies being introduced as the Atmel CPUs analog sample capacitor is switched in to sample a given A/D pin. You are OK with the 12K/5K resisters, but if you started getting into the 50K range there could be issues.

Adding say a 1uF capacitor after the divider and before heading to the Arduino input pin can help greatly to not only clip down transients, filter out random noise, but also present a low impedance input to the A/D converter pin. Use Royk's 12K/5K resister, add a 1uF 25v cap at the junction and two fast diodes (one to Vcc and one to Gnd) to contain any spikes and you should have a good solid sampling ckt to measure battery voltage. There is a time constant that will now comes into play - the above will response to changes in battery voltages up to perhaps 20 times a second. Hopefully that will be enough?

Best of luck, and have tons of fun! -al-