How to interface (physically) a car fuel sender

craigcurtin

Senior Member
Guys,

I am moving along with my conversion project on my holden suburban and have just received my fuel gauge sender from the US.

It is a variable resistor type with a range from 10-180 ohms.

I have a Kiwi path board with 20m.

The sender has two terminals - an earth and the variable output.

I intend to try and drive this at Picaxe friendly 5v levels and see the result.

How physically do i hook this up ? I imagine that somehow i send the 5v regulated current at the variable output and the read this into the picaxe adc pin - i am just confused about what connects to what ?

regards

Craig
 

matherp

Senior Member
Just treat it like an LDR or thermistor. Put a resistor (say 150ohm) between +5V and a picaxe ADC input. Then also connect that input to one terminal of the sender and the other terminal to earth. Check if the sender has one terminal permanently earthed otherwise it doesn't matter which way round you connect it. Then the voltage at the picaxe will be determined by the potential divider created by the sender and the fixed resistor

Best Regards

Peter
 
connection to car fuel sender

Hi guys, sorry to dig up an old thread. I need to do this same job. ie: connect to my existing fuel sender.
By connecting the sender with another resistor as described (say 180 ohms), wouldnt the ADC then only see a maximum of approximately 2.5 volts (if you had a sender with a max resistance of 180 ohms also??) being in a voltage divider, you would read a max of half the supply. surely this would limit the ADC resolution to 50%.

I would greatly appreciate a little help on getting my head around this one. I think I have lost too much of what I learnt back in college!
 

hippy

Technical Support
Staff member
Yes, the resistor plus sender will act as a potential divider, and be limited to around half voltage, but that will still give around 0-128 values with READADC and 0-512 with READADC10, so you can still measure fuel level to around 1% or 0.25% resolution.

You can, depending on PICAXE, also use an internal or external Vref for the ADC to regain closer to 0-255 and 0-1023 readings if really needed.
 
ah, good point Hippy. In reality that is plenty of resolution for a fuel gauge. I wasnt thinking of the resolution calculation properly.

I think I will read some more into using the external Vref just for knowledge sake.

Thanks
 

Jaguarjoe

Senior Member
Most fuel level systems have anti-slosh circuitry or equivalent programming incorporated to keep the gauge needle steady otherwise you'll go nuts watching it bounce with every jarring movement of the auto. 90's era Fords had a small plug in board that did this and also provided the signal for the low fuel level warning light.
In the US, for purely psychology reasons according to an SAE paper, the fuel gauge always exceeds the full mark when the tank is full, slowly falls as level decreases for about the first half of the tank, then falls rapidly for the last portion of the tank. This goofy calibration is often accomplished by modifying the profile of the resistance element in the level sender. The shape of the tank also affects the calibration.
 
It is an old car so there is no existing circuitry to smooth the signal. (all done within the gauge) I was thinking of and RC component something like 3300uF and 33Kohms to give me around the 2 minute mark.
I know the capacity of the tank so I have written code to output the level in Litres to an LCD. I will just have to fine tune the ADC once I build it.
 

premelec

Senior Member
Bimet...?

I think many old analog gauges were of the type with bimetal strip heated with the tank signal - thus the thermal characteristics smoothed out a lot of slosh and gave slow response... clever but a hard to work with signal for tapping into and making sense out of the tank signal... cheap... probably a longer time constant needed -
 

Jaguarjoe

Senior Member
If you feed the 180 ohm sensor from a constant current source instead of a voltage divider resistor you can get any full scale range you want to feed into the Picaxe.
An LM317 3 pin regulator can make a nifty 2 terminal constant current source with only 1 additional resistor across the output and adj pins.
A 180 ohm sensor with 5 volts across it has I = E/R = 5/180 = ~28ma flowing through it.
An LM317 maintains a constant 1.25v between its output pin and its adj pin. For 28ma to flow you will need an R = E/I = 1.25/28ma = ~45 ohm resistor between output & adjust. A common value 47 ohm resistor is probably close enough. P = EI = 1.25*28ma =~0.04w so even a 1/8w resistor would work.
Just give the 317 enough headroom to work so make sure the supply voltage is about 9v or more.
You can see the circuit in the 317 datasheet on page 11 I think.
 
