SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By hassmaschine
#140123
I should preface this by saying, I'm not an EE, and I have no real background in electronics. I know some basics, just enough to be dangerous really. I've been breaking my electronic toys since I was about 8 (stole my dad's radioshack soldering iron to "fix" my RC truck). 25 years later, I'm still breaking my toys, they're just more expensive toys. Still using a radioshack iron. ;)

anyway - I have a problem to solve that may actually be really simple. It's beyond the experience I have, the problem is I don't even know what question to ask. So I'll explain what I'm trying to do instead.

I'm converting a signal for a gas gauge, to use a single low-resistance sender (3-75 ohms) with a gauge that expects two, high resistance senders (~200-700ohms). I believe the gauge sends a 5v Vref signal to each sender (which is just a resistor network and a float), which are sent to two seperate ADC convetors (16 bit! overkill?) and computed inside the gauge to move a stepper motor, which moves the needle.

I do have 2 senders, but they are wired in series (which I cannot change for other reasons), and I believe (but I need to verify) that the total resistance is 3-75 ohms. I can hook up the vref to my series-wired senders easily enough, but the output voltage would be too high, the curve wouldn't fit, and I'd only have one output. So I need help. :)

So, it seems simple enough - take some voltage input, Nv-5v, from my series-wired senders, and output a 0-5v curve to two ADC inputs. suggestions? I spent some time searching for ideas, but I'm a bit lost. Sometimes knowing what question to ask is harder than solving the question itself. :)

I have *some* control over the ADC transfer curve, in software - but, I'd like to get it as close as possible with hardware first.
By Mee_n_Mac
#140146
I have some questions. The single sender you have and are planning to use ... it's a simple 2 terminal device that measures 3 ohms btw the terminals with the float fully one way and 75 ohms with the float fully the other way ? The sender normally used with the guage is a 3 terminal device, with 1 terminal common (and usually tied to ground) and the other 2 terminals connected to the gauge ? Do both of these terminals act the same ? Are they both 200 ohms (terminal to the common) with the float fully one way ... or do they act "oppositely" ? That is one terminal measures 200 ohms when the other measures 700 ohms and vice versa ? This is often done on other sensors to detect open/broken connections.

If the above is correct (or nearly so) then the gauge may send 5V to the sender(s) but does so through another internal resistor(s) so the sender forms a voltage divider with it, and whose "divided" voltage is sensed by the A/D. You seem to have a good idea of what's inside the gauge, can you confirm this ? A simple op-amp circuit can rescale the senders voltage but you'd then need to supply this circuit with some external power. If you can fool with the gauge software or change the aforementioned resistors you can perhaps avoid this.
By hassmaschine
#140153
thanks for the response, it's given me something to think about!

yes, the original sender is a simple 2-wire connection - one vref, most likey 5v but I need to verify, and ground.

the new gauge is actually 4 wires, two grounds (same plane) and two different Vref supplies (5v when left "floating"). yes, both senders act the same, with the same resistance curve from empty to full, and they don't invert. I checked the full voltage reading and got 2.75v, empty was .9v. it does sound like it's dividing the voltage down.

both grounds show continuity, so I'm not sure it's working the way I thought it did. IE, I don't read 5v on one end, and some voltage output on the other. I get a voltage reading (0.9v - 2.75v) on the + pins and just ground on the - pins, even before the sender itself. I only see the full 5v if I test it with the wires left floating. maybe that's what I should expect?

I suppose then my convertor circuit would output the inverse of the voltage I'm seeing at the terminals of the the 200-700ohm senders? so, empty, my convertor circuit would output 4.1v, and full it would output 2.25v? I think that makes sense. I need to see what the output at the gauge of the stock sender is. I'm thinking it will be much higher due to the lower resistance.

external power shouldn't be a problem, I can get both clean 5v and 12v power from the cluster.
By Mee_n_Mac
#140180
Why do you think the gauge has 2 sets of inputs ? Is is just for redundancy, in case 1 wire breaks or is it to measure 2 tanks ? Does the gauge work properly with just one sending circuit connected ?

