The ESP32 has an pulse counting peripheral which would ideal for counting the LED pulses on a electricity meter, unfortunately it does not operate in deep sleep so will consume to much energy to allow for a decent battery life.
Instead I plan to configure an input pin to wake the CPU, which can then increment a variable before going back to sleep. The ESP32 normally executes code from an SPI flash, but can keep a small amount of code in the RTC RAM that can be executed after waking from sleep without powering up the flash, which I plan to use for the variable incrementing code. This means the CPU can be awake for less time saving power.
The ESP32-C3 reference manual indicates that it supports wake on rising edge which would be the best option, however the esp-idf library seems to indicate that it is not supported so I will have to test this.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.