Author Topic: How do I program an LED to react differently depending on battery status?  (Read 1069 times)

0 Members and 1 Guest are viewing this topic.

Offline MarmottaTopic starter

  • Contributor
  • Posts: 37
  • Country: gb
So I had a bit of a Google for this and couldn't really find anything, so I thought I'd post it here and see what suggestions people can come up with. I'm making a project using a rechargeable 3.7v battery and a single LED and I really wanted the battery to act differently depending on whether it is in normal operation (constant), low battery (flashing) or charging (maybe pulsing). I thought there would be quite a bit of information on this sort of thing, but there either isn't or I've just been using the wrong search words. I know I could probably create the flashing low battery and pulsing charging LED signals using quite a lot of circuitry for a small project with some timers and a lot of passives, but I was wondering if there's a specific IC or code out there that could take care of everything?
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: How do I program an LED to react differently depending on battery status?
« Reply #1 on: February 24, 2017, 06:21:52 pm »
Almost any microcontroller with an A/D input and enough digital outputs to control the LED.
Maybe just a single 8 pin chip like PIC10F220
http://www.microchip.com/wwwproducts/en/PIC10F220

 

Offline Electro707

  • Contributor
  • Posts: 25
  • Country: us
Re: How do I program an LED to react differently depending on battery status?
« Reply #2 on: February 26, 2017, 12:49:11 am »
You could buy a battery monitor IC like the DS2745
Datasheet: http://datasheets.maximintegrated.com/en/ds/DS2745.pdf
This and some code should get the job done
 

Offline kosine

  • Regular Contributor
  • *
  • Posts: 158
  • Country: gb
Re: How do I program an LED to react differently depending on battery status?
« Reply #3 on: February 26, 2017, 12:06:40 pm »
A cheap 8-pin microcontroller will give you a lot of flexibility for minimal cost and least number of additional components.

If you can use an Arduino, an ATtiny13 would be a good solution. (You just need to install the core13 files and use the Arduino to programme the Tiny13 on a breadboard, only 6-wires required. Long how-to thread here: http://forum.arduino.cc/index.php?topic=89781.0)

An out-of-the-box tiny13 runs at 1MHz and works direct from 1.8V to 5.5V - so just hook up to your battery. (You don't need to burn any bootloader either - just upload the code.)

It also has a convenient 1.1V internal reference for ADC. Divide down your 3.7V with two resistors (maybe 47k and 20k) and you've got your voltage. Use a digital out (or PWM) to drive your LED through a (say) 470R resistor and you're done.

(Output pins can source up to 10mA at 3.7V, though the output voltage may drop to about 3V at that sort of load. A 470R current limiting resistor will give you about 4mA, which should be loads for basic LED. Buffer the output through a transistor if you need more.)

 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf