Go Down

Topic: Help with Lm3914 (Read 626 times) previous topic - next topic

tjones9163

Hello, i recently purchased the LM3914 dot/bar graph ics. I have gotten this basic circuit from https://www.electronicshub.org/battery-level-indicator/ that i will attach below to work with a 12v battery and i am trying to better understand how it works down to each component. I have looked at the LM3914 datasheet which was a bit confusing
but here's what I'm pretty sure i know about this chip.

The chip takes an analog voltage and proportionally drives 10 LEDs to show the battery level. If i am at a full 12v then all 10 leds would be on. Now from what i understand from this circuit, it actually measures from 1.2v to 12v ( giving you 10 steps or LEDS). Now from what i have seen from other circuits you can actually offset the voltage to measure from 3v to 4.2v for lets say a 18650, but because the Adjust pin is connected to ground so it measures from 0v all the way to 12v.
I think with resistors you can set brightness, the low-end voltage and high-end voltage to set your required voltage range

I don't get exactly how the low-end and high-end pins work exactly and I don't fully get how the adust pin works either.

Can someone give an easy to understand a simple explanation of how this chips pins work and maybe show the math if i wanted to set the voltage range from 3v to 4.2 ( If thats not too much to ask for).

Wawa

Look at the diagram on page 8 of the datasheet.
You see a voltage divider (string of 1k resistors) inside the chip.
One end of the string is connected to a reference voltage, and the other end (normally) to ground.

R2 in your diagram increases the value of the bottom resistor to 18k+1k= 19k.
That "lifts" the reference voltage on the lowest opamp (first LED) to 19/(19+9) * Vref, or ~68%.

Note that the chip will overheat/shutdown of you power it from 12volt and drive more than a few LEDs.
12volt LED power is ok in dot mode, but not in bar mode.
Leo..

tjones9163

Look at the diagram on page 8 of the datasheet.
You see a voltage divider (string of 1k resistors) inside the chip.
One end of the string is connected to a reference voltage, and the other end (normally) to ground.

R2 in your diagram increases the value of the bottom resistor to 18k+1k= 19k.
That "lifts" the reference voltage on the lowest opamp (first LED) to 19/(19+9) * Vref, or ~68%.

Note that the chip will overheat/shutdown of you power it from 12volt and drive more than a few LEDs.
12volt LED power is ok in dot mode, but not in bar mode.
Leo..
In the string of comparators, are the comparators the same value or how does it not activate them all at once.

For my r2 resistor, where does the extra 1k come from?

Also im still not 100% positive what the reference voltage does?

Thanks for response!!!

Wawa

In the string of comparators, are the comparators the same value or how does it not activate them all at once.
Reference voltage is divided equally over the string of 1k resistors.
10% on the first tap, 20% on the next tap, 30% on the next, etc.
The comparators each compare input voltage (the battery) to the voltage on their tap.
If a comparator senses that input voltage is higher than their tap voltage, the corresponding LED is turned on.
It should be clear that the comparator with the lowest tap voltage is the first to turn on when input voltage rises.

For my r2 resistor, where does the extra 1k come from?
There is already a 1k resistor between the string and RLo (pin4).
Adding 18k between Rlow and ground will turn that 1k resistor into a 19k resistor.

Also im still not 100% positive what the reference voltage does?
Think old fashioned balance scales.
You put a calibrated weight on one side (the reference) and the product on the other side.
When it tips, then you know the product is heavier than the reference.
Leo..

tjones9163

Reference voltage is divided equally over the string of 1k resistors.
10% on the first tap, 20% on the next tap, 30% on the next, etc.
The comparators each compare input voltage (the battery) to the voltage on their tap.
If a comparator senses that input voltage is higher than their tap voltage, the corresponding LED is turned on.
It should be clear that the comparator with the lowest tap voltage is the first to turn on when input voltage rises.
There is already a 1k resistor between the string and RLo (pin4).
Adding 18k between Rlow and ground will turn that 1k resistor into a 19k resistor.
Think old fashioned balance scales.
You put a calibrated weight on one side (the reference) and the product on the other side.
When it tips, then you know the product is heavier than the reference.
Leo..

awesome explanation. A true help

friedlbasson

Hi -

This is exactly what I need as well.  I managed to get the basic range of 0V-5V working but anything below 3V not much help when you use LiPo as PSU.

Did you manage to calculate the values for R1 and R2 to get voltage range of 3V to 4.2V?  I would sincerely appreciate your help.

Regards,
Friedl.

tjones9163

Hi -

This is exactly what I need as well.  I managed to get the basic range of 0V-5V working but anything below 3V not much help when you use LiPo as PSU.

Did you manage to calculate the values for R1 and R2 to get voltage range of 3V to 4.2V?  I would sincerely appreciate your help.

Regards,
Friedl.
Where did u find out the values of the resistors to get a range of 0-5 v? The schematic i showed is meant for 12v, but if you go to the site that i linked it says it will work with 1-12v which i weird because 12v batteries voltage drops off sharply when it is near discharged. So i am guessing that all at once the leds would turn off instead of one by one. Let me know if you get how the math works because i was not able to figure it out.

