12v LED gauge project - Page 1
Forum section: electronics / projects

author: WillyB
author_rank: Newbie
timestamp: July 23, 2022, 12:24:11 pm
content: Hey guys,I want to design an LED fuel gauge for my boat (12v) and I'm having troubles getting it nailed.My fuel sender sends 240 ohms at empty and 33 ohms at full.I want a series of 6 LEDs to light up when the sender is at its full range (33 ohms) then as the tank empties and the resistance increases to 240 ohms I want just the last LED to light up.I played with this today and got stuck where the resistor required to be the difference between one LED being on and its neighbour being off was way more than the 240-33 ohms that the sender works with...Can someone please help me understand how I can design this with a diagram if possible?Thank you,Will.

author: pcprogrammer
author_rank: Super Contributor
timestamp: July 23, 2022, 12:32:57 pm
content: Easiest way to do this is to get an Arduino mini or nano and write a bit of software for it.You need to reduce the 12V to 8V to power the arduino, but a 7808 regulator and a couple of capacitors will do this for you.Connect the 6 leds with resistors to 6 gpio outputs and make a voltage divider with the fuel tank sender. (From the arduino's 5V a series resistor with the sender) Feed the output of the divider into an analog input on the arduino.A search on google might even provide you with a sketch for it.Edit: Take a look here:https://arduinointro.com/projects/making-a-led-meter-with-a-potentiometer

author: tooki
author_rank: Super Contributor
timestamp: July 23, 2022, 01:01:01 pm
content: Why 8V specifically? The input range of an Arduino’s DC input is 7-12V. (Though I wouldn’t hook one up to a vehicle’s “12V” supply, since it’s very dirty power with lots of spikes and voltages frequently significantly above 12V.)

author: mariush
author_rank: Super Contributor
timestamp: July 23, 2022, 01:05:21 pm
content: The input is that because most likely it uses a 1117 linear regulator or something similar to produce 5v, and therefore the input voltage must be higher than 5v by at least 1v.Most 1117 regulators have a maximum voltage of 15v so 12v is a sane limit to recommend. It also has to do with power dissipation ( the regulator throws out the difference as heat and there's a maximum amount of heat the chip can dissipate .. 100mA consumed by the chip and things connected to the chip => (12v - 5v) x 0.1A = 0.7w dissipated by the regulator.

author: pcprogrammer
author_rank: Super Contributor
timestamp: July 23, 2022, 01:08:53 pm
content: Because of that I know a 7808 exists and a vehicle voltage where a battery is charged can go up to ~14V.Sure you can use any regulator or even a buck converter to make a voltage between the allowed 7 - 12V, or even make it 5V and connect the arduino via the 5V pin instead of the vin pin.

author: tooki
author_rank: Super Contributor
timestamp: July 23, 2022, 01:13:33 pm
content: Quote from: pcprogrammer on July 23, 2022, 01:08:53 pmThat’s a very different statement from your original, untrue claim that “youneedto reduce the 12V to 8V”.

author: tooki
author_rank: Super Contributor
timestamp: July 23, 2022, 01:15:06 pm
content: Quote from: mariush on July 23, 2022, 01:05:21 pmI know that. That wasn’t my question. He said it needed to be 8V specifically, and I was curious as to whether there was a reason for 8V specifically. Turns out there isn’t.

author: sleemanj
author_rank: Super Contributor
timestamp: July 23, 2022, 01:24:03 pm
content: > Turns out there isn’t.Depends on what you call the "Arduino". If it's an Aliexpress special, then I have possessed "1117" of unknown origin that fail input shorted to output with input over 10v, and in the past seen "Nanos" that have specified 9V maximum input voltage by the seller probably for that reason.8v is a bit of an odd value, but a 9v max is a good recommendation if you don't know where the user is sourcing their goodies.

author: tooki
author_rank: Super Contributor
timestamp: July 23, 2022, 01:27:17 pm
content: Quote from: sleemanj on July 23, 2022, 01:24:03 pmThat is a plausible reason for choosing that voltage. (But his reason was literally “because I know the 7808 exists”.)

author: pcprogrammer
author_rank: Super Contributor
timestamp: July 23, 2022, 03:37:50 pm
content: Quote from: tooki on July 23, 2022, 01:13:33 pmThat is if you interpret my claim as being an absolute necessity, and I could have avoided that by saying "you need to reduce the 12V to ~8V". The intention was to make sure the nano or mini was not directly connected to the boat's power supply.The 8V comes from me having used the 7808 and 7908 in a lot of projects where the input was coming from a 2 x 8V transformer.I know there is a wide range of the 78XX regulators with the most common probably being the 7805.Nowadays with a lot of these buck converter modules on Aliexpress it is probably easier to get one of those and bring the voltage closer to the minimum to reduce heat dissipation in the regulator on the mini or the nano.The original poster might even be quicker in getting something working with one of these:https://nl.aliexpress.com/item/32687750388.htmlA LM3915 dot/bar led driver.https://www.mouser.com/datasheet/2/405/lm3915-443929.pdf

author: floobydust
author_rank: Super Contributor
timestamp: July 23, 2022, 05:29:22 pm
content: OP, some things to think about. I don't think you have enough bars and 10-16 is usually used. Analog IC either LM339's or an LM3914 was popular for this. The boards are cheap on eBay or Ali. For help with your circuit post a sketch. I could find no decent fuel gauge circuits using the LM3914, they are all crap, even going back through old electronics magazines.Irregular shaped fuel tanks givenon-linearlevel sensor readings, so 1/2 tank or 1/4 tank is not where you'd expect it.Fuel slosh is a problem, the level reading will always be moving around and so slow averaging is used.For safety you want no circumstance that leads to dangerous energy flowing to the tank sender or its wiring. An infallible resistor, voltage limiting etc. is used for that protecting the hazardous location aspect.You can use a microcontroller i.e. Arduino - it is easier to do level averaging, low fuel LED, calibration/linearity fixes etc. in software. Since the 12V power is prone to transients you need extra protection in the power supply for the microcontroller. A bit of extra hardware.

author: tooki
author_rank: Super Contributor
timestamp: July 23, 2022, 09:13:21 pm
content: Quote from: pcprogrammer on July 23, 2022, 03:37:50 pmThe primary definition of the verb “need” is to “require”, which is an absolute.

author: Benta
author_rank: Super Contributor
timestamp: July 23, 2022, 09:56:00 pm
content: The easiest way is to use the venerable LM3914. It's still available/active.https://www.ti.com/product/LM3914

author: WillyB
author_rank: Newbie
timestamp: July 23, 2022, 11:41:06 pm
content: Thanks so much for the advice guys, lots for me to consider here.I should have stated that I am most definitely a beginner as far as circuitry is concerned and definitely no programmer.Having said that, I do love a challenge and love to learn!In regards to "fuel slosh", this is something I should have mentioned. Fuel gauges all have some form of delay system in them to avoid the LEDs or analogue needle flying all over the place as the vehicle moves and the sender changes the ohm reading continuously.Would any of you guys be able to help me in regards to the programming, I am an ace with soldering and making in general and can handle all the hardware fitting aspects just fine.Remembering that my empty reading is 240 ohms and my full reading is 33 ohms.I'm happy to pay for help here too... for reference I just completely refitted my boat, replaced every single wire in the thing and digitized the 30 year old equipment, the ONLY thing I haven't yet been able to nail is this fuel gauge!Thanks again!

author: ledtester
author_rank: Super Contributor
timestamp: July 24, 2022, 12:58:03 am
content: Here is an Arduino project to read a 30-240 ohm fuel sensor:https://www.instructables.com/Measure-Fuel-Level-With-Arduino/If the circuitry looks like it will work for you the code can be easily modified to display the level on a series of LEDs instead of the OLED screen.Is your fuel sender currently connected in any way to your boat's electrical system?

author: pcprogrammer
author_rank: Super Contributor
timestamp: July 24, 2022, 04:17:52 am
content: Quote from: WillyB on July 23, 2022, 11:41:06 pmYou are welcome.Quote from: WillyB on July 23, 2022, 11:41:06 pmNot a problem with the Arduino and all the samples floating around.Quote from: WillyB on July 23, 2022, 11:41:06 pmWell there you go, this is a good opportunity.Quote from: WillyB on July 23, 2022, 11:41:06 pmCertainly helpful but also not a big problem if it the signal is to variable. Easy to filter with either a capacitor on the analog input, or a bit of code.Quote from: WillyB on July 23, 2022, 11:41:06 pmSure, why not, as long as it does not become a day jobQuote from: WillyB on July 23, 2022, 11:41:06 pmThat is what the article ledtester referred to also has. There they use a 100ohms resistor in series. When the tank is full this means 5V / 133ohm = ~0.038A. This means ~50mW of dissipation in the sensor. Not a lot, but verify that your sensor can handle that. Also make sure it is safe to apply the 5V via the 100ohm resistor to the sensor. You don't want unsafe situations like floobydust mentioned.Quote from: WillyB on July 23, 2022, 11:41:06 pmI will leave that up to you when and if you are happy with the help. Not needed but a gift is always nice.

author: WillyB
author_rank: Newbie
timestamp: July 25, 2022, 10:14:13 am
content: Ok so I'm thinking of taking this in a different direction.I just found that the fuel gauge I currently have has a 90-10 ohm input level, empty to full respectively.So I would like to build a sender to suit.I know about the ohm converters available but unfortunately it wont work due it sending a negative to the unit.Anyway, what I want to do I'm hoping is relatively simple, I want to make a fuel sender that operates in the desired 90-10 ohm range.It cant take or hold current, just a simple variable ohm resistor.This is what the current one looks like:https://www.boataccessoriesaustralia.com.au/kus-s5-tank-fuel-liquid-level-sender-240-33-ohms?gclid=Cj0KCQjw_viWBhD8ARIsAH1mCd5IKYX_9bgz2rEtRBF4aURXhN7xmtTxSgssUAWMqL9QuW8C6zpOU4QaAjKBEALw_wcBAs there are no external wires (exposed to fuel) I assume it works on a magnetic charge?This is what I want to create.Unfortunately there is no off the shelf fuel senders that I can jjst buy..... but love a project!Anyone know how to make a variable ohm resistor like the above?

author: pcprogrammer
author_rank: Super Contributor
timestamp: July 25, 2022, 10:55:18 am
content: So your fuel level sender that is in the tank as is now has a 90-10 ohm range instead of the 240-33 ohm range of the one you linked to.And what you need is a device that measures this resistance without a "lot" of current running through the sender.I guess it can still be done with an Arduino or an LM3914/LM3915, but an amplifier would be needed. With a small current of say just 1mA through the sender the voltage difference is not that big, 10mV - 90mV, and to measure this with the Arduino an opamp with a gain of lets say 20 will bring it up enough. The only problem can be noise, but since it is a slow varying signal a bit of filtering will take care of that.But maybe there are other ways of doing it?Also a couple of pictures of the tank, the sender and the dashboard might give some insight in what is needed cabling wise.

author: ledtester
author_rank: Super Contributor
timestamp: July 25, 2022, 02:58:18 pm
content: Quote from: WillyB on July 25, 2022, 10:14:13 amApparently there are products to interface otherwise incompatible senders and gauges:https://www.tanksinc.com/index.cfm/page/ptype=product/product_id=748/category_id=184/mode=prod/prd748.htmhttps://www.summitracing.com/parts/cin-sn34Found these from this page:https://www.vintage-mustang.com/threads/converting-90-0-ohms-to-0-90-ohms-on-fuel-sending-unit.1177890/And there are a bunch of 0-90 fuel senders (0 empty, 90 full), e.g.:https://www.amazon.com/proSPORT-Fuel-Level-Sender-0-90/dp/B07JDVB774/And then I found electric programmable fuel gauges like:https://www.amazon.com/Auto-Meter-4310-Ultra-Lite-Programmable/dp/B001G8J5GAQuoteUpdate: And here is a another idea I found on electronicspoint.com:

author: floobydust
author_rank: Super Contributor
timestamp: July 25, 2022, 05:50:28 pm
content: Quote from: ledtester on July 25, 2022, 02:58:18 pmUse the tank sender to send to a voltage to an Arduino to drive a servo motor to drive a potentiometer? Seems like not the best way to goOP, you'll have to see how much current is required for the gauge to read full scale. 90F-0E is a Chevrolet sender. I think the best way to go is using an MCU.

author: pcprogrammer
author_rank: Super Contributor
timestamp: July 25, 2022, 06:45:52 pm
content: Still leaves the problem of how much current it can take.For what I understood from what the original poster linked to it works with reed contacts to set the resistance according to the level of the float. I guess the float has a magnet to activate the reed contact. Even though the electric circuit is isolated from the fuel you still can't switch to high a currents.

author: james_s
author_rank: Super Contributor
timestamp: July 25, 2022, 06:52:43 pm
content: If you want to use an arduino, just use the actual arduino for prototyping and then build a final design with a bare atmega microcontroller. All you need to make it an arduino is the arduino bootloader. Then you can use a good quality automotive grade linear regulator and you won't have to worry about dropping the voltage.I agree that the bargraph driver IC is probably the simplest though, all you need is a resistor divider to convert the output of your sender to a variable voltage.

author: Zero999
author_rank: Super Contributor
timestamp: July 25, 2022, 09:57:16 pm
content: I doubt 50mW or even more of power dissipation would be a problem.Here's a product which could be added to the Ardunio to make a simple fuel gauge.https://wiki.seeedstudio.com/Grove-LED_Bar/

author: Zero999
author_rank: Super Contributor
timestamp: July 26, 2022, 08:59:23 am
content: If you don't want to do any programming, then use comparators. The LM339 has four, so you could use two of those.R15, R16, C2 & C3, from a filter.The resistor values can be changed to accommodate different sensor resistance values. I'm confused about what sensor you're using now, so just designed for 33R to 240R. If you need 10R to 90R, change R1 to 270k.

author: tooki
author_rank: Super Contributor
timestamp: July 26, 2022, 04:49:51 pm
content: Quote from: james_s on July 25, 2022, 06:52:43 pmExcept that you won’t be able to actually get one of those till well into next year. At work, we just switched a project from Atmega328P to a RPi Pico because the earliest ship date for the Atmega was April 2023, which is no good for a Christmas gift. (It’s a little digital bubble level as a client gift.) Using the whole Pico board also means we get the buck-boost converter — another class of component that’s been in short supply.

author: james_s
author_rank: Super Contributor
timestamp: July 26, 2022, 06:09:44 pm
content: Quote from: tooki on July 26, 2022, 04:49:51 pmWell there are lots of other micros supported by the Arduino ecosystem, surely at least some of them are available? This sounds like a one-off project so I would expect it shouldn't be too hard to find something.

author: floobydust
author_rank: Super Contributor
timestamp: July 26, 2022, 06:29:29 pm
content: If you are interfacing with the old analog gauge, I have done that with the MCU driving a 4-bit resistor DAC. Four transistors and medium power resistors to indicate say 16 different fuel levels. PWM alone makes noise with the gauge so I had hassles there and abandoned the idea.

author: Zero999
author_rank: Super Contributor
timestamp: July 26, 2022, 07:18:11 pm
content: Whilst the LM3914 is nice, it's expensive and probably won't be around forever.As far as microcontrollers are concerned: I'd probably just get what I can get. Availability is a problem at the moment.Here's the 10 to 90 Ohm version of the comparator circuit simulated. It shows the current though the LEDs as the resistance (X axis) is swept from 10R to 90R, as the tank empties. The full and empty thresholds are shown on as red and green lines. They're set just before the tank is full/empty, to give some warning and for reliability and stability's sake.

author: tooki
author_rank: Super Contributor
timestamp: July 26, 2022, 07:48:44 pm
content: Quote from: james_s on July 26, 2022, 06:09:44 pmAll of the Atmegas are sold out for ages. Same with STM32s. What are plentiful are the RP2040 (RPi Pico) and the ESP32 series.Arduino-compatible Atmega dev boards (Arduino and XMINI) and STM32 boards (Nucleo) are readily available, but probably exactly due to their Arduino-driven popularity, the MCUs used in them are not.

author: james_s
author_rank: Super Contributor
timestamp: July 26, 2022, 10:43:38 pm
content: Quote from: floobydust on July 26, 2022, 06:29:29 pmIt doesn't sound like what he's trying to do, but if you did want to do that and noise was a problem, I would think you could use a much lower PWM rate, like just a few Hz. The response rate of the old style fuel gauges is pretty slow.

author: floobydust
author_rank: Super Contributor
timestamp: July 26, 2022, 11:52:57 pm
content: My understanding OP has a 240ΩE/33ΩF tank sender and wanted to use an LED bargraph for the gauge.But now is wanting to use that sender with a 90ΩF/0ΩE gauge, which is inverted- as low current reads full I believe.I found if you use low freq. PWM the gauge needle can appear blurry, wiggle and higher it makes a buzzing/ticking sound. With higher frequency PWM it squeals.I did not go ultrasonic due to EMI. I think newer gauges respond faster. It depends on the gauge inductance but I did get it in continuous mode at a few hundred Hz which was quieter. In the end the DAC worked for the carmaker. People don't really discern better than 1/16 I guess.OP I don't see much for fuel gauge circuits that are reliable. There's lots of cute Arduino builds but they're missing protection and an analog gauge driver.The LM339 LED bargraph circuit looked best and it could be changed to drive an analog gauge with some thought.

author: themadhippy
author_rank: Super Contributor
timestamp: July 27, 2022, 12:24:08 am
content: How about using an Lm317 with the sender taken the place of the usual pot,that should give a usable voltage range to feed a meter,a LM3914 or a micro

author: Zero999
author_rank: Super Contributor
timestamp: July 27, 2022, 09:11:49 am
content: For minimal current through the transducer, the circuit I posted previously can be used with R1 = 4M7, R7 = 6k8 & R8 = 16k. I wouldn't recommend going much below 750µA because the voltage drop across the sensor will be too low compared to the maximum LM339's offset voltage of 4mV.I'm confused about what the OP wants to do. Is it still to build a new fuel gauge, or design a circuit to enable a 10R to 90R meter to be used with a 30R to 240R sensor? It's possible to build a circuit to scale one resistance value to another, but it's very inaccurate at low voltages.

author: pcprogrammer
author_rank: Super Contributor
timestamp: July 27, 2022, 09:38:09 am
content: I don't know what the original posters idea is, but your setup is an easy way to get it working with either the 240-33 or 90-10 like he mentioned in his last post.Quote from: WillyB on July 25, 2022, 10:14:13 amDoes not matter what is full and empty, because that is just using the leds in a different order. And by tweaking the resistors for the comparators the thing can be adjusted to the wanted levels.Nice example of software versus hardwareEdit: re reading things made me realize that he has an actual gauge that is intended for 90-10 ohm sender and his tank has a 240-33 sender unit.So that would mean that he needs to convert between the two. The question then is what voltage levels this gauge requires. Or can it be done by just putting a transistor or fet in series with the gauge and make a control signal to input to the transistor or fet?

author: Zero999
author_rank: Super Contributor
timestamp: July 27, 2022, 01:57:56 pm
content: It's possible to use an op-amp to scale the resistance down, but not cover the full 10R to 90R range with 240R to 33R in, without a complex circuit.This will give 13.5R to 91R out from 33R to 240R in. There must be 10s of mA through R_OUT which needs to be 4V or so below +V, otherwise it won't work properly.