Skip to main content

Timeline for Battery Tester Circuit with 3 LEDS

Current License: CC BY-SA 4.0

20 events
when toggle format what by license comment
Jul 3, 2018 at 8:28 vote accept Max
Jul 2, 2018 at 4:54 history edited Max CC BY-SA 4.0
edited body
Jul 2, 2018 at 3:46 history edited Max CC BY-SA 4.0
Changed the schematic based on recommendations and changed components used.
Jun 29, 2018 at 6:17 comment added Bimpelrekkie ATMEGA328P uses about 5mA when active running on 8MHz at 3.3V That's true however it will not be running in that mode all the time. It might be in that mode for say 10 ms after you press the button. The rest of the time it will be in sleep mode. If you account for that then current consumption is much lower than 5 mA. I made a gadget which shortly wakes up every 8 seconds, it lasts at least a year on 2 AA batteries. On average power consumption is ledd than 50 uA I think.
Jun 29, 2018 at 3:46 comment added Max @RemcoVink Based on my research, the discharge graph changes significantly based on different type of batteries but there are quite a lot which stays steady for most of its capacity. However, I couldn't find any other simple way of measuring the battery level, do you know any that you could recommend?
Jun 29, 2018 at 3:44 comment added Max @Bimpelrekkie Regarding the power consumption, correct me if I'm wrong. The ATMEGA328P uses about 5mA when active running on 8MHz at 3.3V, whereas based on the datasheets of this circuit the components only use about 40uA when active. In addition to that, the LoRa module in my circuit will be connected two the only two interrupt pins of the ATMEGA328P. Secondly, thanks for spotting the mistake in the diagram I have corrected it.
Jun 28, 2018 at 13:26 comment added Remco Vink I could be mistaken, but if I remember correctly the discharge curve of a AAA is almost flat for most of the graph, meaning that apart from the beginning and end the voltage probably won't change that much. Therefor it will be quite tricky to get accurate readings. Will it be a crude indication on if the battery is full, empty or somewhere between 20 and 80% sure. But if you want something more accurate you might need a different approach.
Jun 28, 2018 at 12:33 answer added HandyHowie timeline score: 0
Jun 28, 2018 at 11:38 answer added Elliot Alderson timeline score: 0
Jun 28, 2018 at 11:04 answer added danmcb timeline score: 2
Jun 28, 2018 at 10:50 comment added danmcb even then you might have issues if the switch pole with Vbat closed a bit before 3V3 . A diode to ensure that Vbat is never more than 0.7V above 3V3 would be wise. Otherwise you might get annoying chip failures every now and again. I will add an answer with a sketch so you can see what I mean.
Jun 28, 2018 at 10:41 history edited Max CC BY-SA 4.0
Fixed Schematic Drawing
Jun 28, 2018 at 9:56 comment added danmcb well spotted Bimpelrekkie. This could be solved by using a 2 pole switch, and switching both Vbat and 3V3.
Jun 28, 2018 at 9:54 comment added Bimpelrekkie @dmb is right, the dots should not be there! Also, I see another issue (yes even though I said it looked fine) there will be a current flowing into the inputs of the comparators when they have no supply voltage! This current is caused by the ESD diodes between inputs and supply pins. You should be very careful when applying a voltage to chips that do not have a supply voltage! See the EEVBlog video about this: youtube.com/watch?v=2yFh7Vv0Paw&t=3s and yes that applies to all chips not only micros.
Jun 28, 2018 at 9:47 comment added Bimpelrekkie which will cause it to draw more power If you'd use an interrupt to wake up the ATMEGA you can let it sleep until the button is pressed. In my view if using the ATMEGA for this uses more power than the comparator solution, you're doing the ATMEGA solution wrong.
Jun 28, 2018 at 9:47 comment added danmcb nice circuit - simple and elegant if you don't mind the component count. But - where the output of the switch goes to XOR2, the vertical wire - are those nodes to the battery output? Looks like a diagram error. That shorts the battery to the 3.3V.
Jun 28, 2018 at 9:45 comment added Jasen Слава Україні if you use common anode red-green LED you only need two comparators, (and no gates) but you'll annoy the colour-blind.
Jun 28, 2018 at 9:39 comment added Max Thanks, that was actually my backup-plan. However, I'm trying to avoid using the ATMEGA as it will require it to wakeup from sleep mode and run a code which will cause it to draw more power.
Jun 28, 2018 at 9:12 comment added Bimpelrekkie That will very likely work fine. However, since an ATMEGA328 is already there, I would just connect the battery to an analog input and write some code that does the measurement when you press the button (also connected to the ATMEGA328). This of course assumes that you still have some pins left on the ATMEGA.
Jun 28, 2018 at 8:49 history asked Max CC BY-SA 4.0