letscontrolit / ESPEasy

Easy MultiSensor device based on ESP8266/ESP32
http://www.espeasy.com
Other
3.29k stars 2.22k forks source link

Add support for IP5306_I2C Lithium charge/power bank SoC #4695

Open TD-er opened 1 year ago

TD-er commented 1 year ago

Modules using the IP5310: https://www.aliexpress.com/item/1005005024692162.html Library/example code to communicate via I2C to this charger/powerbank IC: https://github.com/bheesma-10/IP5306_I2C list of i2c registers available : https://sharvielectronics.com/wp-content/uploads/2021/07/IP5306-I2C-registers.pdf IP5310 datasheet: https://datasheetspdf.com/pdf-file/1139138/Injoinic/IP5310/1 JLCPCB IP5306_I2C: https://jlcpcb.com/partdetail/Injoinic-IP5306I2C/C488349 EEVblog thread discussing similar IP5328_I2C: https://www.eevblog.com/forum/projects/injoinic-ip5328-i2c-register-map/ Datasheet IP5306 as used in M5stack: https://github.com/m5stack/M5-Schematic/blob/master/Core/IIC_IP5306_REG_V1.4.pdf

This IC is a charger + boost step-up converter to 5V The chip can also handle various USB protocols to negotiate for the max. allowed current.

Via I2C one can configure a lot of settings, but also read whether it is being charged or fully charged.

tonhuisman commented 1 year ago

This should probably be a code/functional extension of plugin P138 - IP5306 Power management

TD-er commented 1 year ago

Ah yep, forgot to check whether there was already some plugin for it :)

So I think it should send out events when states have changed, like buttons pushed, battery full, stop/start charging. Well you already have added the "PowerChanged" event.