I am using an April breakout for my dual probe temperature monitor, and after reading two amplifier chips, and writing to the serial LCD backpack, I only have pin 7 remaining. The project has a LiPo battery, and I am using the Adafruit LiPoly charger (v1.2) to handle charging. The charging chip has status output pins for “charging”, and “fully charged”. These are made to use with LEDs or read with a microcontroller. Adafruit has LEDs in the circuit already, and the breakout also has pads for connecting additional components. I want to read the status with the Imp, and display it on my LCD.
The LEDs + resistors (on the breakout) are connected to the status pins and up to 3.3V. My thought is to possibly create a voltage divider of some sort that would vary the voltage based on which status pin was “on”. Then I would set Pin 7 as an analog input and read the signal. Any ideas on this?
This is the datasheet for the charging chip:
I measure 1K resistors connected to the onboard status indicator LEDs on the Adafruit board.
Yes. Both the status pins are open drain, so you’d have (eg) 10k pulled up to 3.3v, to your spare pin 7. Then, from pin7 you would have (eg) 22k to STAT1 and (eg) 47k to STAT2.
If neither stat pin was high you’d read 3.3v on pin 7.
If stat1 was low (active) you’d read 22/(22+10)*3.3=2.26v on pin 7
If stat2 was low (active) you’d read 47/(47+10)*3.3=2.72v on pin 7
If both were low, you’d read (1/((1/22)+(1/47)))/(that+10)*3.3=1.97v on pin 7.
I think I got the calculations right! You will need to account for a little noise, but as you’re only looking to detect 4 states, you can accept pretty wide ranges for each.
You should be able to keep the LEDs on there too, as long as they weren’t taking too much current (ie causing STAT pins to not get close to ground).
Thanks Hugo! Looks that will work perfectly. I wired that circuit out to a breadboard, and with stat1 low (charging), I read 2.46V with my DMM, and of course, 3.3V with the charger unplugged. Just need to get the other two readings and write a little function. Sweet!
If anyone else references this for use with the Adafruit board, and using Hugo’s circuit:
My analog read for unplugged or not charging is 65535.
My analog read for charging is somewhere in the 49000’s.
My analog read for fully charged is in the 58000’s.
I don’t think there is a condition where Stat1 and 2 are both pulled low, so there are only 3 conditions to check for. The readings do vary a bit, so I check for a sufficiently wide range for each.
Seems like the circuit never switches to Full when it is charging and the unit is on, but it will read full if it charges up, and is then turned on. Perhaps I need to bump up the charging current rate?
Are you taking current out of the battery whilst charging? (ie, is your load supplied from the battery?). That will often stop a charger indicating full, because in essence your load is being run directly from the charger output.
Yes, the load is not disconnected from the battery when the charger is plugged in. So let me see if I fully understand. When I am powering the load and charging the battery, the charger is unable to distinguish when the battery is full, because of the constant power going to the load. But, if I disconnect the load and then reconnect it, the charger is able to read the battery level correctly. Does that mean that I might be continuing to fast charge the battery even when it is full, or that I am just confusing the status indicators?
You may be continuing to charge the battery, but it is unlikely to be fast charge. The battery is just acting like a very very large capacitor. The charger, when in CV mode (at end of charge) is acting like a 4.20v voltage regulator, supplying current to the battery (and load) to attempt to keep it at 4.20v.
When the load current drops, so will the charger current. As the voltage never goes above the maximum voltage of the cell, there’s no damage here. The problem is that you’ll never see a full charge indication.
@jwehr, this is an interesting idea. I just came across this forum when I was searching to find a solution to a similar issue with my Adafruit. The information shared by @Hugo is invaluable and I’d like to thank him for that too. However, I was wondering if it’ll be better to keep two different pins for two different statuses. I wanted ask the actual limitation that restricted you to focus on using a single pin.
circuit board manufacturing
The issue was that I only had a single pin remaining on the April after I had read SPI and transmitted to my LCD.
Now of course, I would use a C3V0 board with charging status built right in!