I'd expect to see just 5V at the gauge + pin (Vref) with nothing attached. My guess is that that pin is connected via some internal resistor to 5V. With no current output from the gauge, there's no Voltage drop across that (internal) resistor and so you read 5V. If you fell like experimenting a bit you could place a few external resistors across that pin and gauge ground and see what the voltage reads (I assume you have a DVM) and what the gauge reads. These resistors would be something like 200, 500 and 700 ohms ... the range the sender intended for the gauge to "see". You could try the lower values of resistance your new sender has (or just use the senders) and see what happens, it should be lower voltages.

When you say "I do have 2 senders, but they are wired in series (which I cannot change for other reasons), and I believe (but I need to verify) that the total resistance is 3-75 ohms" you still only have 1 float ? Or do you have 2 floats, with each float independantly controlling a sender that varies from 1.5 to 37.5 ohms ? It doesn't make that much difference, as I'd expect the value to vary from 3-75 ohms (given your series wiring) no matter what. I'm just curious.

How familiar are you with op-amp circuits ? And do I have it correct that 0.9 V at the gauge = empty tank and 2.75 V = full tank ? What value of resistance do you have for the new sender at empty and full tank ? Which is the 3 ohms and which is 75 ohms ? If it's a GM unit I'd say empty and full respectively.
By hassmaschine
#140182
there are 2 sensors, it reads one level sensor from each side of the tank, so when you're cornering you still get a valid reading. my current setup does the same thing, except the two sensors are wired together instead of seperately. No, it won't read properly without both inputs. If one input is left floating it basically goes into an error state and shows it as empty (I think it throws a code inside the cluster as well).

I don't think there are any internal resistors - it just goes into an ADC? I can poke around and see what's between the input and ADC. the gauge is digitally controlled stepper motor. the old gauge was something of an analog DC motor, with no intelligence.

I talked to an EE friend, he says the senders the new gauge uses are basically rheostats, which is why I get the behavior I'm seeing.

3-75 ohms is from my current senders (together), and yes that's empty/full. I'm going to probe it for a voltage reading with the tank empty and full. it is 2 floats wired in series, so 1.5-37.5 ohms each.

I'm not familliar at all, but I found a great document from TI that explained a lot about using op-amps. It gave some pretty nice equations I can use, if that scheme will work. I need to know the voltage output of my current stock senders to proceed.
By Mee_n_Mac
#140185
hassmaschine wrote:I talked to an EE friend, he says the senders the new gauge uses are basically rheostats, which is why I get the behavior I'm seeing.
A rheostat is just a variable resistor. You use one to make a varying voltage by using it in a voltage divider. In your case it's a variable R2 in the diagram below. R1 would be the internal resistor I'm referring to. And Vout (below) would be the pin on the gauge that's connected to all 3; the internal resistor, the sender (rheostat/R2) and the A/D input.

http://en.wikipedia.org/wiki/Voltage_divider
Image

So when R2 is a large value, say a really really really large value, like an open circuit, you get the Vref (Vin on pic above) you've measured at the gauge pin. With any lower resistance you get a voltage less than Vref per the equations in the wiki. When you measure a voltage that's equal to 1/2 of the open circuit voltage, that resistance value (of R2) is equal to the internal resistance (R1) value.
By lyndon
#140207
Slightly OT, but do you have a mfr/part number for either of those sensors? I have a project where I need to add a gauge to a gas tank and I'm still at the build vs. buy decision point.
By hassmaschine
#140210
Mee_n_Mac wrote:
hassmaschine wrote:I talked to an EE friend, he says the senders the new gauge uses are basically rheostats, which is why I get the behavior I'm seeing.
A rheostat is just a variable resistor. You use one to make a varying voltage by using it in a voltage divider. In your case it's a variable R2 in the diagram below. R1 would be the internal resistor I'm referring to. And Vout (below) would be the pin on the gauge that's connected to all 3; the internal resistor, the sender (rheostat/R2) and the A/D input.

http://en.wikipedia.org/wiki/Voltage_divider
Image

