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

readme.md

Committer:
kuutei
Date:
2020-09-15
Revision:
10:4ac5d8748268
Parent:
6:8acc92716037

File content as of revision 10:4ac5d8748268:

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
- 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.
- DS18B20 would be a more suitable temperature sensor, but I simply can't get it working with mbedOS 5 or 6

Circuit schematic coming soon (tm)
- 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.
- 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.

Designed and tested for nucleo F303RE but should be easily adaptable to any board.

License: GPL v3