Monday, December 12, 2005

A 12v charging system monitor

As some of you know, I have a Kawasaki KLR-650, which is sort of the Jeep Wrangler of motorcycles i.e. go anywhere type of bike. I recently added heated grips to it, as well as a socket for a heated vest. Now, one of the limitations of the dated KLR design is its pathetic excuse for an alternator, which puts out only 200 watts of power, total, when the engine is revved way up. It's possible to run your battery down if you're put-putting around at slow speeds because the alternator doesn't put out full wattage then and the KLR has no means to monitor your voltage.

I thought about putting a voltmeter on the KLR, but delicate mechanical movements and rugged onroad-offroad motorcycles don't mix too well. I then found the LM3914 chip which could drive a bar LED to basically display a bar graph of the current battery voltage, but a KLR doesn't really have a good place to mount such a LED bar, the instrument panel is very small. There is an area where there is a blank like for an idiot light, but no idiot light behind it. So I decided that what I needed was an idiot light that would go there and light up when my battery voltage got too low to tell me to turn off my heated grips and/or vest. At which point I did a swift Google search and found this design, a simple voltage ladder calibrated to generate 6 volts when the external voltage was 12 volts, and a 6 volt zener diode to drive the base of a transister which in turn switched the power to the LED on when the zener avalanched. So I printed it out and ran it by a friend, who said... "Uhm, you know, this is wrong. This will light up the LED when the battery is *above* 12 volts, not when it's *below* 12 volts."

So he moved the LED so that its cathode was sunk to ground and the anode was between R3 and Q1, so that the zener diode D1 caused the voltage to the LED to quench to ground when the zener diode avalanched at 12volts. Then he said, "You know, you could use a red-green diode and have it show up green at 12 volts, and red below there." He scribbled in another transister to drive the green portion of the LED when the voltage was above 12 volts.

Then I pointed out that a red-green diode actually had *three* states -- red, yellow, and green -- and that we could use this quite usefully via just adding another zener diode and potentiometer so that when the situation was unfavorable but still not disasterous, we got a warning (yellow) prior to the "you're screwed" notice (red), leading to the final design:

The 10K potentiometer for Ladder A is calibrated so that the zener avalanches when the +12v supply is above 12.1 volts. Ladder B is calibrated so that the zener avalanches when the +12v supply is above 11.7v. The cathodes are tied together internal to the LED package and thus must be tied to ground. The three states are like this:

Above 12.1 volts: green: At 12.1V, ladder B is sending power to the green (since the voltage is above 11.7V, but the ladder A transister now turns on and sinks the input to the red LED to ground -- leaving only the green LED on.

Between 11.7v and 12.1v: amber. Red is no longer suck by ladder A, since the voltage is below 12.1v, so the red LED is on. But we're still above 11.7v, so the green LED is also still on. This actually should be yellow, but the 2N3904 inline with the LED in ladder B adds a little bit of resistance to the green, meaning that the output is slightly more reddish than would be expected, since the red LED gets the full current through resister 'x' when ladder A is not activated. Thus "amber". Fiddling with x and y can make it more yellowish, but why bother?

Below 11.7v: red. Ladder B is now below 6 volts, meaning that the green is turned off. Ladder A is still below 12.1 volts, meaning that it's not sinking the input of the red to ground, meaning that red is turned on.

x,y - 620 to 1k ohm depending on LED. My LED states that it needs 20mA of power. Going to our handy dandy Ohm's Law calculator, I enter 12.1volts (the point at which the red LED turns on), and .020 amps (the amount of current for my LED). The calculator spits out that I need a 605 ohm resister which would mean using a 620 ohm resister. The back of the package recommends a 680 ohm resister at 12 volts, presumably because 12 volts might actually be 13.8 volts when the alternator is churning away. So be it. Because this is also .242 watts according to the calculator (i.e., about 1/4th of a watt), I select 1/2 watt resisters rather than 1/4th watt resisters for x and y. This is important because when ladder A turns on, the entire .242 watts flows through resister x and is quenched to ground. BTW, this circuit pulls approximately half a watt total in its most power-hungry state -- the green state, when all power from resister x is being quenched to ground.

In the end, the components can be grid-boarded then put into a small project box and silicon caulked in place to prevent water and vibration from having their way with things, and the LED itself soldered to wires that are then run up into the instrument panel and pushed up through a hole in said panel (there is a blank where that can be done). The project box can be screwed or glued to the back of the instrument panel somewhere where it is out of the way, and all that you see is the battery voltage indicator -- green for good, yellow for "Warning!", and red for "Turn off your electric gear *NOW*!".

After doing this design, I found out that somebody else already did it. Oh well, at least I have my own battery monitor now, and the parts aren't very expensive if you buy them from a discount electronic components vendor rather than from rip-offs like Fry's Electronics or Radio Shack.

Oh, final components list:

Add in some breadboard, wire, a small project box, etc. and you, too, could construct this inexpensive voltage monitor. How much it costs depends on whether you already have all the other stuff (voltmeter, soldering iron, wire, breadboard, a spare potentiometer to use to tweak the input voltage in order to calibrate the ladders, etc.). But if you already have all that kind of stuff and have discount electronic supply houses near you, you could easily put together this circuit for $5. If, on the other hand, you don't have that stuff, it's cheaper to buy it already pre-made...

- Badtux the Electronics Penguin

1 comment:

  1. You like going the long way 'round, don'tcha? Heh.

    ReplyDelete

Ground rules: Comments that consist solely of insults, fact-free talking points, are off-topic, or simply spam the same argument over and over will be deleted. The penguin is the only one allowed to be an ass here. All viewpoints, however, are welcomed, even if I disagree vehemently with you.

WARNING: You are entitled to create your own arguments, but you are NOT entitled to create your own facts. If you spew scientific denialism, or insist that the sky is purple, or otherwise insist that your made-up universe of pink unicorns and cotton candy trees is "real", well -- expect the banhammer.

Note: Only a member of this blog may post a comment.