So when R2 is a large value, say a really really really large value, like an open circuit, you get the Vref (Vin on pic above) you've measured at the gauge pin. With any lower resistance you get a voltage less than Vref per the equations in the wiki. When you measure a voltage that's equal to 1/2 of the open circuit voltage, that resistance value (of R2) is equal to the internal resistance (R1) value.
thanks, that makes sense to me now. I think what you're suggesting is I could change R2 to another value that would get the output of my stock senders to be closer to what the gauge needs? I believe the stock gauge runs on 12v and the new one is 5v, but I need to bench test the stock gauge to be really sure. I did a quick measurement this morning and got 3.75v at about 1/8th of a tank.

Checking the wiring for my stock gauge/cluster, R2 is actually the series-wired senders (3-75 ohms), and R1 is is 68 ohms. but these are 1980's components, so the tolerances are way off. The one i measured was only 50 ohms! Vin is 12v (nominally, ~13.5v in reality).
lyndon wrote:Slightly OT, but do you have a mfr/part number for either of those sensors? I have a project where I need to add a gauge to a gas tank and I'm still at the build vs. buy decision point.
they're BMW parts so you probably don't want to spend coin on them. I think the ones in my car are around $100 each? they last forever which is a bonus but I wouldn't want to buy new ones if I didn't have to. :)
By hassmaschine
#140213
So, after reading about voltage dividers and from what I do know about the two gauges so far, I've come up with these curves:

(old gauge, 12v reference)
Empty 8.07
1/8 7.26
1/4 6.03
3/8 5.52
1/2 4.92
5/8 4.04
3/4 2.90
7/8 2.03
Full 0.96

(new gauge, 5v reference)
Empty 0.91
1/8 1.06
1/4 1.20
3/8 1.58
1/2 1.90
5/8 2.16
3/4 2.38
7/8 2.58
Full 2.75

These are *rough* approximations (within an order of magnitude), and I think the curves are a little more non-linear than that, but they give an idea roughly of what I'm looking at.

In order to keep other systems on my car happy, I need the 1st curve to stay the same, and convert it before it goes into the new gauge.

I also mistakenly said that the current gauge is 75 ohms full and 3 empty, it's 3 full and 75 empty.
By Mee_n_Mac
#140230
That's the data needed ! So let me be sure I understand. You have the old/stock gauge and sender and came up with the (12V) readings above ? Then you used the new gauge and new sender (?) to come up with the (5V) readings above ? When you say "In order to keep other systems on my car happy, I need the 1st curve to stay the same, and convert it before it goes into the new gauge", what exactly do you mean ? Does the old gas tank voltages have to go to some other gauge in addition to the new gauge (that runs off 5V) ? Or do you only use the "converted" voltages ? I had a simple 1 transistor,3 or so resistor circuit to do the old conversion, I'll see if that can easily be adapted to the "3 full and 75 empty" curve but it would simply output the new voltages. There would be no output that's the same as the stock gauge&sender to send to any other instrument. If needed that can be done; to send out 2 voltages, the "5V curve" to new gauge (to 2 places to simulate 2 senders) and the old "12 V curve" to XYZ instrument.

ps - Are you now sure the old/stock sender (when wired in series) goes 3 - 75 ohms ? At one point you had to verify that. And that each unit in the new sender (that you're not going to use) would go 200 - 700 ohms ?

I take the project is to retrofit a new instrument cluster in an old Bimmer ?
Last edited by Mee_n_Mac on Fri Feb 24, 2012 12:49 am, edited 2 times in total.
By lyndon
#140239
!cough! No, thanks. The whole tractor only cost me $150 :-)
Guess I'll keep designing my own capacitive level sensor.
hassmaschine wrote: they're BMW parts so you probably don't want to spend coin on them. I think the ones in my car are around $100 each? they last forever which is a bonus but I wouldn't want to buy new ones if I didn't have to. :)
By hassmaschine
#140373
Mee_n_Mac wrote:That's the data needed ! So let me be sure I understand. You have the old/stock gauge and sender and came up with the (12V) readings above ? Then you used the new gauge and new sender (?) to come up with the (5V) readings above ? When you say "In order to keep other systems on my car happy, I need the 1st curve to stay the same, and convert it before it goes into the new gauge", what exactly do you mean ? Does the old gas tank voltages have to go to some other gauge in addition to the new gauge (that runs off 5V) ? Or do you only use the "converted" voltages ? I had a simple 1 transistor,3 or so resistor circuit to do the old conversion, I'll see if that can easily be adapted to the "3 full and 75 empty" curve but it would simply output the new voltages. There would be no output that's the same as the stock gauge&sender to send to any other instrument. If needed that can be done; to send out 2 voltages, the "5V curve" to new gauge (to 2 places to simulate 2 senders) and the old "12 V curve" to XYZ instrument.