is this the type of thing you mean? (attached pic)

I have had a look and my fuel sender is 17 ohms when tank is full, and 120 empty. (the 180 before was just for examples sake)

so by your calculations I=E/R = 5/120 = 41.666mA
then R=E/I = 1.25/0.041666 = 30 ohm (so either a 27 or 33 ohm resistor)

is my location for the PICAXE ADC input correct? Obviously, from previous posts, I would need to run this through an RC network first.
 

Attachments

Last edited:

Jaguarjoe

Senior Member
That's the circuit.

It can also be a current sink if your load is in the input side of the circuit.

You would want to take the ADC signal from the junction of the ADJ pin, the 33 ohm resistor, and the "top" of the fuel sender. Taking it from the Vout pin will cause the signal to no longer faithfully follow the fuel sender because of the 1.25 volts that exists between Vout & ADJ.

You'll need to be careful putting RC filters in line with the ADC signal. The ADC input impedance (Z) is not especially high so any resistance you add between the sender and the ADC will detract from the signal level because the resistance you add will form a voltage divider with the ADC input Z.

The RC filter will have a time constant of at least many seconds, if not minutes. With T = RC, a low value for R means you'll need a large value for C. There are ways to implement filters with programming that might kinda cool to try. Let the Picaxe do the work.
 

boriz

Senior Member
"Let the Picaxe do the work."

I agree. Only use a small RC constant (a few seconds maybe) then the Picaxe can do the rest.

For an idea of the normal smoothing/timing, just watch a car fuel gauge from a cold start. Mine takes about 4 or 5 minutes to stabilize.

I have noticed however, that I seem to have more petrol when I'm going down hill :)

(Maybe a tilt meter can be added to cancel that effect?)
 
I have updated the diagram for thread completeness. Thanks for the help.

There had been talk previously in this tread about doing the average using the PICAXE itself. I guess a combination of the two methods should work quite well. take readings every couple of minutes, save 5 of them, add them together and divide by 5...
 

Attachments

Jaguarjoe

Senior Member
When powering things in a car or truck, be mindful of the notoriously dirty 12 volt electrical system in a vehicle. If the alternator is working hard and a big load is suddenly removed (a "load dump") there can be 60v glitches in the system that will zap any IC connected to it. There are ways to protect less hardy IC's like the 317 with diodes and such or use a voltage regulator designed for that environment like an LM2937 or 2940. I think they make 9v versions along with the common 5v ones.
 
I'm surprised there isnt a sticky thread on here about how to build a "bulletproof" power supply for the PICAXE. There seems to be enough talk about power supplies to warrant one...
 

MartinM57

Moderator
...because appearing to propose a bulletproof supply is a potential minefield:
- there might be something wrong with the design
- it might be perfectly built but used in the wrong way
- it might be imperfectly built even though its used in the right way
- it might use uncommon components that people will leave out/substitute something else not quite right

Which is why i suggest people Google for the Megasquirt power supply as it seems to (pretty much) have all the right features, is well proven and uses commonly available components. And if you can't be bothered to Google, it's on page 4 of http://www.bgsoflex.com/v22/megasquirt_ShemV2.2.pdf

However, I use a variation of this as I think mine is better (sprinkle an inline series resistor, a varistor and an inductor on the upstream side of the regulator and you'd be close :))
 
Last edited:

Dippy

Moderator
I would agree with Martin's additions to megasquirt.
I'd add a fuse too.
I currently work in automotive electronics (hybrids) and I can assure you that the amount of EMC/RFI/EMI/transient etc.etc. protoection/prevention/filtering is very comprehensive.

Most people simply couldn't be bothered to build a PSU to the standards we work to.

Your device should be protected from the car AND vice versa.
All I/O should have a degree of protection or isolation.

Even little things; why put RC on an on/off (or slow analogue) input when you could do all that in code?

You can (no vehicle comms pun intended) build something like the Megasquirt regulator plus Martin's additions for a reasonable cost and I'm sure it , if designed , built and installed properly, is capable of good results.
In fact, I've seen very similar (pinched) PSU circuits posted on this forum before.

If you choose cheap'n'cheerful that's up to you , you may be lucky - but, if I were you, I'd prefer it if you design based on worst case - esp if you are heading towards me at 90.;)
 
