0-12v input. LED output

Hi

I have a question about voltatge to LEDs. This project is for a fule indicator in a gocart.
How it works is when the fuel is low I get a low voltage from the tank.
I have not tried this in real life. I wanted to check here first to see if this is possible as my scetch shows.

I In my picture example I have a DC source that changes from 0-12v insted of a fuel indicator.

Your diagram presumably is missing the switches that control the length of the active portion of the LED
chain?

Having a single resistor means the LED brightness will change as more or fewer LEDS are in the chain as
the voltage across the resistor depends on this.

Using a constant current drive would avoid this.

An arduino uno runs on 9 - 12v and can output to LEDs

MarkT:
Your diagram presumably is missing the switches that control the length of the active portion of the LED
chain?

Having a single resistor means the LED brightness will change as more or fewer LEDS are in the chain as
the voltage across the resistor depends on this.

Using a constant current drive would avoid this.

Thansk for the answer.

But did you read the text or just looked at the picture?

The Fuel indicator in the Tank of the go-cart is outputing 0-12v, depending on the fuel-level.
If the fuel level is low, I want 1 LED lit, if its middle I want half led lit, if its full = 12v I want all LEDs lit.

Using a constant current drive would just put all leds on all the time, right?

noodlespinbot:
An arduino uno runs on 9 - 12v and can output to LEDs

When you use the DC socket.
Here is the OPs circuit.


No it will not work as D3, D4, D5 and D6 are shorted together.
Have you measured the voltage on the fuel sensor for different levels of fullness?
Can you tell us your electronics, programming, arduino, hardware experience?

What do you want a hardwired circuit to do the job, or program a controller to the job?

Thanks.. Tom... :slight_smile:

You have a voltage level proportional to fuel level Personally while the 0 to 12 volts could be divided down and an Arduino used or similar uC there are chips designed to do what you want to do. The LM3914 dates back to maybe early 80s and remains popular today.

This is the data sheet:

For those not data sheet savvy just buy a module for a few dollars (cheap)

A Google of LM3914 Module should get plenty of hits. A single discreet comparator chip is all you need.

Ron

Ron_Blain:
You have a voltage level proportional to fuel level Personally while the 0 to 12 volts could be divided down and an Arduino used or similar uC there are chips designed to do what you want to do. The LM3914 dates back to maybe early 80s and remains popular today.

This is the data sheet:

https://media.digikey.com/pdf/Data%20Sheets/Texas%20Instruments%20PDFs/LM3914.pdf

For those not data sheet savvy just buy a module for a few dollars (cheap)

Lm3914 battery capacity indicator module led power level tester display board Sale - Banggood.com

A Google of LM3914 Module should get plenty of hits. A single discreet comparator chip is all you need.

Ron

Yes, I think thats exactly what I need!
Thanks!

TomGeorge:
When you use the DC socket.
Here is the OPs circuit.


No it will not work as D3, D4, D5 and D6 are shorted together.
Have you measured the voltage on the fuel sensor for different levels of fullness?
Can you tell us your electronics, programming, arduino, hardware experience?

What do you want a hardwired circuit to do the job, or program a controller to the job?

Thanks.. Tom... :slight_smile:

Ok.
If I went the route with Arduino or ESP then? Is there anyway to get 12v -> 5v input. and 6v -> 2.5v? A relative step-down?
Beacuse I also would like to read the RPM of the Go-Cart, and that is the same thing. FULL RPM = 12v, 0 RPM = 0v

freddp:
Ok.
If I went the route with Arduino or ESP then? Is there anyway to get 12v -> 5v input. and 6v -> 2.5v? A relative step-down?
Beacuse I also would like to read the RPM of the Go-Cart, and that is the same thing. FULL RPM = 12v, 0 RPM = 0v