ps - Are you now sure the old/stock sender (when wired in series) goes 3 - 75 ohms ? At one point you had to verify that. And that each unit in the new sender (that you're not going to use) would go 200 - 700 ohms ?

I take the project is to retrofit a new instrument cluster in an old Bimmer ?
yes, the signal goes to another gauge (on board computer) that I want to keep functional.

I think I could do it if I used an op-amp? split the sensor's voltage output before it goes into the op-amp? the board of the old cluster/gauge already does this. I was going to use the output for the actual fuel gauge for the conversion circuit, and leave the other output alone.

I did verify the curves, 75-3 is a nominal range I believe, but it's from the internet and not an official source. anyway, here's exactly what I found:

So after fiddling around trying to simulate the original fuel level sender with resistors, I found a rheostat sitting in one of my parts bins that matched the resistance curve perfectly. I also figured out that I can run it without the gauge being there (a good thing) by adding another 68 ohm resistor (there's already a 68 ohm resistor inline with the gauge).

After that, it was really easy to find the curve.

old/stock:
Measured: Nominal value:
Vin 13.4 13.5

R1 131.5 136

R2
Empty 82 80.0
1/8 73.6 72.3
1/4 66.6 64.5
3/8 59.1 56.8
1/2 49 49.0
5/8 39 38.0
3/4 28.3 27.0
7/8 15.3 16.0
Full 5.1 5.0

Volts:
Empty 5.1 5
1/8 4.8 4.7
1/4 4.5 4.3
3/8 4.2 4.0
1/2 3.6 3.6
5/8 3.1 2.9
3/4 2.4 2.2
7/8 1.4 1.4
Full 0.5 0.5

The measured values for 1/4, 3/8, 3/4, etc. are just eyeballed off the stock gauge face, so I'll use the "nominal" curve. The input voltage is "12v" but on my car, the 12v system is actually 13.5v (it's a pretty solid value, too).

The new gauge I had a LOT of trouble with. The senders it uses are total garbage. I'm going to do the same thing, only with two rheostats because I can't get anything consistent from the level sensors. They keep going open, and the new gauge freaks out and the needle stops moving. I have to switch it off/on to get it to read anything, it's stupid.

I was only able to measure full and empty, but I came up with this curve using the same formula:

Measured: Nominal:
Vin 4.98 5

R1 323.4 330

R2
Empty 70.0 70
1/8 111.3
1/4 152.5
3/8 193.8
1/2 235.0
5/8 276.3
3/4 317.5
7/8 358.8
Full 400.0 400

Volts:
Empty 0.89 0.9
1/8 1.27
1/4 1.60
3/8 1.87
1/2 2.10
5/8 2.29
3/4 2.47
7/8 2.62
Full 2.75 2.75

An inverted op-amp should do the trick? I'd like to order parts this week. Any suggestions for an op-amp that you like? There's like a billion of them out there.

and yes, I'm retrofitting a newer cluster in an older bimmer. the fuel gauge is by far the hardest part. :)
By hassmaschine
#140376
oh, I just remembered - to make it work the way I want, I need to input the inverse voltage to the new gauge. (since it's putting out a 5v signal, through a rheostat, to ground).

so the output curve of my op-amp would look like:
Emp 4.11
1/8 3.73
1/4 3.40
3/8 3.13
1/2 2.90
5/8 2.71
3/4 2.53
7/8 2.38
Full 2.25

the gauge would then see the potential difference (it's 5v output minus my op-amp input) and it should match what it's expecting for each level. Am I in the ballpark here?
By hassmaschine
#140392
my EE friend had this to say:
I think you're focusing on the potential difference with 5v too much. You should care about what the potential difference with ground is, which is equal to the pontential. You're trying to make 5v the ground, which it's not. Ground is the ground...
so, I'm going to target an inverting circuit, with 5v-0.5v inputs, and .9v-2.75v outputs.