ReadADC with automotive level sender

Captain Haddock

Senior Member
How would picaxe get on with reading adc value from automotive level senders?
I have the choice of EU range of 10-180 ohm empty to full or US range of 33-240 ohm empty to full, I've only done adc on 0-10k before, will it cope?
 

papaof2

Senior Member
Typically, you would be suupplying voltage to the level sender and reading the voltage as picked off by the potentiometer that's a part of the level sender. Just provide 5 volts to the sender and READADC the value provided.
UNLESS it's a modern CANBUS sender, in which case all bets are off because you can't use READADC on that.
 

AllyCat

Senior Member
Hi,

In principle a PICaxe can do it as well as any other ADC measurement system. But it depends if you want to use it "on the bench" or installed into an existing (or new) automobile system. Also if it is a "potentiometer" or (more probably) a "one wire" (plus earth) variable resistance; and what degree of "accuracy" you require.

Therefore, you may need to provide a series resistor (probably similar in value to its rated maximum resistance) and a regulated power supply (or the PICaxe's supply rail), where its current drain might be much higher than the PICaxe itself. Note that the sensor mechanism and/or the displayed scale might be quite non-linear, so you will probably need a "calibration" stage, for example via a lookup table.

Cheers, Alan.
 

erco

Senior Member
And your code will have to take a running average reading to account for fuel sloshing around, cauing wild sender fluctations.

I'm working on a '67 Corvair and adding some Picaxe-compatible hardware/sensors/wiring to complement the original gauges. At some point, the mechanical speedometer will be replaced by a servo.
 

inglewoodpete

Senior Member
I would use a rail-to-rail op-amp (on the 5-volt supply) wired as a non-inverting voltage follower, with it's output wired to the PICAXE ADC input via a low value resistor (Eg 470 ohm). A voltage divider on the input to the op-amp would be required if sender's voltages are greater than 5v.

Personally, I use the MCP6021 op-amp to do this type of task.
 

erco

Senior Member
IWP: Can you explain why the voltage follower is superior to a direct connection? Hoping to learn from your experience.
 

Captain Haddock

Senior Member
Thanks for the input guys, the sender I'm looking at is a multi reedswitch/resistor ladder type which goes in jumps, it's for a rigidly fixed header tank on an engine testbed so no sloshing to worry about, as it's avgas I wanted something definately rated for use with petrol hence going for automotive, as for canbus everything we deal with still uses contact breaker points.
I just think an led bar would be better for standing out than a analogue gauge if the header tank runs low plus I can easily add a warning beeper, don't want to run out of fuel on a baking hot aircooled engine as things crack without a proper cooldown, it's light aero engines so pretty basic stuff.
I'll order the sender and try it through picaxe, any probs and I'll just order the gauge to go with it (it's not my money I'll be spending).
 

inglewoodpete

Senior Member
IWP: Can you explain why the voltage follower is superior to a direct connection? Hoping to learn from your experience.
An op-amp is more more resilient to both limiting and tolerating over-voltage spikes than a digital component. A quick swap of an op amp is much simpler than sourcing, programming and replacing a PICAXE, should either chip fail. Plus, if the price difference is important, the op-amp is cheaper (this reason is pretty minor, since the labour cost of replacing either chip is generally the largest part of the repair cost).
 

AllyCat

Senior Member
Hi,
.... any probs and I'll just order the gauge to go with it (it's not my money I'll be spending).
If you were using the "standard" fuel tank (i.e. designed to accommodate the sender) then it might be worthwhile to get the gauge as a reference for calibration. But if you are just using the sender as an "accessory" for your own tank, then you will need to calibrate the scale accordingly. Possibly, the standard meter would be an ammeter designed to be the upper "resistor" in a potential divider chain with the sender, (i.e. connected on the battery/supply side).

Many, many years ago the "meter" often took the form of a "Hot Wire Ammeter" (which strictly is a power-sensitive meter) that had several advantages: Cheap, quite rugged and with a very slow response, to average out any "sloshing" of the fuel. This could also tolerate an Ultra Low Frequency (<1 Hz) "PWM" Voltage Regulator, achieved by simply wrapping a heating coil around a Bi-Metal strip, that disconnected itself (and the meter circuitry) at a pre-determined temperature (i.e. power dissipation).

Generally, a 10k resistor in series with any ADC input should protect the PICaxe adequately. However, in an "Automobile-type" application (with an alternator) you may need to pay particular attention to the PICaxe supply rail. Typically use a large supply decoupling capacitor on the Input side of a suitably-rated (e.g. 100+ Volts) Regulator; but best to Read up on "Load Dump" issues. ;)

