Saturday, October 13, 2007

Initial Fuel Gauge Driver Schematic

Since I'm stuck indoors today to recover from a sore throat, I put together the following schematic to drive the fuel gauge based on the pack voltage.

(Click to enlarge the image)

With the exception of the 4N25 opto-isolator, which I salvaged from a dead UPS, all parts are available at Radio Shack. I hope to implement this soon. Comments and feedback are welcome.


Carlo said...

What you should try to do is use a PIC to implement the fuel gauge as a battery state of charge gauge, as opposed to a volt meter, as it sounds like you are trying to do. I have a Curtis 900R which has 10 LED's to do this. What you could do with the PIC is calculate voltage vs. time to attempt to truly indicate SOC. If you also connected a shunt to the PIC, it would be even easier to calculate, since you could actually measure the power if you know amps and volts at any given time. In either case, you could reset the life to 100% at a certain voltage threshold. Just an idea!

Peter said...

Carlos is right, the voltage will vary wildly based on the load current your pulling. Though as long as you're aware of this and only look at the fuel gauge after the car has been resting it will be fine.

However, using an opto coupler to transfer an analog signal doesn't work very well. It's non linear and the current transfer ratio varies significantly with temperature, especially at low If currents.

It is far better to use a Voltage Controlled Oscillator (VCO)-- say based on a 555-- to generate frequency modulated signal which can be isolated with an opto. Then use a LM2917 frequency to voltage converter to get your analog signal back.


TimK said...

Hi Carlo and Peter,

Thanks for the ideas. In the interest of simplicity, I think I'm going to solve the widely varying voltage by adding a huge RC network to the input voltage that has a time constant of between 40 and 80 seconds. That should even out much of the fluctuations but still give a reasonably accurate measurement.

I'm going to start with the opto-coupler since I designed the circuit to only run in the pseudo-linear region according to the specifications (2-10mA If). Below 2mA, things get bad. The temperature dependency curve only has 3% error in the 0-40 degrees Celsius range.

I just wanted to make a simple circuit to give me a rough idea about the SOC status. The PakTrakr has a much more accurate reading of the battery state, but it's much easier to glance at the fuel gauge while driving. I'll post the results of how it goes.


Peter said...

Well the RC filter will help somewhat but keep in mind that battery voltage on lead acid ( and most other chemistries) is only an accurate indicator of SOC after the batteries have been resting for a few minutes.

Carlo said...

That might work well, but keep in mind that the voltage gauge is only really usable when you read the voltage under load, in my experience. That may not work with the delay. My voltage gauge tends to read close to 120V no matter what the SOC is, but it is how far it drops at 50-100A that really tells me how much life I have left. Once I start dropping below 100V at that load, I know that I am scraping the bottom. Every installation has it's own dynamic, of course.

Frank said...

I second the suggestion to count amp-hours with a high-res ADC on your shunt output.

Although there are all sorts of fancy ways of guesstimating state of charge based on voltage and current, if you can just count amp-hours, why go there?

I, for one, would gladly pay money and/or karma for a simple amp-hour counter with a driver for a VW fuel gauge (see my project at

One more thing: there are linear optocouplers that use one LED and two identical photodiodes, the idea being that you use the second photodiode in a feedback loop to drive the LED.

Frank said...

Okay, doing a bit more research, it looks like the coulombic efficiency of lead acid batteries isn't 100%.

But I think if you use the appropriate Peukert's exponent and possibly reset to 100% after every few charges, you can get well within the accuracy readable on a fuel gauge.

TimK said...

Hi Frank,

Thanks for the comments. I agree that an amp-hour counter would be the most effective. I'm thinking about all the time I would invest if I engineered my own amp-hour counter versus just buying one for $500. The Evision system from Metric Mind has loads of bells and whistles on it to monitor the battery voltage and current. It's a bit steep at $750; however, it's designed well (works with a Peukert constant) and is off-the shelf. The older E-meter in the Sparrow was close to $900 and it offered less.

I'll continue to post any progress on the VW fuel gauge. If I go with an amp-hour counter, I'll probably use a voltage-to-frequency converter, pass it through an optocoupler and use a PIC micro-controller to drive the gauge.


Todd Stiers said...

I woke up this morning considering this project (use analog fuel gauge) for my electric motorcycle.

After reading the posts, I am running back to my PDA based approach reading off my Alltrax controller's serial port.

Thanks! Digital rocks!