Xinyuan-LilyGO / LilyGo-T-SIM7080G

47 stars 24 forks source link

Bringing the board back online when re-charging a depleted 18650 battery #64

Closed Peer77 closed 3 months ago

Peer77 commented 5 months ago

Hi Lewis,

when comparing the LilyGo SIM7080G board with the SIM800L, I observed the charging / repowering of SIM7080G is proceeding differently when the 18650 battery is discharged completely and the device went off. Please see the following scenario.

Behaviour of SIM800L:

-> Is there a way to apply this behaviour to the SIM7080G as well?

Current behaviour of SIM7080G:

-> Is there a way to change that so it comes back online automatically? Or is it possible to set a higher threshold by using PMU.setLowBatShutdownThreshold() to shut down the board earlier to have sufficient power for booting up when the power grid comes back? The battery I used for this test was discharged by the board to 2.4V.

Many thanks! and best regards,

Peer

lewisxhe commented 4 months ago

If it is lower than the PMU operating voltage, the PMU must be turned on manually. You can set the low voltage alarm to trigger the PMU interrupt to shut down in advance or enter sleep mode to save power. I have uploaded a simple test example, I hope it will be helpful to you. https://github.com/Xinyuan-LilyGO/LilyGo-T-SIM7080G/commit/6786ce7676114f2b5d3def207e04c0343b5fbccb

Peer77 commented 4 months ago

Hi Lewis, thank you very much, I will check and report back...

Peer77 commented 4 months ago

Hi Lewis,

thank you for the example code. Your code brought some inspiration. So I have written a small function to simply check against the return value of PMU.isVbusIn(). If powergrid goes down it returns false, and after a 1 minute I then call PMU.shutdown();. Feeding back the PSU / 5V to the pad where the diode was mounted, the device comes back online as normal. Works fine! Just to confirm, the board is really switched off after calling PMU.shutdown(), right?

Thanks!

Peer77 commented 3 months ago

Resolved, closing.