Continue to Site

Welcome to

Welcome to our site! is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Measuring resistance with a PIC microcontroller?

Not open for further replies.


Member level 2
Nov 3, 2009
Reaction score
Trophy points
United Kingdom
Activity points
I want to make a replacement fuel gauge display for a boat, using a PIC microcontroller.

The sensor is a variable resistor activated by a float in the fuel tank; one terminal is connected to the 0V rail (although it may be possible to isolate it if necessary). The resistance of the sensor is to to be verified, but is likely to be either 0 Ohm to 180 Ohm, or 0 Ohm to 300 Ohm.

The existing display is a moving coil meter in series with the sensor and the 12V rail.

What would be the best way to use the existing sensor?

Here's a couple of pic-friendly methods for resistance measurement.
- Make a voltage divider consisting of the variable resistor (sensor) and a fixed resistor. Measure the voltage at the center of the divider with ADC.
- Run constant current through the sensor. Measure the voltage on the high side of the resistor with an ADC. You'll need a constant current source circuit.

Since the sensor resistance is relatively small, you may need to amplify the voltage before the ADC.

I guess, the existing meter is an ampere-meter in disguise. Constant voltage is applied across the level sensor resistance changes. The current varies linearly with resistance, which in turn varies with liquid level. Probably, the resistance of the ampere-meter is negligible.

To amplify it, you need to design a good instrumentaion amplifier.

glenjoy said:
To amplify it, you need to design a good instrumentaion amplifier.
InAmp and Kelvin connection to the sensor, is more accurate approach to a measurement like this. But if some error is tolerated, say 1% then, a simpler connection with a resistor referenced to common ground could work too. 1% translates to 2Ω for resistance of the wires, or about 100m of 18AWG wire.

Not open for further replies.

Part and Inventory Search

Welcome to