Low Voltage Indicator for 12 volt lead-acid battery

Hello all,

I have looked and found not much in what I'm trying to build here. I have the Arduino Uno and I am hoping to build a low voltage indicator light circuit using the Arduino and LED to incorporate into any 12volt automobile, tractor, ATV... etc.

The goal of my circuit is quite simple, when power is applied to the circuit and the voltage is above/below a set threshold (let's say 12.0VDC) The LED will illuminate if under 12 volts and will go out above 12 volts with no delay.

This circuit closely demonstrates the charging system circuit on an automobile. The battery light will be on with ignition on engine off because voltage at the alternator is lower than that of the battery, but as the engine starts and the alternator produces voltage greater than the battery voltage (lets say 12volts) the indicator light shuts off.

I have built this circuit several times using OP-AMPS and comparators with solid state componets, but I'd like to program my Arduino Uno to do this as well as other simple LED on/off for simple circuits on an engine (low oil pressure switch, temperature switch, seat belt switch)...

Thanks for the input in advance.

Harry

The Arduino has multiple analog inputs, so you can read voltages and/or compare voltages* (or make a "software" voltage comparator).

The Arduino can be damaged if you feed-in over 5v, but since you've worked with op-amps I assume you know how to make a voltage divider.

If you are new to programming, take a look through the [u]Language Reference[/u] to get an idea of what you can do. Then, take a look at the [u]Examples[/u], especially the analog examples.

Basically, you'll need to understand [u]if-statements[/u]. (i.e. If the voltage is greater than 10V do something, or if voltage A is greater than voltage B, do something else...)

Conditional branching ("making decisions" with if-statements) and looping (doing thins over-and-over) are the two most important concepts in programming.

  • The A/D converter doesn't directly read "voltage". It gives you a number between 0 and 1023 that's proportinal to the reference voltage. i.e. if your reference is 5V, and you read 512, you have about 2.5V on the analog input.
#define VOLT_THRESHOLD 512  // actual value depends on your voltage divider

digitalWrite (PIN_LED, analogRead(A0) < VOLT_THRESHOLD ? HIGH : LOW);

Rob

Thanks both of you. I appreciate the help.

Divider wise would it be better to use a series of 330r and 470r for an output of 5v? Or any advantage o using a regulator LM7805?

As you know, 12 volts is sitting voltage. With an alternator on while engine running realistically looking at nearly 14.5 volts. So my resistors would either get pretty warm, or I would blow the regulator.

Why does 12 volts gotta be so harsh lol.

When measuring 15V on the car battery do use 10k and 4k7 resistors as the divider. Or 22k and 10k resistors as the divider. So no heat there.
I would strongly recommend to add a 5-6V zener diode connected to analog input pin (cathode the analog input pin, anode the ground), as the voltage peaks might be much higher than 15V.
No warranties of any kind.

Hi, I use this circuit , and use the wire going to the indicator led into a digital pin instead. I use this to monitor the battery that runs my ardiuno to stop my programs when the battery becomes low. I hope it helps.

rockdog32:
Hi, I use this circuit , and use the wire going to the indicator led into a digital pin instead. I use this to monitor the battery that runs my ardiuno to stop my programs when the battery becomes low. I hope it helps.

You are using the turn-on Vbe of Q1 as the voltage reference. I got caught out once when I did a similar thing. The circuit worked in the summer when I built it, but didn’t when winter came.

The problem is that Vbe varies with temperature, by about -2mV per degC. Therefore, over a temperature range of -10 to +30C, the voltage that you consider to be “low” will vary by more than 10%.

pito:
When measuring 15V on the car battery do use 10k and 4k7 resistors as the divider. Or 22k and 10k resistors as the divider. So no heat there.
I would strongly recommend to add a 5-6V zener diode connected to analog input pin (cathode the analog input pin, anode the ground), as the voltage peaks might be much higher than 15V.

I would increase the resistors to 100K to +12V and 47K to ground, connect a 0.1uF capacitor across the 47K resistor, and not bother with the zener diode. The higher value resistor will limit the current flowing into the pin protection diode to a safe value even in the event of a 100V transient.

dc42:
I would increase the resistors to 100K to +12V and 47K to ground, connect a 0.1uF capacitor across the 47K resistor, and not bother with the zener diode. The higher value resistor will limit the current flowing into the pin protection diode to a safe value even in the event of a 100V transient.

Interesting. I am using 47K and 20K for the dividers, with a 1.47uF cap for filtering. And a 5V zener to ground after the 47K resistor.

The goal is to handle load dumps to 70V. Am I being too careful with the zener? From your comment the arduino has some internal protection on the AD? Should I go back t using 100K and 47K?

To the OP: the impedance of the arduino AD is in the "hundreds of megaohms" IIRC. Size your resistors such that the current drain on the battery is small. My original divider used 100K and 47K ohm resistors with no problems.

cptdondo:
Interesting. I am using 47K and 20K for the dividers, with a 1.47uF cap for filtering. And a 5V zener to ground after the 47K resistor.

The goal is to handle load dumps to 70V. Am I being too careful with the zener? From your comment the arduino has some internal protection on the AD? Should I go back t using 100K and 47K?

Opinions vary. The Atmega datasheet says you shouldn't let the input pins go above Vcc+0.3V, which it undoubtably will if you rely on the internal protection diode. However, Atmel's own app notes say it is OK to let the internal pin protection diodes clamp the input voltage, provided that you limit the current they have to pass to no more than a few mA.

Bear in mind that zener diodes have tolerances. Taking the BXZ79C5V1 as an example, the datasheet at Intelligent Power and Sensing Technologies | onsemi indicates that its voltage @ 5mA may be anywhere between 4.8V and 5.4V. It's slope resistance is 60 ohms max, so if you ask it to take 10mA then the voltage appearing across it could be as high as (5.4 + (0.005 * 60)) = 5.7V, which does not provide good protection. When you combine this with the fact that the voltage regulator that is powering the microcontroller also has a tolerance - for example, the 7805 can output anything between 4.75V and 5.25V - you can see that whether or not a 5.1V zener protects the circuit at all is partly down to luck. If you want to use external protection, then a Schottky diode between the input and +5V is a better bet.