emonTH sleep vs pulse count?

Hello, Does the emonTH still count meter pulses when it’s sleeping ?

Dave

From section 12 of the ATMega 328P data sheet:

“Pin change interrupts on PCINT23…0 are detected asynchronously. This implies that these interrupts can be used for waking the part also from sleep modes other than Idle mode.”

So as long as it is sleeping and not idling, the interrupt will wake the processor. So no, it doesn’t count pulses while it is sleeping, because it’s just been woken up by the pulse. :roll_eyes:

It then sleeps again until another pulse wakes it or it’s time to make and transmit a reading.

(If you think about it, if it didn’t wake on a pulse, it wouldn’t work.)

That’s more or less what I thought, I think the code wakes up every 60 seconds to send data. But as you say, pulses would wake it up in between - I think.

Dave.

Correct, as Robert said the pulse counter uses a special “Interrupt” digital input that wakes up the processor from sleeping when a pulse is detected. See:

https://learn.openenergymonitor.org/electricity-monitoring/pulse-counting/introduction-to-pulse-counting

https://learn.openenergymonitor.org/electricity-monitoring/pulse-counting/interrupt-based-pulse-counter-sleep