Last edited:

nbw

Senior Member
...because appearing to propose a bulletproof supply is a potential minefield:
- there might be something wrong with the design
- it might be perfectly built but used in the wrong way
- it might be imperfectly built even though its used in the right way
- it might use uncommon components that people will leave out/substitute something else not quite right

Which is why i suggest people Google for the Megasquirt power supply as it seems to (pretty much) have all the right features, is well proven and uses commonly available components. And if you can't be bothered to Google, it's on page 4 of http://www.bgsoflex.com/v22/megasquirt_ShemV2.2.pdf

However, I use a variation of this as I think mine is better (sprinkle an inline series resistor, a varistor and an inductor on the upstream side of the regulator and you'd be close :))
Hi there Martin, I had a look at this circuit as an upstream tidy-up of 5V on my new motorbike power supply. I second Dippy's suggestion of a fuse - have you done a sketch or similar of where you'd include the varistor + inductor + inline resistor? The third is easy enough to calculate for my project - total draw would be <100mA, but what kind of value have you used with the inductor. I seem to have an abundance of 4.7uHs in my parts box....

cheers Barney
 

Dippy

Moderator
I'm almost tempted to post a cut down version of our (certified) automotive design. Or would that be naughty?
 

nbw

Senior Member
Yeah, it would be naughty... but so is doing 42mph in a 40 zone :)

I'm ok with overcooking the safety aspects, happy to use nice fast avalanche diodes as the literature suggests some varistors can be a bit slow and can degrade over time. I like the idea of the fuse JUST in case...

I was also toying with the idea of putting a 7809 regulator between the relatively cleaned-up 12V and the 7805, again with a reverse diode across the regulator input/output, to add another layer of safety net. As well as a couple of 10pF caps throughout the circuit to catch the fasties.
 

Dippy

Moderator
When you see that magic word "automotive" in a Data Sheet it is useful and comforting, but don't ever be under the impression that it makes it anywhere near 'ideal' without supplementary components.
Too many novices assume the word "automotive" makes it bullet-proof.
Be careful.
 

boriz

Senior Member
Surely any switching regulator will be isolated enough to take care of most if not all anticipated automotive transients.

(And don't call me Shirley)
 

Dippy

Moderator
How do you work that out boriz?
And what about protecting the switcher control circuit?
What happens if the switch fails?

As an old grey-bearded boss once said to me: "Assume" can make an "ass" out of "u" and "me". Yup it's cringeworthy but very true.;)
 

nbw

Senior Member
I recall reading somewhere on spacecraft they have 2 back-up circuits for each critical circuit... one way of reaching towards that paragon of "bulletproof-ness". Also, apparently none of the recent spacecraft run Windows :)
 

Dippy

Moderator
Well, it's like hiring a tradesman or a specialist.
It's fine having the jack-of-all-trades fix the washing line , but you'd want a specialist to repair Grandad's 10000 quid antique gold watch.
Windows is a good JOAT.
 

nbw

Senior Member
On a good day it's a JOAT, on a bad day it's a PITA. Mind you, at least it ships with drivers!

Anyway, I've adapted the MegaSquirt Martin posted, added a fuse and an inline resistor, some pF caps in an effort to catch high-speed blips, and a 7809 to act as an intermediary for the 7805 - along the thoughts that it may also trap something between the dear old 7805 gets it. All we need now is an inductor, a varistor, and a large doberman named Mick.

(attached)
 

Attachments

MartinM57

Moderator
I think, IMHO, that you're just throwing components at the circuit in the hope that some of them might be useful ;)

I see no benefit from 10pF and/or 2.2pF capacitors in the circuit - unless you have a top notch PCB design where you've eliminated all parasitic capacitance, you will gave those value capacitances in the circuit just because of the way you've built it anyway.

And using a C as a low pass filter (i.e. high frequency rejection) method requires an R upstream of it and as there isn't an explicit one, you would have to do a clever circuit simulation to discover what all those upstream components give as an equivalent R - and then you might find out that that R plus 10pF or 2.2pF does absolutely nothing useful for you.

