# A simple digital current sink for a fuel gauge?

I need to simulate a 1200Ω fuel sender with an arduino, so I can control the fuel gauge.

The fuel gauge has one wire which it supplies with an unknown current and voltage, where the voltage is no larger than 12V and the current no larger than 50mA. The fuel sender is a resistor to ground. It's this resistance to ground I need to simulate.

I could go to the trouble of finding and fiddling with a digital potentiometer, except for the large voltage and current requirements.

It seems like I should be able to accomplish this with a ULN2803 and a series of resistors. I can use 6 outputs on the Arduino to control this driver, which then sinks it's outputs. (the other two outputs will drive dashboard indicators)

The simplest method would be to connect 6 different resistors, each representing one fuel level, and activating only one at a time.

A more complex solution would involve an R-2R ladder, but those designs are meant to work with digital I/O that both sources and sinks current, whereas I'm seeking merely to sink current to avoid having to deal with the 12V issue.

• Is there a simple solution with the ULN2803 and some resistors that will give me more control than just 6 levels?
• Is there a better way to drive a fuel gauge such as this?
• Are these things thermal or magnetic? I wonder if a single resistor and PWM might work? – Spehro Pefhany Apr 17 '14 at 22:46
• @SpehroPefhany The device I'm making has to work with a number of gauges regardless of how they actually decide how to read the fuel sender. But given that most have significant filtering to avoid needle movement for sloshing, it's probably worth trying a single PWM and transistor... – Adam Davis Apr 17 '14 at 23:25
• I'd tend towards the conservative approach then.. it wouldn't take much troubleshooting for some oddball car design (Lada? Renault? Citroen?) to pay for an awful lot of resistors and switches. – Spehro Pefhany Apr 17 '14 at 23:27

USE serial control to octal MOSFET package

When you get bored with using up 6 of the arduino's output lines and realize that the ULN2803 won't quite work as well as you expect (the darlington outputs prevent you fully turning on a transistor to ground less than 0.7V), you might go for a serial MOSFET array like this: -

On resistance is 5 ohms so if the largest current in one FET is 25mA, it will turn on to about 0.125V giving you more range of control over your fuel gauge. If you didn't fancy choosing different resistors you can cascade several of these bad-boys (note the serial out line) such as 4 to give you 32 levels all using the same resistor value.

However, I'd go with Joe Hass's suggestion of halving the resistor value - with the device I've shown you can get 256 levels ($2^8$) from two lines, serial in and serial_clock.

Here is the data sheet

• Thanks for the pointer to this part, and the transistor voltage drop. I'll have to add this one to my parts bin. – Adam Davis Apr 17 '14 at 23:26

There's no reason that the resistors must be the same, is there? Use one resistor that will sink 32 mA, one that will sink 16 mA, one that will sink 8 mA, and so on. Enable the resistors in whatever combination gives you the desired current. Six outputs will be just enough. Rather than use the ULN2803 directly you might want to use a low-resistance NMOS transistor to enable each resistor; then you can be sure that current won't be sourced through the resistors.

By the way, all of the resistors need to have 1% tolerance or better.

• Only the most significant (lowest value) resistors have critical matching, other than that, sounds good. – Spehro Pefhany Apr 17 '14 at 22:43