pschatzmann / arduino-audiokit

Arduino ADF/Audiokit HAL (support for ESP32-A1S, AI-Thinker, LyraT for ES7148, ES7210, ES7243, ES8311, ES8347, ES8388, TAS5805M, AC101 audio chips)
GNU General Public License v3.0
153 stars 40 forks source link

Power management of ES8388 using audio-kit lib #77

Closed HosseinKasaei closed 1 year ago

HosseinKasaei commented 1 year ago

Hi,

I've designed a custom board including ES8388 and ESP32. My board is used for a BLE application and is supplied by a battery so the power management is very critical. I'm using audio-kit library and I want to be able to turn on ES8388 whenever is needed and turn it off most of the time to save power. Tried to use kit.end() but no luck. The current consumed in different situation is as follows :

1- kit is not configured in the main() : 48 mA 2- kit is configured in the main() and it's always turned on : 90 mA 3- kit is configured but I use kit.end() when a callback occurs and current drops to : 80 mA

I was expecting the current in 3 to be the same as 1. Is it something about ESP32? maybe running kit.begin() is turning on somethings in it that kit.end() won't turn them off? Another experiment was that I turned off the power of ES8388 (it is powered by a LDO) and the current increased up to 100mA ! so I think there is something wrong with the esp.

pschatzmann commented 1 year ago

Hmm, difficult to say what this could be. You can set the log level to debug and double check the methods which are called.

Maybe it's worth to check if the calling the following methods makes a difference

HosseinKasaei commented 1 year ago

Thanks I tested these methods and the results were actually very good ! I have 20mA decrease with es8388_pa_power(false) and 5mA when Wire1.end() is called which left me with a current consumption of 55mA. Still can be improved because I have around 46mA when ES8388 is not configured at all. I'll appreciate any another idea and if I find by myself I'll share it here. Thanks again :)

pschatzmann commented 1 year ago

So I suggest to set the logging to debug and check if es8388_deinit(void) is called. This should shut down the audio chip...

HosseinKasaei commented 1 year ago

Here is the log. es8388_deinit is called :

Capture

pschatzmann commented 1 year ago

I just double checked the code, this should also shut down the Wire1, so I guess the 5 mA are just measuring differences.

I will add the shut down of the power amplifer into the end() method.

Apart from this I don't see where the difference could come from...

pschatzmann commented 1 year ago

Just another idea: if you do not use the SD drive make sure to deactivate it

HosseinKasaei commented 1 year ago

Just another idea: if you do not use the SD drive make sure to deactivate it

Yea I have deactivated it already

pschatzmann commented 1 year ago

I am closing this issue because I don't see anything which could be wrong...