Hello,
What do I want to achieve:
I want the esp32 to act as a Gatt Server, which advertises in a certain interval and if someone connects then it should work like usual. Due to the fact that I want to power the ESP32 with batteries, I need to put the ESP32, for a optimal power consumption, into deepsleep while the ESP32 is not in advertising mode.
What I've tried to get it to work:
My Code builds on the GATT Server example from espressif. I just added another Profile and changed up some stuff to get a decent understanding of the code.
The following link shows the example I build the code around.
https://github.com/espressif/esp-idf/bl ... through.md
Then I tried to follow that tutorial https://github.com/espressif/esp-idf/is ... -500312453 aswell but I couldnt use the 32khz Xtal Crystal because unfortunately its not on the ESP32-WROOM . With the dynamic frequency scheduling I could achieve some improvements on the average current but not as much as I needed. Before, around 30 mA Iavg and after, around 15mA Iavg ( In both cases 1 sec advertising interval). But even the results from "mywang-espressif" wouldnt be really enough for me ( he had around 2mA to 3mA with a 1 sec advertising interval, because he was able to use lightsleep mode).
Another attempt was to find the right spot in the code to get the controller into deepsleep and let it reboot after a while. I thought of something like that.
Basic schedule of the code looks like that:
Bluetooth Stack init ->GATT init ( add Services, Characteristics...)->wait for Events-> (if a event occurs process it)
I tried to modify it to:
Bluetooth Stack init ->GATT init ( add Services, Characteristics...)->wait for Events->(if a event occurs process it if not go to deepsleep) -> deepsleep -> reboot->Bluetooth Stack init (Loop)-> Gatt init .....
I did some experiments with that but it never worked really well.
What Hard/Software am I using ?
Im using the ESP32-WROOM-32D on a modified breakout board (to be able to measure currents correctly).
For programming I use the Eclipse IDE in combination with the ESP-IDF version v4.0.1-dirty. Its possible for me to debug the application with a j-link from segger.
Questions?
Is there any idea you have how to use the deepsleep mode in the correct way on this application ?
Am I missing anything I can try to get a better result ?
Im really excited to hear your opinion about that problem.
I tried to provide as much information as possible!
Do not hesitate to ask any question !
I just got started with the ESP32 some days ago, so please go easy on me .
best regards
Christian
How to combine Bluetooth Low Energy and Deep Sleep Mode
Who is online
Users browsing this forum: No registered users and 101 guests