Cheers, Alan.
 

Captain Haddock

Senior Member
It won't be connected to any automitve electrics, just an automotive type sender so no problem there, the engines we run have no electrics except the starter motor, ignition is closed magneto system with just a ground to stop it if needed and plug leads are fully screened, fuel injection systems are mechanical only, these things are very basic.
 

papaof2

Senior Member
Just remember that the starter motor is a high current and thus potentially a high-spike-voltage-generating device. That's a great place to watch with a 'scope ;-)
 

Volhout

New Member
It is important to look into the final application. In the past (long ago) I have looked at this and at that time the level sensor was a variable resistor like yours, that was hard wired to the car's chassis. So one of the pins is chassis ground, and the other goes to an analog gauge. The other side of that gauge was connected to the +12V car battery.
You talk about sensors that are 33-240 ohm, in which case the car battery current can be 0.4A....0.05A

If your system is like this then you need far more than a simple opamp.
First of all you need to measure current (not voltage).
Second, your current flows to the+12V car battery, and not to ground.

Thus you need a 0.5A (or more) current sensor (floating) with analog output (0-5V) for the picaxe.

Before we go into more design an details, you better confirm that this is the circuit of you final application.
 

Captain Haddock

Senior Member
It won't be connected to a car battery in any way, probably 12v from a mains transformer that is already in use powering a fuel flow meter and a 7805 down to 5v for both picaxe and sender, sender will be 2 wire isolated from mounting screws.
As said this is not in a vehicle just a static testbed, the 12v batteries we have only power starter and a couple of 12v fuel pumps, everything else is powered from main via adaptors where needed.
 

AllyCat

Senior Member
Hi,

As indicated in #3, you will probably need to connect the (earthed) sender to the PICaxe supply rail via a resistor and read the ADC voltage at their junction. For "best" resolution a resistor of perhaps 100 ohms (i.e. the mid value of the sender) might be used, but I would probably use a larger value perhaps 1k ohm, for several reasons:

Firstly, the current (i.e. power) will be lower and there's no point in heating up the electronics unnecessarily. Secondly, a 1k will give a more "constant current" which may improve the linearity/calibration of the measurement (it will certainly affect the linearity). Of course the ADC value measured across the sender would be much lower but that can be corrected by using a READADC10 (i.e. full scale 1023) but using just the (low) byte value (i.e. full scale 255). Then a (up to) 256 byte lookup table (READ{TABLE} instruction) to linearise the calibration (or I have posted a code snippet which can lookup/interpolate to much higher resolution if required).

Note that you may need to "invert" the ADC value (i.e. subtract it from a constant) to give an increasing gauge value when the tank fills.

Cheers, Alan.
 

wapo54001

Senior Member
In my flying days I built an experimental aircraft and as part of the build I used a capacitive fuel level sensor because the automotive style sensors didn't meet my accuracy requirement and the low resistances were a pain to work with (all my flight and engine instruments were digital).

As I recall my capacitive level sensor was 12VDC in, and 0~5VDC out. Available in all lengths to match depth of tank. I used an 08 to convert the output to a gallons remaining indication. Accuracy suffers if you change fuel often -- I had calibration problems as I switched between mogas and avgas, but if you're not going to be in the air some loss of precision probably doesn't matter.
 
Top