...but maybe the ? resistor upstream of the power switch is your "inline resistor" - convention would make it more obvious if it was swapped with the fuse

I can't see what the 7809 will do in terms of making the schematic a "better" power supply. What do you think it adds (apart from another component to fail ;))?

..and the dual Cs either side of the reverse polarity diode are an interesting feature.


All I would do above the basic MSquirt circuit (and you could say enough have been built and shown to be fine, so nothing is needed) is a 1R or 2R2 resistor immediately after the switch and a 100uH inductor immediately downstream of that resistor - the R stops the unit appearing as a short circuit when all the protection components switch on when a massive transient comes in, and the L gives some inline HF rejection early in the circuit.
 

nbw

Senior Member
40% throwing after 60% thought, I suspect, but I respect your HO.

My thinking was a low value cap or two would catch very fast short spikes, particularly if I used ones with low ESR values, in effect telling the spike to 'pick me pick me' before heading off into the rest of the circuit.

Yes, ? resistor = inline resistor. (I hadn't got around to calculating a suitable value for that - one of the kids dropped their tea on the floor). Swapping it with the fuse for convention, yes - I can live with that. Adding the inductor, no problem.

The idea of the 7809 - of which I have heaps - is to act as a buffer that could catch a nasty before it even hits the 7805. My thinking was that there might be transients which might get through one reg, but less likely to make it through two. Ah, I hear you say - then why not three regs? Or four? :) A bit hopeful maybe. For the extra 2 minutes of soldering time, I thought it might end up saving the PICAXE, LCD and everything expensive / time-consuming to re-construct further downstream. Peace of mind perhaps....

The dual Cs - are you referring to the 1n4007s across the regs? The caps there are for standard regulator design - cap on input and output. I didn't see any issues with this as it's just further buffering. The caps are more than adequately rated for the voltages in that part of the circuit.

Well, thanks for taking the time to review the schematic. I am tending towards overcooking this design a little as it's for my motorbike, and boy - is the power supply on that puppy noisy. Makes a nice picture of the Swiss Alps on the scope.

Speaking of which, scope creep can be a terrible thing: See attached.
 

Attachments

MartinM57

Moderator
If you have a scope then you have a great opportunity to build just the power supply and scope various points on the circuit when the bike is running and see what the effects of each component are - and paste some pictures here. They would be very interesting....
 

nbw

Senior Member
Definitely some interesting and some expected things happening - like when the headlights get switched off. My little scope isn't capable of anything flash like digital storage or anything like that, but I'll wheel the old dear out at some stage and let her throw both (yes, both!) of her traces across the bike at a breath-defying 25 MHz ;)

Worst case, I can draw cartoons of the waveforms, including any spikes that jumped so high they shot through the roof of the scope and splatted on the garage ceiling....
 

boriz

Senior Member
...How do you work that out boriz?...
I don't.

Since all the output current from a switcher comes from the magnetic field stored inside the internal inductor, there is no direct connection (except ground) between the input and the output.

P.S.

Who said 'Assume' ?
 

inglewoodpete

Senior Member
The 78xx regulators are not particularly spike tolerant, as I discovered. The damage can be obscure: I had a 7805 that simply lost regulation and exhibited a sort of thermal runnaway. I also found that PICAXEs permanently stop working at around 8 volts!

Motorcycle power regulation is not real good. The probable reason you get a spike when you turn off the headlight is that motorcycles have 2 windings in their alternators: a 'base load' winding and a 'demand' winding that gets switched in when the lights are turned on. The second circuit could be disconnecting after the load has been disconnected, causing the spike.

You need to look seriously at power cleaning plus "star" power and 0v distribution.
 

nbw

Senior Member
@Inglewoodpete - hi, yeah - motorbike electrics are noisy alright. I tend to create 0V stars in all circuits I do these days - should therefore apply it to this power clean-up.

The other thought I did have folks - was if the 78xx aren't the sharpest knives in the drawer so to speak - possibly a zener regulated version might be simpler? Still with the reverse diodes, inline resistor, fuse etc upstream - I'll sketch it and add it....
 
Top