Reading a resistive fuel tank sensor using Arduino - Page 1
Forum section: electronics / beginners

author: Lucky-Luka
author_rank: Unknown
timestamp: July 05, 2020, 04:30:15 pm
content: Hi allI need to measure the level of fuel in the primary tractor tank using Arduino because lower than a certain level I need to actuate a fuel pump from secondary tank.This sensor ha 2 wires, one connected to +5V and the other connected to the tractor dashboard.A voltage divider came to my mind.I should measure the R2 resistance, right?Is this a right way to proceed?Cheers

author: garethw
author_rank: Regular Contributor
timestamp: July 05, 2020, 04:46:26 pm
content: You are most likely on the right track. You could confirm your theory by measuring the voltage before and after refuelling. I would add a buffer between your level circuit and ADC input (an op-amp set to unity gain). I would also consider some kind of protection diodes in case there are voltage spikes. Anything above 5V will damage your Arduino.

author: Lucky-Luka
author_rank: Unknown
timestamp: July 05, 2020, 06:46:10 pm
content: Can you show me some kind of schematics of what you have in mind please?

author: den
author_rank: Contributor
timestamp: July 05, 2020, 06:55:46 pm
content: A slightly off-topic answer - have you considered using an ejection pump? It works from the return flow. If you do not have it it's not an option of course.

author: Renate
author_rank: Super Contributor
timestamp: July 05, 2020, 06:59:58 pm
content: Is this a modern tractor?If it's being fed with regulated 5V then I would guess that it is a potentionmeter, not a variable resistor.The indicator/computer would be high impedance, not a fixed resistance.If the tractor were very old the tank sensor would be a 90 ohm (or 180 or whatever) variable resistor to ground.They usually drove a magnetic indicator.They are a kind of pain to interact with.I did it once.To get a good reading you need to send a bunch of current through it.To save power you just pulse that current, not keep it constant.

author: garethw
author_rank: Regular Contributor
timestamp: July 05, 2020, 07:28:42 pm
content: Here is the simple idea. No need for the protection diodes as I mentioned as there is a separate 5V supply. The high impedance of the op-amp will not disturb the circuit and will allow your ADC to get a reliable reading. C1 will help smooth the input further.Any basic op-amp would be fine such as the trusty LM358.This should give you some inspiration.

author: Renate
author_rank: Super Contributor
timestamp: July 05, 2020, 08:33:33 pm
content: I haven't seen any numbers for resistances.Are you sure that the sensor doesn't use the housing for ground?It's easy enough to check.Usually temperature sensors are the only thing that runs off 5V and doesn't use a straight potentiometer wiring.

author: Lucky-Luka
author_rank: Unknown
timestamp: July 05, 2020, 08:46:31 pm
content: Hi RenateThis is a project for a friend of mine that repairs tractors on the field.The tractor is new.He told me that the sensor has no ground since the tank is made of plastic.18 ohm full tank, 320 ohm empty tank.

author: Renate
author_rank: Super Contributor
timestamp: July 05, 2020, 10:35:02 pm
content: Hmm, so did you measure the resistance of the indicator?It could well be as you've diagrammed it in the first post.(You're quite sure it's as drawn?)Still, for decades American vehicles used the circuit below.It didn't need any regulated voltage.In the indicator there were two counter-acting coils.When you turned off the ignition, the needle stayed at the current reading.It was really pretty clever.

author: Lucky-Luka
author_rank: Unknown
timestamp: July 12, 2020, 06:51:01 am
content: Hi allI gave a new schematic to my friend to follow after he gave me more detailed infos regarding the actual tractor setup.We came up with a circuit that actually works... I was surprised...BTW I just wanted to share it with you to receive any suggestions to improve it if needed.I attach the schematic.There are a fuel pump (P) and a fuel valve (V) to control properly in order to transfer fuel from the secondary fuel tank to the primary one.We used this step down converter to step down the voltage from 12V to 5V:https://www.amazon.it/AZDelivery-Trasformatore-Tensione-25V-32V-Arduino/dp/B07SRXR1VT/ref=sr_1_6?__mk_it_IT=%C3%85M%C3%85%C5%BD%C3%95%C3%91&dchild=1&keywords=step+down+converter+arduino&qid=1594536354&sr=8-6We used two of these optoisolated relay modules to control the 12V valve and the 12V pump.https://www.amazon.it/HiLetgo%C2%AE-isolamento-optoaccoppiatore-supporto-attivazione/dp/B0794SWWM8/ref=pd_rhf_se_p_img_1?_encoding=UTF8&psc=1&refRID=ZWBPZ3KKHZ5Q4AHQ6802

author: Renate
author_rank: Super Contributor
timestamp: July 13, 2020, 11:30:46 am
content: You can't feed the signal directly into the Arduino if the Arduino can be powered on & off.When the DC converter is switched off the signal will power the Arduino through the protection diodes.Connected as such it's not even a good idea to use two different 5V supplies.If the 5V is only driving the Arduino (and not the relays, see below) you could even just steal the 5V from the gauge circuit.I always get a laugh out of "optoisolated (mechanical) relays".The relay already gives plenty of isolation.Moreover, you're sharing a ground anyway.If you like relays and the relays are powered from 12V, not 5V the current will be less and not a load on the DC converter.If you like relays, I would use a standard 12V relay driven by an N MOSFET by the Arduino.Then if anything blows up you can buy a new relay at any store for €5.If you don't like relays you could do this with a power MOSFET.

author: Lucky-Luka
author_rank: Unknown
timestamp: July 14, 2020, 01:23:08 pm
content: Quote from: Renate on July 13, 2020, 11:30:46 amWhat do you mean?How can I deal with the 12V ON-FF fuel sensor if not using that voltage converter?

author: Renate
author_rank: Super Contributor
timestamp: July 14, 2020, 03:33:30 pm
content: If the 5V to the tank sensor is on and the Aruino is not powered on, the signal that is going into the Arduino will end up powering the Arduino by worming its way internally from the sense pin to VCC.This will drag the signal down.You could put in a series resistor on that pin.Still, the ADC current will be around 100 µA, a 1k series resistor will give you an offset of 0.1 VThe Arduino is going to take maybe 10 mA.My opinion is that it's not worth adding in a DC converter if you've got 5V there.If you have to run a long wire to steal it I might change my mind.Still, you are putting this near the dashboard and the gauges are right there.My advice, if you are using relays, only use 12V relays, not the boards with the 5V ones.How many amps is the pump?Unrelated: Did you ever find out what the resistance of the rest of the voltage divider was?Did you check the voltage on the low side of the sensor to see if it makes sense with the current amount of fuel?

author: Lucky-Luka
author_rank: Unknown
timestamp: July 14, 2020, 06:51:28 pm
content: The ON OFF fuel sensor is a 12V one...I cannot connect it directly to Arduino, right?Regarding the other questions I don't have an answer right now.

author: Renate
author_rank: Super Contributor
timestamp: July 14, 2020, 09:29:33 pm
content: Quote from: Lucky-Luka on July 14, 2020, 06:51:28 pmI don't know what you mean by the on/off fuel sensor.Your diagrams and talk have only covered the resistive sensor.What is this sensor?To sense the presence of a 12V signal you could use a resistor divider plus additional clamping diodes.You could use an opto-isolator, not for its isolating properties, but because it's a convenient current sensor.

author: Lucky-Luka
author_rank: Unknown
timestamp: July 15, 2020, 03:38:46 pm
content: There is a variable resistance fuel sensor and a fuel reserve sensor.I haven't represented it correctly in the schematic. I designed it as a switch because I haven't understood correctly.I attach a proposal for sensing the 12V without damaging Arduino. Is it ok?

author: Renate
author_rank: Super Contributor
timestamp: July 16, 2020, 12:02:04 pm
content: There's something weird with my browser or else the content management here.I click on your resistor drawing and I get the full-size schematic in your first post.The 5V zener is thinking in the right direction, but it's hard to get that voltage to match with the supply voltage.You would want to use a voltage less than 5V but there is still the question of turning on/off the Arduino, isn't there?.I'm still thinking that an optoisolator (despite not being used for its offseting) is the simplest answer.Feed the 12V to a 2.2k resistor to the anode of the LED, ground to the cathode.Connect the emitter to ground, connect the collector to the Arduino and use the internal pullup.I still have no idea what the switch is. Is this a human panel switch or a sensor?

author: Lucky-Luka
author_rank: Unknown
timestamp: July 17, 2020, 07:13:15 am
content: As I said it's not a switch. I represented it wrong because I haven't at the time the right infos.It's a low fuel sensor like this one more or less:

author: Renate
author_rank: Super Contributor
timestamp: July 17, 2020, 11:34:36 am
content: Well, that's not a switch. It's a sensor.Its operation is based on the balance of a NTC thermistor and a PTC light bulb (unless there is a driver circuit).We seem to be running around in circles here.Nothing seems to have solidified since you posted the original schematic.