ways to control resistance by microcontroller
If the range is 0-500 ohm for a 12V vehicle, that means that the maximum ever current is 15V/500mA = 0.03A. Most probably it is a constant current source of 10mA and 500 ohm makes 5V.

You could go the hard way and make a variable resistor, but you could also use an open collector opamp and make voltage feedback. You could use your Arduino analog output which as far as I know is actually a PWM output, to control this circuit. In your MCU firmware you can map PWM to %fuel to get better accuracy.







simulate this circuit &ndash; Schematic created using CircuitLab

Update: Inputs of LM393 are pretty good at voltages near 0, but its output will saturate to 100-200mV, (max 700mV at the widest temperature range) so you will get less accuracy near zero. If application is automotive you could use Lm2903 wide temp. version or better NCV2903 - automotive version.

Update 2: The || symbol is a short form to represent equivalen parallel resistance.

$$ R3 = R1||R2 = \frac{R1.R2}{R1+R2}$$
Each OpAmp has some (small) input bias current. If the resistance on both inputs as seen by the OpAmp is not equal this will produce some voltage error on OpAmp's output. The calculated value should be 5k in this case, but using the nearest standard value 5.1k is acceptable.

One more thing - if the maximum current is 18-19mA it may be too high for LM393/LM2903's output. You can extend output current capability using a small signal MOSFET this way:







simulate this circuit

R5 acts as a pull-up resistor for OpAmp's open collector output. If you use another OpAmp with full output you may omit this resistor but be sure the OpAmp can drive its output down to 1V with respect to ground (-Vss). C2 limits the transistor's AC gain, you could experiment it's value to get maximum stability. R1 is connected to transistor's drain to close the DC feedback loop from the circuit's output. Zener diode D1 (12V) limits the maximum voltage applied on MOSFET's gate. Because M1 inverts the polarity of the signal OA1's inputs should be inverted compared to previous schematic!