Skip to content
jpajzinka edited this page Sep 25, 2022 · 11 revisions

Welcome to the ESP32-PulseMeter wiki!

I'll try to present here several trick and secrets around catching the pulses, even though it may look like very trivial topic.

Battery optimization

Pulses

When I started experimenting and trying to find the cheapest, simplest and most viable solution, as an interesting option I considered using PCF8583 - a realtime clock chip which can be configured and used as event (pulse) counter. However in practice I found out that chip detect from 5 to 7 pulses instead of 1 (or approx. 6x more). Originally I thought that this can be caused by the fact that the current growth during an event is not linear and that PCF8583 is to sensitive. I was experimenting with and trying to attach various capacitors but this didn't led to solution. This observation was confirmed on ULP based solution, which led me to further googling where I found topic of (magnetic) reed switch bouncing. Basically, when being put into magnetic field, the two tinny metal plates firstly bounce several times (within millisecond) and just then they are permanently connected. This is cause the of multiple pulses being detected with one event.

This behavior needn't be detected (or at least is not regular or typical) when a prototype is testing using a simple push button.

If the pulse detection is implemented using MicroPython interrupts, this behavior can be neutralized using logic which ignores repetitive events with several seconds.

For PCF8583 you can try hardware debuncing, I was never able to solve it this way, also because of limited (real-life) testing capacity (spare gas meter).

For ULP based solution I solved in through tweaking the ULP code.

Clone this wiki locally