Using a uC like an Arduino you just scale it. Just for example, You make a few simple voltage dividers or be real simple and get a few ten turn trimmer 10K pots. You adjust the pots making them let's say a 3:1 divider so now 0 to 15 volts becomes 0 to 4 volts to an analog input. I allow a little over 12 volts but you can adjust the pots to whatever you want. You have a tach signal of 0 to 12 volts and you have a fuel signal of 0 to 12 volts. If you want to get cool about it you could add cylinder head temperature. You can scale pretty much analog signal into any engineering units you like. Matter of fact put everything in a box and make a dash small console and plop a LCD display in there. Pretty much up to you where you go with all of this.

The other option is using a LED dot/bar display which while lacking the cool factor would also work. :slight_smile: Using a 4 row 20 character column display you can have whatever trips your trigger.

Ron

Ron_Blain:
Using a uC like an Arduino you just scale it. Just for example, You make a few simple voltage dividers or be real simple and get a few ten turn trimmer 10K pots. You adjust the pots making them let's say a 3:1 divider so now 0 to 15 volts becomes 0 to 4 volts to an analog input. I allow a little over 12 volts but you can adjust the pots to whatever you want. You have a tach signal of 0 to 12 volts and you have a fuel signal of 0 to 12 volts. If you want to get cool about it you could add cylinder head temperature. You can scale pretty much analog signal into any engineering units you like. Matter of fact put everything in a box and make a dash small console and plop a LCD display in there. Pretty much up to you where you go with all of this.

The other option is using a LED dot/bar display which while lacking the cool factor would also work. :slight_smile: Using a 4 row 20 character column display you can have whatever trips your trigger.

Ron

Thanks for the great tips.
But can you give me an example of a ten turn trimmer 10K pot? Only thing I can find is manual ones.

Please give me a real example?

And also, would it work if I put a 4.7 kΩ and 6.8 kΩ to get from 12v-0v to 5v-0v?

Is there some deep reason you aren't just driving N leds independently from separate pins, all from 5V,
and using a voltage divider and analogRead() to decide which LEDs to light up?

Is there some deep reason you aren't just driving N leds independently from separate pins, all from 5V,
and using a voltage divider and analogRead() to decide which LEDs to light up?

That is the $64,0000 question.

I would assume the answer is that the question is not arduino related and the OP wants a cheap simple
circuit , rather than an Arduino (which he probably views as overkill).

