These gauges work by measuring a variable resistance controlled by the fuel level sender. Typically these gauges are expecting to measure a resistance between something like 90 ohms and 0 ohms (although the exact range may be different on different gauges).
I'm trying to get my head around how the gauges themselves measure that resistance. They are supplied with 12v and I believe the resistance is between 12v and ground. So based on ohm's law, I guess they must internally measure the current that flows? But that would mean at 0 ohms it would in effect be a direct short to ground? I presume they in turn measure the current by measuring the voltage across a known resistance.
My thinking (based on other threads) is that I could connect up a transistor to an output pin on the Arduino and PWM pulse that to control the 12v current to ground from the sensor pin on gauge? I have seen digital potentiometers but they seem to not be available in the sort of resistance range I need. Smallest I've seen easily available is 5 kOhm.
Analog devices appears to have a 100 ohm digital pot, but seems quite expensive:
Also there appear two be two types on fuel gauge, 'air core' and 'digital'. The air core ones I presume use some property of the voltage or current they sense to move the needle. The digital ones use a small servo to move the needle. Given the comments about Ohms law above and how the resistance is measured, do you think the digital ones would require a smaller voltage/current to measure the resistance? I'm concerned about on-going power consumption. My guess is the digital ones might only need to sample the resistance periodically and adjust the needle, rather than have a constant current flowing to keep the needle in place.
From the KUS website:
American standard: 240 ohm at empty, 30 ohms at full
European standard: 0 ohms empty, 180 ohms at full
The gage is measuring the voltage drop across the sender or the voltage drop across an internal resistor. They say "Connect to 12 Volt directly. If you have 24 volt system you must use the added resistors as shown in the diagram. " without showing the diagram. If you can find the diagram then it should be fairly easy to determine what quantity the meter is measuring.
My understanding of the analog gauge is there's a bimetallic strip. The more current that is allowed to flow through it, the hotter it gets, and the hotter it gets, the more it bends (which, in turn, moves the needle). This is of course rather wasteful of power. 240? of resistance is about 50mA @ 12V. A digital gauge should require significantly less power, though I'm not sure if it uses a special sender or if it uses the traditional sender. If you are reading a traditional sender with an Arduino, just sample it every few seconds rather than continually.
An Arduino using unfiltered PWM (via a transistor to satisfy current requirements) should drive an analog gauge (though it would be wasteful, as mentioned). To drive a digital gauge, you can still use the PWM but you will want to condition output with an RC filter and an op-amp.
tylernt,
I am wanting to drive the gauge, not sample the sender. My thoughts were the same as yours that it would be drawing about 50mA with the figures above. The digital stepper motor gauges are designed to be drop-in replacements to older gauges, so I guess must work on the same current range. So if they use 12v then they must draw the same 50mA to measure the resistance. So either, they stick with this and be just as 'wasteful' as the old gauges ('wasteful' being relative, when you have a car alternator putting out circa 50A then 50mA is nothing!). Or they use either a lower voltage, or sample the resistance at intervals rather than continuously sinking 50mA.
In short, what I'm trying to work out is if a newer (and more expensive) digital stepper motor gauge draws less current overall than the older style. And if it is worth me spending more for one if power consumption is a concern. Or whether they 'emulate' the older gauges to such an extent that they draw just as much power.
Right, the actual application in this case is a battery monitor for a lead acid battery bank in my motorhome. For aesthetic reasons and just-for-the-hell-of-it reasons I'd like to display the battery level on a car style fuel gauge. The Arduino will be monitoring the battery and measuring the current and voltage determining the state of charge. That side of things is all taken care of.
I have seen a project to build an open source retro gauge:
But that is more involved than I want to be at the moment, as I don't have ready access to PCB fab and 3D printing facilities. If I could buy a pre-built one of them, then that would probably be ideal
I've just bought a cheap (non-stepper) gauge to have a play with. Will test that out and see if I can get it displaying values from an Arduino. The stepper motors themselves are readily available on eBay. So depending on how it goes I might try gutting it.
An air core gauge cannot measure anything by itself, it requires electronics to drive it. It has two coils fixed at 90 degrees (actually two pair, the pair opposite each other wired in series) and the core is a magnet attached to a needle. How much and which direction you put current through the coils determines the magnetic field direction through the center, and so the magnet in the center lines up with that magnetic field.
You can do it with an Arduino. You just need two pairs of complementary PWM outputs.
The brown squares are the coils, the black small cylinder is a magnet that is magnetized so one side of it is N, the other side is S (ie, not magnetized so the ends are N and S).
Another way to determine what the gage is actually measuring is to put the gage in series with a 30-Ohm resistor and measure the current through the pair. That should tell you the internal resistance of the gage.
An NPN transistor driven by PWM ought to let you adjust the average current through the gage to let you display values.
For smart gauges (anything from a newer car) the measurement is done by pulses and if the value between pulses is not within a certain range the dash will display an error. For these it is mandatory to use a digital pot.
For older styles and i assume yours, being a universal type, fits within this category, the safer way to drive it is with a current source.
You can convert PWM to a voltage on the arduino and use a circuit such as this
Some will tell you that a voltage is good enough. It is not! A current source protects your instrument and the source in the event of a short and provides compensation against voltage drops.
casemod, why is the op-amp necessary? A bimetallic analog gauge responds so slowly (the one in my car requires several seconds to move full scale) that even an unfiltered 500Hz PWM should make it appear rock steady.
tylernt:
casemod, why is the op-amp necessary? A bimetallic analog gauge responds so slowly (the one in my car requires several seconds to move full scale) that even an unfiltered 500Hz PWM should make it appear rock steady.
Assuming it is a bimetalic. The digital ones are fast, the averaging is done by the host.
But into your question: The opamp converts a voltage into a current source. To drive it with PWM you need a transistor to boost the voltage levels from 3.3/5V to 12V and then you have an opportunity for a short circuit
The opamp sets the current to a maximun level, which you have to set. So even if the vehicle is reading full you cant pass the current defined for full (typically 50mA or less).
Casemod,
Thanks for all your input. This is starting to go beyond my electronics understanding... but I'll give it a shot. Part of the purpose of this is to learn more
What you are talking about with the op-amp turning it to a current source then I think answers my question about what happens when the fuel level sender in the vehicle goes to 0 ohms and why you don't end up with a short to earth with the full cranking current of a 100Ah battery
So is the unit you have on your bench a newer digital style one? And if it requires a digital pot, what sort of pot are you using? All the digital pots I could readily find appear to be much higher resistance (in the kohm range, not hundred-ohm range).
Am I right in guessing based on your username you are using these style gauges to display computer stats in custom modded cases? That is effect pretty much the same use-case as myself (only my stats will be coming from calculations of battery capacity).
mfoobar:
I think answers my question about what happens when the fuel level sender in the vehicle goes to 0 ohms and why you don't end up with a short to earth
Actually, the bimetallic gauges have inherent resistance. If they didn't, they wouldn't heat up.
Even when the sender goes to 0? you should not have a direct short.
I've yet to get my hands on the gauge I ordered, but it is a brand new one, albeit not marketed at being digital or anything. So I'm guessing is just a simple bi-metallic type. Will soon see when it arrives in a few days.
mfoobar:
Casemod,
Thanks for all your input. This is starting to go beyond my electronics understanding... but I'll give it a shot. Part of the purpose of this is to learn more
What you are talking about with the op-amp turning it to a current source then I think answers my question about what happens when the fuel level sender in the vehicle goes to 0 ohms and why you don't end up with a short to earth with the full cranking current of a 100Ah battery
Kind of. The fuel sender on a car has always a minimum resistance, in series with the instrument internal resistance.
Thats why you should never apply 12V to the older gauges, they are meant to operate in series with the fuel sender. And yes, you can drive them with a PWM duty cycle too, the current source is just a fancy add on for protection. Its not overly complicated as in justifying going with a less safe method and you can use the concept for many other projects like charging li-ion batteries, driving high power LED's, etc.
mfoobar:
So is the unit you have on your bench a newer digital style one? And if it requires a digital pot, what sort of pot are you using? All the digital pots I could readily find appear to be much higher resistance (in the kohm range, not hundred-ohm range).
Mine in particular ranges from 70 to about (300)Ohm. A 1Kohm pot with 256 positions will have a step size of (4)Ohm, so it can be used, but if you have a non intelligent type I would stick with the opamp variation. Cheaper, Simpler and rugged.
mfoobar:
Am I right in guessing based on your username you are using these style gauges to display computer stats in custom modded cases? That is effect pretty much the same use-case as myself (only my stats will be coming from calculations of battery capacity).
casemod:
the current source is just a fancy add on for protection. Its not overly complicated as in justifying going with a less safe method and you can use the concept for many other projects like charging li-ion batteries,
I wouldn't expect someone who's worried about "protection" and "less safe methods" to be charging li-ions with a homebrew circuit. Just sayin'.
casemod:
the current source is just a fancy add on for protection. Its not overly complicated as in justifying going with a less safe method and you can use the concept for many other projects like charging li-ion batteries,
I wouldn't expect someone who's worried about "protection" and "less safe methods" to be charging li-ions with a homebrew circuit. Just sayin'.
Does that mean I should stop giving safe advice at people and instead shouting bad advice to get them killed?
The fact I have a homebrew charger ( and I assume you mention the first, because the second is all fancy digitally controlled) does not mean I care less about protection or that it was done in a poorly way.
In fact the batteries were charged at home where I could monitor them.
Hi everyone, seems I am resurrecting a stale thread. Anyway I am attempting to create something like the OP suggested. I have a car with a really inaccurate fuel gauge due to the fuel tank shape (drive shaft lump creates a W-shaped tank) and an uncalibrated gauge whose signal is provided by two fuel level rheostats connected in series inside the fuel tank. As the tank drains, the sender high up the tank drops. At some point the level of fuel drops to the point where the second sender starts dropping. Combined, the senders start at 4 ohms for a full tank and 117 ohms for an empty tank.
I can tell this is a hack job because the FWD version of the same car has a single fuel sender whose resistance is 4 ohms full and 112 ohms empty. Basically, the manufacturer (Mitsubishi) used an off the shelf gauge and tried to make the senders provide a resistance that mimics that of the FWD model.
I have a mental design for a digitally controlled potentiometer (Analog Devices AD8400ARZ1) which is a 256-step 1kohm digital pot to replace the fuel senders as the source of changing resistance which drives the gauge. I then intend to measure the actual fuel sender resistance using a voltage divider circuit.
I noticed some of the posts discussing using an op-amp. I'm fairly new to this stuff but it looks like you're saying I should connect the output of the gauge directly to ground and feed power into the gauge using the op-amp?
Disconnect the wire from the sender(s). Does it read +12V relative to ground when the car is running? If so I would start with a 4-Ohm resistor and an N-Channel MOSFET to Ground. That should allow a PWM output of the Arduino to control the gauge. Determine the PWM value for each position on the gauge empirically.
I'm assuming that the senders are about 60-Ohms max each since they are in series. Use the internal 1.1V reference and a 5V pull-up of 240 Ohms (or slightly more) to keep the output value below 1.1V. This will draw about 100 mA from your 5V supply for each sender (200 mA total) so be sure to account for that when you design the power supply. This should give you a range of values you can map into the fuel volume.