friedlbasson

Hi -

On the data sheet of the LM3914 IC are some examples, but they all based on the assumption that you want to measure voltage to 0V. 

https://cdn.sparkfun.com/datasheets/Components/General%20IC/lm3914.pdf

See page 2

Also see;

https://learn.sparkfun.com/tutorials/dotbar-display-driver-hookup-guide
https://www.google.co.za/amp/tronixstuff.com/2013/09/14/tutorial-lm3914-dotbar-display-driver-ic/amp/

Again they work with 0V-5V and explain how to set lower and upper voltages but I have not been able to calculate the resistor values needed for this. Quite new to electronics, so still learning many things.


I have found that the LED's turn off anything below ±2,6V anyway.  Regardless, MC's does not seem to like voltage below 3.1V so for all practical purposes, I want to consider voltage below 3.1V to be 'depleted'.  Hence my need for a custom range of 3V to 4.2V

Hope someone can help... If I mange to figure it out, I will be sure to post.

Wawa

Calculating resistor values for LED current and range is not that hard.
Start with display range.
I would suggest (10) switchpoints of 3.2volt to 4.1volt.
The top LED will then be 4.1 to 4.2volt (>4.1), and you have nice human-understandable steps of 0.1volt.

So Rhi (pin6) of the internal resistor string must be 4.1volt,
and Rlo of the string (pin4) must be 3.1volt (there is an extra 1k resistor at the bottom).

To get that 4.1volt on Rhi, we must use a voltage divider on pin 7,8 (see datasheet page9).
The resistor ratio sets the voltage on Rhi (pin7), and resistor values sets LED current.
Led current is about 10x of that voltage divider current.

Because voltage on pin8 is constant (1.25volt), we can pick that resistor value first.
A 1.25k resistor results in 1mA through that resistor (~10mA LED current).
1.25volt across R2 means 4.1 - 1.25 = 2.85volt across R1, or a 2k85 resistor for R1.
You must stick to that ratio (1.25:2.85), but values don't have to be exactly that.

We know that every internal 1k resistor drops 0.1volt, so it's easy to calculate the resistor from Rlo (pin4) to ground. 3.1volt = 31k.

LED supply must at least be 1volt more than Vf of the LEDs, so no high-brightness or blue/white LEDs if you also power the LEDs from that LiPo battery.

Hope this helps.
Leo..



BabyGeezer

check out GreatScotts's YouTube video on exactly this topic !
https://www.youtube.com/watch?v=rZq2v7two1s
Attach your images to be viewed directly - THIS WAY;
https://forum.arduino.cc/index.php?topic=519037.0

friedlbasson

Hi -

Great, thank you fore the help. it is much appreciated!!

Regards
Friedl

friedlbasson

Hi -

Sorry last question, I assume " 2k85 resistor for R1" is a typo?  Am I correct in assuming it should be 28.5k.

So R1 = 28.5k and R2 = 31k ?

Also that fact that I did choose blue LED's did not help my case  :smiley-sweat:   Will change to green and red.

Thank you again for taking time to help.  Being new to electronics can be quite daunting and a lot to learn, but helpful and patient people make a a lot easier  :)

ps: attached isn the schematic I used to build the indicator.  I then incorporated it with the rest of my project.

Regards, Friedl.

Wawa

Not a typo.
4.1 - 1.25 = 2.85

In your diagram, 1.25volt is across the 3k3 resistor,
so (2.2 + 3.3) / 3.3 * 1.25volt = 2.08volt is on Rhi.
Not what you want for a LiPo battery.

1k2 for R2 and 2k7 for R1 comes close.
(1.2 + 2.7) / 1.2 * 1.25 = 4.0625volt on Rhi, and 1.25/1k2 * 10 = ~10.4mA LED current.
Leo..


friedlbasson

Not a typo.
4.1 - 1.25 = 2.85

In your diagram, 1.25volt is across the 3k3 resistor,
so (2.2 + 3.3) / 3.3 * 1.25volt = 2.08volt is on Rhi.
Not what you want for a LiPo battery.

1k2 for R2 and 2k7 for R1 comes close.
(1.2 + 2.7) / 1.2 * 1.25 = 4.0625volt on Rhi, and 1.25/1k2 * 10 = ~10.4mA LED current.
Leo..


Hi Leo -

Indeed, the diagram is based on 5V PSU.  I will adjust my resistors. My apologies for not know the method of writing 2.85 kilohm :)  Learning as I go along.

I will adjust my resistor values as you mentioned before to 2k85 on R1 and 31k on R2. Thank you for explaining.

Kind Regards,

Wawa

#14
May 20, 2019, 10:47 am Last Edit: May 20, 2019, 10:48 am by Wawa
Common resistors come in E12 and E24 values (Google it).

I gave you two common values, 1k2 (1200 ohm) and 2k7 (2700 ohm).

Much easier than trying to find, or make (from combined values), 1250 ohm and 2850 ohm.
Leo..

Go Up