That being the case, a simple comparator circuit (using a comparator IC or an op amp IC would work.

raschemmel:
That is the $64,0000 question.

I would assume the answer is that the question is not arduino related and the OP wants a cheap simple
circuit , rather than an Arduino (which he probably views as overkill).

That being the case, a simple comparator circuit (using a comparator IC or an op amp IC would work.

No no, I can use a Arduino, or ESP. I have them both here. But helt me understand how I can get from 12v to 5v or 3.3v, and on the same time 10v to ~4v analog input and so on?

From my understanding of voltage deviders is that you get 5v (or what you manually set it to) no mather what the input voltage is over 5v.
Or am I wrong?

No no, I can use a Arduino, or ESP. I have them both here. But helt me understand how I can get from 12v to 5v or 3.3v, and on the same time 10v to ~4v analog input and so on?

From my understanding of voltage deviders is that you get 5v (or what you manually set it to) no mather what the input voltage is over 5v.
Or am I wrong?

Not exactly sure what you mean but it's a simple equation/formula

Vout = Vin x (R2/(R1+R2))

In your case, the knowns are:
Vin = 12V
Vout = 1V to 5V (this is the range I assume of the fuel guage when scaled down from 1 to 12v to 1 to 5V.

Thus 12* (R2/(R1+R2)) = some value greater than 1V and less than 5V

In order to solve this we would need to know what the fuel guage output voltage is when the fuel is LOW.
Currently, this is UNKNOWN.
You would know better than us how to figure that out but if I were there I would just measure it with a
DMM when it reads LOW.

For the sake of discussion let's just say it's 3V.

3/12 = 0.25 (25% of 12V)

Therefore if 0 to 12v is scaled down to 0 to 5v, then fuel low would be 0.25*5V = 1.25V

To put it another way, our objective is to obtain the ratio of 5V/12V = 0.41666 or 41.666% of 12V

So we just say Vin = 12V, Vout = 5V
12k-5k = 7k

12V* (5000 ohms/(5000 + 7000) = 12*(5/12) = 5V (12s cancel) = (12V*5k/(5k+7k) = 5V

If fuel low is 3V from the fuel guage, it should be 1.25V from the voltage divider of R2 = 5k,R1 = 7k

freddp:
Thanks for the great tips.
But can you give me an example of a ten turn trimmer 10K pot? Only thing I can find is manual ones.

Please give me a real example?

And also, would it work if I put a 4.7 kΩ and 6.8 kΩ to get from 12v-0v to 5v-0v?

Spectrol Vishay just as a single example and they are all manual. The idea is set it and forget it. Since an Arduino has a max input A/D voltage of 5 volts you scale your 0 to 12 down to 0 to 5 volts. You place 12 volts for example across the pot and adjust it for 5 volts out between ground (common) and the wiper out. So 0 to 12 volts now becomes 0 to 5 volts.

That or keep it simple with the LM3914 I mentioned.

All of this is a simple matter of what you want?

Yes, using 6.8K and 4.7K off the shelf common resistors will get you close enough. You will actually calibrate it in your code you write. I suggested using a pot rather than a two resistor divider.

Ron

But can you give me an example of a ten turn trimmer 10K pot?

You don’t need a pot. All you need is the voltage divider and an arduino and the one
piece of information you have yet to supply us , which is the voltage the fuel guage outputs
when the fuel is low. Do you not know this information ?
Why haven’t you provided it ?

If you know that , all you have to do is write a sketch to check for that voltage
using analogRead().

Why would you need a pot ?

And also, would it work if I put a 4.7 kΩ and 6.8 kΩ to get from 12v-0v to 5v-0v?

Do the math. (you already have an example)

raschemmel:
You don't need a pot. All you need is the voltage divider and an arduino and the one
piece of information you have yet to supply us , which is the voltage the fuel guage outputs
when the fuel is low. Do you not know this information ?
Why haven't you provided it ?

If you know that , all you have to do is write a sketch to check for that voltage
using analogRead().

Why would you need a pot ?

Do the math. (you already have an example)

You don't need a pot but using one has merit. I can take a 10 turn 10K pot and apply 12 volts across it and adjust it for 5.0 volts on the wiper. Set it and forget it. If you go back and read my post I also said yes, he can just use a few resistors and make a divider. I can buy a 25 turn 10K trimmer for about $2.00 and nail down my divider uncertainty pretty easy. Consider this is a Go Kart project how accurate do we really need be? He covered the ranges and all were 0 to 12 volts both fuel and his tach but did not give the tach upper limit. I clearly pointed out his options. I would use a trimmer pot and the thread starter can use whatever he chooses. I also pointed out if all he wants is a LED bar graph display a 40 plus year old LM3914 will do fine. Up to the thread starter to figure out what he wants.

Ron

I don't see the need to adjust it if you have a voltage divider and you can set your
threshold in software. There's nothing gained.

Yes, and I covered setting the scaling in the code. There is really no threshold to set. The gas level he can indicate however he wishes, the tachometer I would guess RPM. Earlier he mentioned a few resistors for a divider which would do fine. My guess was with 12 volts applied the divider would be about 4.8 volts. Now if I want a divider then with 12 volts applied I want as much of 5.0 volts out as I can get and a pot gets me there. That's why given the options I would go with a pot. Just how I would do it just about all of the options were tossed out there so the thread starter can configure things however he wants.

Ron

freddp:
From my understanding of voltage deviders is that you get 5v (or what you manually set it to) no mather what the input voltage is over 5v.

You are thinking of a voltage regulator, that holds its output at 5V as the input voltage goes higher than 5V.

A POTENTIAL divider, outputs a voltage DIVIDED by the factor set by the resistors.

Trimpot is a manual device that by the use of OHMS law DIVIDES the voltage down, the division factor is constant for your range of voltages, so you only need to set it once in its lifetime.

I hope that clarifies your understanding.
Tom... :slight_smile: