Help controlling a resistive analog gauge

Hi!

I'd like to control my boats engine trim gauge using an Arduino.

It's a Faria analog gauge that requires the following resistance:

Trim Gauge (Measured in ohms)
UP MID DOWN
160 38.7 10

The boats power supply is 12v.

From what I have read, I can use PWM and a N-Channel Mosfet sunk to ground to control it.

Is it really that simple?

The gauge has 4 pin connector (see attachment).

For hookup:

I assume I connect P1.1 (+ Positive) to the 12v (boat power) and P1.3 (Trim Signal) to an n-channel mosfet that is connected to the ground side of the gauge (P1.4) and one of Arduino's PWM pins driving the mosfet.

Then as I change the PWM output value, I should see the gauge change values...

Anything else I'm missing?

Thanks!
Danny

I expect that would work. All you can do is try it.

I would add a 10Ohm resistor so that the MOSFET can never go hard-on and short-circuit your device. This is guaranteed to happen during the testing and debugging phase when you're trying to reprogram it while it's plugged in.

It’s a Faria analog gauge that requires the following resistance:

Trim Gauge (Measured in ohms)
UP MID DOWN
160 38.7 10

That’s a bit confusing… Do you have a wiring diagram? I mean a diagram of how the gauge is normally wired in a normal boat without an Arduino.

The gauge itself (the “display” part) shouldn’t have a variable resistance. The sensor normally attached to the gauge may have a variable resistance.

BTW - You can’t measure the resistance with a multimeter when the gauge is “powered” (or when it’s connected to anything else). So, if that’s where you got the resistance readings, they are meaningless.

Most analog gauges work on voltage, although the resistance may be important depending on the sensor.

From what I have read, I can use PWM and a N-Channel Mosfet sunk to ground to control it.

Yes, most analog gauges respond to the average PWM voltage. [u]Here is a MOSFT driver circuit[/u]. If you write PWM 0 the gauge should go to one extreme. If you write PWM 255 it should go to the other extreme, with 127 giving you a mid-range reading. (But, you may have to “calibrate” the values depending on the gauge design.)

Now, what’s missing is the sensor input or Trim Signal, which we know nothing about… And, what’s wrong with connecting the Trim Signal to the gauge without the Arduino? (Assuming that’s how it’s normally used.)… You can drive the gauge with the Arduino & software but I assume you want to get some real readings from some kind of sensor.

That almost looks like an old-style resistive fuel gauge. There used to be actual variable resistors inside car fuel tanks to make the gauge work.

You won’t find a lot of information when you google “trim gauge” but maybe “fuel gauge” will show up some projects where people have used Arduinos to hack the gauge on an old car.

Thanks all -- yes, it's an older style gauge (much like a fuel). Same concept -- I'm moving the TRIM sensor data to the ECU of the boat which will cause the old gauge to stop working. I am going to read the new data from the ECU bus (CAN) and power the old gauge using that data.

I'll try wiring it up -- I have an extra trim gauge (I bought to test with) incase I fry anything, would rather do this all at my bench instead of on the boat ;D

Ok - got the gauge and connected the 12+ Pin to 5v (just to test) and trim signal to ground. The gauge moves slowly (to full position)... it even moves at 1v just very very slowly...

So it looks like once I get the circuit up and running controlling the MOSFET using PWM, that should do the trick...

I'm curious if this worked out as intended. I'm doing something very similar with 8 gauges.