Hooks into the CE pin of TP4056 to add some extra features - overvolt cutoff - overtime cutoff - overtemperature cutoff (by use of MCP9808) - info on little OLED screen - battery presence detection Future features - current detection and cutoff (waiting for INA219 breakout for this) - Runtime configurable parameters by serial - Send stats over serial to desktop application Known flaws - see readme Circuit schematic coming soon (tm), see readme Designed and tested for nucleo F303RE but should be easily adaptable to any board. License: GPL v3

Dependencies:   OLED_SSD1306 MCP9808

Committer:
kuutei
Date:
Tue Sep 15 03:54:15 2020 -0400
Revision:
10:4ac5d8748268
Parent:
6:8acc92716037
add serialCLI lib

Who changed what in which revision?

UserRevisionLine numberNew contents of line
kuutei 6:8acc92716037 1 Hooks into the CE pin of TP4056 to add some extra features
kuutei 6:8acc92716037 2 - overvolt cutoff
kuutei 6:8acc92716037 3 - overtime cutoff
kuutei 6:8acc92716037 4 - overtemperature cutoff (by use of MCP9808)
kuutei 6:8acc92716037 5 - info on little OLED screen
kuutei 6:8acc92716037 6 - battery presence detection
kuutei 6:8acc92716037 7
kuutei 6:8acc92716037 8 Future features
kuutei 6:8acc92716037 9 - current detection and cutoff (waiting for INA219 breakout for this)
kuutei 6:8acc92716037 10 - Runtime configurable parameters by serial
kuutei 6:8acc92716037 11 - Send stats over serial to desktop application
kuutei 6:8acc92716037 12
kuutei 6:8acc92716037 13 Known flaws
kuutei 6:8acc92716037 14 - When the TP4056 completes the charge (blue LED), the voltage stays at about 4v even when batteries are removed. Without soldering to the blue LED, we can't really figure out when this has happened. So for now, if the charge completes, the TP4056 has to be power cycled or batteries below 3.9v need to be inserted.
kuutei 6:8acc92716037 15 - DS18B20 would be a more suitable temperature sensor, but I simply can't get it working with mbedOS 5 or 6
kuutei 6:8acc92716037 16
kuutei 6:8acc92716037 17 Circuit schematic coming soon (tm)
kuutei 6:8acc92716037 18 - you need a voltage divider for the battery voltage measurement. I did a 1/2 divider using two 10k resistors and it worked pretty well once I figured out how to calibrate readings with the internal voltage reference.
kuutei 6:8acc92716037 19 - To control the CE pin, I had a 470k pullup to the 5V supply of the TP4056 that the F303 would either sink or go high impedance (only up to 3.6v before the protection diode kicks in, as it turns out). This is a bit dodgy with the protected TP4056 variant as you have to manually enable charging briefly to get the protection circuit to output the battery voltage on P+, which is what I was measuring (measuring B+ would work too and may be a better idea). So probably better to have a 3.3v -> 5v level shifter and get the 5V from the nucleo's USB port instead.
kuutei 6:8acc92716037 20
kuutei 6:8acc92716037 21 Designed and tested for nucleo F303RE but should be easily adaptable to any board.
kuutei 6:8acc92716037 22
kuutei 6:8acc92716037 23 License: GPL v3