View Single Post
Old 11-20-04 | 01:37 PM
  #7  
jab's Avatar
jab
Ride more.
 
Joined: Nov 2004
Posts: 75
Likes: 0
From: San Diego, CA
Originally Posted by Becca
I've grabbed the battery monitor circuit. Now I have to ask... I see you're working with a 12v system. Mine is 6v... what changes should I make?
The circuit works by comparing a fraction of the battery voltage, say 0.48 * (V_batt - V_D2) against the reference voltage, V_ref; the adjustment varies that multiplier smoothly from 0 to 1 in order to set the threshold, while V_D2 is roughly constant near 0.7V. There are two of these comparisons that take place with two different multipliers, one for each threshold.

For development, I heartily recommend breadboarding this until you get it working just as you want it, and using an adjustable-voltage power supply to test the behavior at different supply voltages. I just put an LM317T adjustable regulator on the breadboard with the circuit, along with a few resistors and a trimmer to vary the voltage.

So, hmm, let's see... First off, you'll definitely need a lower voltage diode for D1, which sets the reference voltage, and you may need to pick a lower value of R1 to go with it. The Zener voltage needs to be well below (V_batt - V_D2), so that enough current flows through R1 and D1 ((V_batt - V_D2 - Vz) / R1) that the voltage across D1 is stable, even as V_batt drops with battery use. How much current is needed will vary with the specific diode, but I'd look in the 1-20mA range for starters. I see that http://www.nteinc.com/Web_pgs/Half.html lists diodes with Zener voltages down to 2.4; I'd try to keep it below 3V, if possible. Radio Shack seems to only have Zeners at 5.1V and 12V, so you may have to find a real electronics store. You may also need/want to just eliminate D2; I added it for some measure of reverse polarity protection, since reverse current will fry that op-amp double quick. The 0.7V drop from D2 may end up squeezing you since it decreases your voltage quite a bit, whereas it didn't affect me much at 12V.

Next, you'll need to make sure that the op-amp you use can handle the lower supply voltages. I don't know offhand about the NTE889M that I used. By the way, the Rat Shack seems to have a comparable part, the National TL082 (rat shack part #276-1715).

You'll also need to lower R8 and R9, which limit the current through the LED; with the values I used, you may not get enough to usefully light it. Definitely keep an eye on the current through the LED, though, because op-amps typically can't source or sink that much current, and this circuit demands they do both. Instead of using a single 1k resistor on one of the outputs, I used two ~500ohm ones, that way each op-amp output would have some protection if the circuit output was shorted to the supply voltage or ground. I only put about 5mA through the LED. Bear in mind that besides worrying about the current limitations of the op-amp outputs, as the LED current increases, it also pulls the op-amp output voltages closer together, which can affect the operation of Q1.

What else... R2 and R3 aren't to sensitive to the values you use; they deal more with proportions. I'd keep the values above 20k or 50k, just to avoid needlessly wasting power in them. I used 100k because that's what Fry's happened to have in stock. However, I'd say to get some "precision" trimmers -- I used some 25-turn ones -- lest you drive yourself mad trying to set the thresholds. If you're stuck using 1-turn trimmers, then you should probably use large fixed resistors on either side of the trimmer to reduce the range over which it adjusts, to "zoom in" on the proportions, so to speak. I say, get some precision trimmers and avoid the hassle. The circuit may act weird if the thresholds are set weird; you may want to figure out the needed multipliers, and set the trimmers near them using an ohmeter before you get started in the circuit.

There's a good chance you'll also need to tweak the values of R6 and R7; they serve to divide the output voltage of the lower op-amp such that the base current of Q1 is high enough to saturate Q1 when the op-amp output is high, but not much more. Keep in mind that the op-amp output won't go completely to either 0v or the supply voltage, especially with the LED attached. (So calibrate R6/R7 with the LED in the circuit.) This isn't too hard to do, really; keep an eye on the voltage across Q1 (emitter-to-collector); when the battery is good, the voltage drop should be really small, less than 0.1V. When the battery voltage drops to critical, V_Q1CE should jump up to near the supply voltage. Using your adjustable voltage regulator, vary the supply voltage slowly across the thresholds, to ensure that you get a clean transition without the LED dimming as you cross them. The base voltage will be (V_U1_7 * R6/(R6+R7)), and it needs to stay pretty low. Be careful using an R7 lower than 1k or so, as you may cook Q1 or the op-amp. If R6 is too low, Q1 won't be able to turn "on", which will prevent the LED from turning from red to green; if R6 is too high, Q1 may not be able to turn off at one of the threshold crossings, keeping the LED from turning red. The LED may also go dim near the threshold crossings in these cases.

The values of C1 and C2 aren't too sensitive; they're mainly there to filter out any ringing. Without them, the circuit can oscillate; if this happens, you may see the LED dim or turn orange, as the red and green elements will alternate in rapid succession. Make sure they're not polarized capacitors.

Finally, there are the feedback resistors, R4 and R5. These need to be kept at high values. The higher they are, the less hysteresis you'll have at each threshold. The schematic has an approximate equation for the hysteresis at the bottom, which you can use as a guideline. The key thing is that the hysteresis voltage varies inversely with the feedback resistance. You don't want too much hysteresis, as it can cause the threshold voltages to overlap; also, if you have a large hysteresis, a short voltage drop out from hitting a bump or something can trigger a threshold, but then the voltage goes back up it may not be enough to reverse the change. I'd shoot for 0.1V-0.25V, unless you know more specifically what you want.

You'll have to decide on which threshold voltages to set. This depends on your battery, really. Since I've got a 12V sealed-lead-acid, VRLA if I recall correctly, I took the suggestion at batteryfaqs.org of never discharging below 10.5V, and set that as my "critical" threshold. Then, I made a voltage-versus-time plot of my light system discharging (attached), and set the "low" threshold based on the estimated run-time; 11.5V gives me about 25-30min with 10W halogens + flashers.

I hope this is clear enough... and I hope you've got a meter. If you have any more questions, feel free to ask. Oh, and here's a PDF copy of the circuit I used, it may be easier to read.
jab is offline  
Reply