PWM to automotive fuel guage

Hi,

I am trying to follow the existing examples of PWM output to analog gauges in a project for my kit-car.

I'm attempting to use an arduino to read the fuel sender signal and then after a bit of processing to smooth out and damp the fluctuating levels generated by the fuel sloshing around in the tank under acceleration, braking, cornering etc, display the smoothed level on the gauge.

The gauge I have is from ETB instruments - see the following post for the link to the gauge details.

To test the gauge and the PMW, I wrote a small sketch that sets the analogWrite to 0, 63, 127, 191 & 255 with a 2 second delay between each value before it loops back to zero.

The Arduino is given 12v, and the output pin is hooked up to a transistor to switch the higher voltage through the gauge

The thing is, it's not working. The gauge rises to around 4/5ths deflection and stays there. No change of value.

I'm not sure I have the gauge hooked up correctly - I have 12v going to the B terminal, and then the T terminal hooked up to the transistor collector, and the emitter goes to ground. I haven't connected the gauge earth as this caused the needle to dive back to zero and stay there.

The only other information I can give is:

The gauge (according to the manufacturer's FAQ) is an air-core movement
Resistance across the B & T terminals is 142 ohms
The sender gives a resistance of 14 ohms Full, and 264 ohms empty

I'm relatively new to this electronics / microprocessor marlarky so be gentle with me! :slight_smile:

Thanks,

Jason

Gauge Details:

No - I'm not sure that it isn't doing anything clever in gauge itself - but from observation, when the gauge is attached directly to the sender as per the diagram, the needle will move very quickly from stop to stop once the fuel has drained to the point that the sloshing produces a full range movement of the sender arm.

I'll try the larger delays in the sketch as you suggested.

Note also that the gauge expects some variable resistance TO GROUND. So you should be able to simply connect an NPN transistor with emitter to ground, and collector to the signal input terminal on the gauge.

Isn't that what I've already done? 12V is supplied to the B terminal, and then the T terminal is connected to the collector of a transistor, with the emitter to ground and the base connected to the PMW output of the arduino.

As I said in the first post, the dedicated gauge earth (the bottom-most terminal in the diagram) has been left unconnected, as if its connected to earth nothing happens at all.

Thanks,

Jason

Do yo have a resistor located between the arduino and the NPN transistor?? Try a 1K or below if not.

As you have done keep running a program which just outputs (so it has no inputs) to keep things simple. In fact just have one output and vary it every now and again to see if you get changes.

I have done something similar with a temperature gauge if you look on autosportlabs.com in the new project suggestion (sorry no link)

Hope this helps

Ryan

Ryan - Thanks for the reply. Yes, I have put a 1K resistor between the PWM pin I'm using and the base of the transistor.

I'll take a look at your temp gauge. :slight_smile:

Ok - I've just talked to the people at ETB.

  • The needle is oil damped - this will acount for the deflection speed I guess, and I will have to change my pauses on the test sketch to see any differences in value.
  • There is nothing 'clever' inside the gauge
  • There are two resistive coils with the gauge - one connected to the B terminal, the other to the T terminal. Both are connected to the earth pin.

The chap did say that if the gauge was connected as per the diagram in the ETB pdf, without the earth, it'd go full scale. So I assume that I have the wiring the wrong way round, as when I connect the earth, it reads zero...

There are two resistive coils with the gauge - one connected to the B terminal, the other to the T terminal. Both are connected to the earth pin.

I don't think this statement is true. The ground is for grounding a bulb you may put into your gauge to light up with the dashlights.

Best way to tell is use a multimeter and measure resistance between earth and each of the connections.

I put an LED in parallel with the Arduino output so i could see the LED getting brighter/dimmer with a change of duty cycle as a confidence check.

I've come prepared! :wink:

B -> Earth = 212 Ohms
T -> Earth = 70 Ohms
B -> T = 142 Ohms

I believe the internal wiring is something like this:

               LAMP
12v<----------X----------
                         |
       B                 | E
12v<----/////----/////----->Earth
               |
               |  T
               ------------->Sender----->Earth

Ok - I definatly do need the earth connected - I hooked up the gauge sans arduino to a pot to simulate how it would be connected in the car.

With out the earth, with a empty reading (264 Ohms), the needle shows full. With the earth in place it shows empty, and by varying the pot between simulated full and empty, the needle displays correctly.

So - I need to know how to simulate the varying resistance of the pot... which changes the current. And changing the duty cycle of the PWM only effectively changes the voltage, right?

I now have the arduino driving the ETB gauge, using the transistor interface as described in the original post

What was the school boy error?

I had assigned digital I/O pin 3 as my PWM source, and hooked everything up and it did nothing. After a lot of head scratching, taking the arduino out of the equation completely and just feeding the transistor direct to make the gauge go full scale, I double checked the connections to the arduino.

That's when I realised that I was hooked up to analog In pin 3, not digital pin 3.... ::slight_smile:

Cycling though the different PWM duty cycles gives different readings, and I've currently got a little sketch cycling through displaying zero, 1/2 and full.

Becuase of the oil damping in the gauge, it's not an immediate sweep to each position (takes about 2 seconds to get to a given reading), but at least I know it's going to work now. :smiley:

Thanks for your help and patience.

Cheers

Jason

Good to hear you managed to sort it out.

I'm playing with a full set of Golf MK1 clocks at the moment. I'm just trying how to figure out how to make the speedo electric at the moment so i can make them fully digital :).

Could you gut the gauge and put a stepper motor in there? You could then control the position of the stepper using the arduino - I believe there are several how to's on the forum on driving them.

I was thinking of something like that. I was going to either gut the inside of a pug 106 gti set of clocks as i have some available to me which are electrically operated and bodge them inside the dash or attach an electric motor where the speedo cable goes in.

Either way i'm well putting in some bi colour LEDs to change to red when nearing the RPM limit to trick them out a bit. :wink: