Thanks for the input, what do you mean by A/D and fixed reference? Is 0-1.2volt not too low for the Teensy to read? With this low amount of power, would voltage drop over the length of wire between the front and back of the car be a problem?
You have just raised a completely different problem.
The fact is that in your post #1 you did not accurately describe your problem, which we are trying to solve.
I see several problems.
- You need to know the characteristics of the sensor: its resistance (when the tank is empty and full, and maybe at 0.25, 0.5, 0.75 of a full tank for calibration), the maximum allowable current through the sensor.
- What are the characteristics of the end device? What is its input impedance? Do you need an analog signal or a digital signal? In what range should this signal change?
- What kind of power supply is available to you for electronic devices (12V, 5V, 3.3V or other)?
- Now a new question arises: how far should the signal be transmitted? By what technology (wire, radio, bluetooth, etc.)?
If you do not have answers to these (and there may be other questions), then we will solve an incomprehensible problem and will not receive an answer.
Ok that's a fair set of questions. I'll do my best to elaborate:
The car is a rebuild of a TVR Chimaera, though I am planning to replace the entire wiring loom as part of the build. I will be using the dash that I'm building to read the fuel level (no additional gauge), and it will be sited in front of the driver as an instrument binnacle. The pod I've designed features a Traco Power 2.4A DC-DC converter which gives me a solid and reasonably sized 5v output which powers the Teensy Arduinos, and anything else on the board that requires it.
The fuel tank will be at the back of the car, and is presently a 57L rectangular box which is thin but tall, and is not an odd shape, so the fuel level sender value will be linear as the tank drains. Presently it has an old school float device, and I'm told that TVRs being hand built, some feature 10-180ohm (EU standard) senders, and some feature 33-240 (US standard). I am just thinking though that I may well make a new slightly wider tank to increase capacity, in which case I could put in a new sender, perhaps one of these: https://www.bsmartlooks.com/index.php?main_page=product_info&products_id=158336
This is a US standard range so would be 33-240 ohm.
The wiring run from the back of the car to the front is around 3 metres, and presently I'd be expecting to use 22AWG automotive wire to carry the signal to the sender, then it would ground to the nearest chassis grounding point.
I'm using a Teensy 3.2 which has a 5v tolerant input pin, though reads to 3v3. I currently have it wired on my schematic as such:
GND_____Sender _____________ Teensy Input
| |
124R 100nF
| |
5v GND
All Teensy processors use AFAIK 3.3volt logic,
so you shouldn't power the thermistor/resistor from 5volt.
If you use the simple resistor/thermistor method, and assuming the teensy has a (default) ratiometric A/D, then you need a Steinhart/Hart equation to make readings linear.
Or calibrate by recording A/D values as you slowly fill up, and use multimap() to convert to litres.
Leo..
I thought though that the circuit I have divides the voltage so the Teensy only sees a maximum of 3.3v (even if it goes higher this won't cause damage).
I am reading some thermistors with the same teensy, and on these ones I'm powering using 5v, then have a voltage divider to then scale the 0-5v signal down to 0-3v3. I'm just using a lookup table to convert the voltage profile to a temperature reading and that seems to work very well. I was originally going to do the same here, but the resistance required is so low, I don't think the voltage divider is required, I can just do what I showed above - will that not work?
If you're not powering the sensor (pull up resistor) from the same logic voltage, then the resulting A/D value depends both on temperature and on the variations of the 5volt supply.
Powering it from 3.3volt should cancel out any supply variations (ratiometric behaviour).
Leo..
But surely the 5v signal coming from the Traco Power DC DC converter supplying both the Teensy and the sensor are the same and very stable so would the problem you describe still exist?
Up to you to try that potentially flawed approach.
Leo..
I guess the reason I'm hesitant to do this is that I currently don't have any 3v3 power supply on my board design and I don't have much space for one. I could use the 3.3v pin from the teensy but I don't think it's man enough to do very much, and with this cable length I feel like it may not read..?
Now it has cleared up a little, although not everything.
What is your final sensor choice (10-180, 0-190, or 240-33 ohms)?
What is his resistance when the tank is empty and what is when full.
What gauge on your dashboard will show the fuel level and what signal does it need?
Your circuit with a 125 ohm resistor will work. If this is, for example, a 0-190 Ohm sensor, then the max sensor power will be about 50 mW, which is permissible.
I think you are not quite right.
If you have a Teensy® 3.2 Development Board, then it has a built-in 3.3V power supply with a max load current of 250mA.
Teensy 3.2 has a voltage regulator which reduces the 5V VUSB / VIN power to 3.3V for use by the main processor and most other parts. Additional circuitry may be powered from the 3.3V pin. The recommended maximum for external 3.3V usage is 250mA.
You can also use a separate cheap voltage regulator anywhere you need, such as DC 5V to 3.3V DC-DC Step-Down Power Supply.
Thanks Boffin!
The dash pod I've made has a stepper motor for a dedicated fuel gauge, and a small OLED which I have running on a dummy input right now, so as long as I have a variable in my Arduino code with fuel %full then I have already set up the rest of the system.
If I can, I will use the 30-250ohm US standard as it gives me some options with these new dip tube style fuel senders.
I didn't realise the Teensy had a strong 3.3 feed, that's helpful. So if I were to set this up in place of the 5v feed in the little sketch above, what resistor/capacitor value should I go with?
Your project will be clear soon ![]()
If the voltage from the sensor at the Teensy input is not higher than 3.3V, you can power the sensor from 5V.
When the sensor supply voltage will be 3.3V, the output voltage will decrease. For example, if the voltage is 3.3V and the R2 is 125 Ohm, you will get 0.64-2.2V at the sensor output.
I choose the resistor like this. The R2 should be approximately equal to the resistance of the sensor in average conditions. I think for your circuit this means that tank is half full.
P.S. If you want to play around with the parameters, I can give you an Excel worksheet with formulas.

Ok I see what you're saying. On that basis I prefer the idea of keeping the voltage a bit higher for a stronger signal. So for the moment I think the circuit I had above should be ok.
The only remaining question is should I need to account for the wire length or gauge if it's that long?
The first useful information I found about the KUS sensor.
American Standard 240-33 ohms (240 ohms at empty, 33 ohms at full).
European Standard Output (0 ohms at empty, 180 ohms at full).
You can also choose current control signal, 0-20mA, 4-20mA or Voltage control signal, 0.5-4.5VDC, 0-5VDC (upon request).
This is a new type of sensor, it does not have a potentiometer, it consists of a set of resistors that are switched by means of reed switches every 21 mm. With a length of 350 mm, there are only 16 or 17 different resistance values.
The good news, you don't need accurate measurements.
Connecting a long wire to the Teensy input is another problem.
Wire resistance is not a problem, Teensy has high impedance inputs.
The problem is different. The car has enough high-current circuits to interfere.
A long wire picks up interference like an antenna.
Perhaps a better solution would be to put another small controller in the back of the car and transmit the data digitally in one of the ways.
However, if this were my project, firstly I would try to protect the Teensy input in a manner similar to next.
I know that there will be critics, please suggest a better solution right away.
I think you are on the right track. Personally I would increase R3 to 10k and reduce the 10µF to 1µF.
Keep in mind the physical wiring is very important. The 0.1µ near R3 should be as close to the entrance of the cable wire and ground as possible. Perhaps its good to think of this capacitor as a water seal, if you don't "seal" off the high frequency pickup right as it would enter, it will go all over the place.
I completely agree with you. A pair of 10kΩ + 10μF is also good, because the signal from the fuel sender changes very slowly.
The level sender signal is never stable. Sloshing in the tank makes the level sender go "crazy". You will find you need a lot of filtering to get the "average" level.
I do agree the actual fuel level changes slowly.
Another concern I have about putting a large capacitor directly connected to an arduino pin. If the Vin gets shorted to ground or there is a large load on the Vin supply when Vin is disconnected, the 10µF cap gets discharged to ground through the arduino pin protection diodes. I'll agree it is likely not an issue but its one of the things I learned to never do.
Also the 10µF would have to be a ceramic capacitor not an aluminum electrolytic.
Thanks very much! Is there any way of doing this without having to run a 5v feed to the back of the car just for this sensor? I really liked the idea of having most of the components at one end and a single wire for efficiency but I guess there is no way to avoid spikes?
If I were to go with this solution, could you help me understand what's going on? Particularly around the two diodes and resistor R3?
