I posted in hardware as it's more of a "How batteries will respond/real world hardware limitations" kind of question... sorry if I missed the right forum.
I was thinking of using a Red/Green LED (Well, technically RGB but ignoring the B) as a battery level indicator. The pack is a Li Ion rated at 7.4v, with a low cutoff of 6V and a high of 8.4V.
The concept is to fade red from 255 to 0 when the batt voltage ranges 6v to 8.4v.
Simultaneously fade green from 0 to 255 when batt voltage ranges 6v to 8.4v
In theory, this should give me a visual battery indicator that fades from green, to yellow, to orange and finally in to red as voltage drops.
Although I like the idea, I'm doubtful that battery voltage is a good enough indicator to be even kind of usefull for a Li Ion pack? ( I don't need super accurate results... just a general idea of how much juice is left.)
Anyone tried or heard of that approach? Any idea if it works?
Li-ion batteries have a generally flat discharge curves which make reading the voltage an unaccurate way to determine charge level. The charge capacity is also a function of the discharge rate.
So it probably won't even work as a rough guide then.
OK, next crazy idea..... what about figuring an average run time on my particular battery and basing the color on that?
In this case it's a lightsaber and the heavy draw is when the blade is on, with just some idling current when the blade is off.
So maybe add 100 to a variable every second that the blade is on, then 10 to the variable every second the blade is off (Standby mode) and see about what that variable is when it "dies". (I can probably figure out more precise values by taking live readings with a multimeter.)
It would still be very crude (Current draw will vary somewhat depending on the selected blade color) but maybe would be enough of a ballpark.... unless there's a simpler method I am missing?
Actually, your idea probably will work as a "rough indicator": since you're subtracting 6V or so from the 2-cell reading, the slope of the discharge curve will appear steeper than it does when plotted on a 0-8.4V graph.
And it will give you a more-visible color shift as you get near the full-charge and full-discharge points.
It's not going to give you even the precision of a 10-segment bargraph, but the odds are good enough that it's worth setting up a multi-turn pot and a multimeter to dial through that range of voltages and see how it looks.
Bill... Ehhh, the 2600 mAh 7.4v pack is only going to make it an hour or an hour and a half anyway. It will be running a 10 Watt RGB LED, so it's burn time will be limited by that way more than by the battery indicator. I do think I will have it only come on when the main LED is off, and having it pulse the color (IE.. a "heartbeat") sounds like it would look cool too. It has more "bling" LOL.
Ran.... great idea! I don't know why it never occured to me to just use a pot and actually try it out in advance, LOL. Thanks!
I found this project on the fritzing website and i thought of this thread... Its not exactly what you want but it has its similarities. So this might help, or not, dont blame me for trying