How to read from sensors with ULP in deepsleep?

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
walterheisenberg
Posts: 6
Joined: Sun Jan 27, 2019 11:50 am

How to read from sensors with ULP in deepsleep?

Post by walterheisenberg » Sat Feb 02, 2019 3:18 pm

I want to run my ESP32-board with a battery. To get more battery life, I wanted to read values from sensors when the device is in deepsleep via the UltraLow Coprocessor.
Is that possible in Micropython without writing assembly code?

User avatar
mattyt
Posts: 410
Joined: Mon Jan 23, 2017 6:39 am

Re: How to read from sensors with ULP in deepsleep?

Post by mattyt » Sun Feb 03, 2019 5:19 am

No, you still have to write ULP assembly code unfortunately.

However, it is somewhat easier to use ULP in MicroPython since it's possible to compile ULP assembly at runtime with Thomas Waldmann's py-esp-ulp MicroPython library. This simplifies the build process a little.

There has been some discussion around allowing some subset of MicroPython to target ULP assembly (with a particular decorator over a function perhaps?) but this is quite a lot of work for not a lot of value. The ULP directives are quite primitive so it would be an awkward compilation step from Python to ULP.

So yeah, right now it's still some work figuring out how to use the obscure ULP syntax to interact with your sensors...

Post Reply