Skip to content
jpajzinka edited this page Feb 9, 2023 · 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.

ESP32

Right now I am using following dev. board "LoLin 32 ESP-WROOM-32 2.4GHz Dual-Mode WiFi+Bluetooth", mostly because ESP32 is annoying to solder, and this board seems to be the most optimal from power consumption aspect.

Cleaner ESP32 solution

20230131_165329

Battery optimization

For battery monitoring I tested 3 ways how to measure the voltage, 1st just on code start, 2nd on he begining of "client" method and 3rd just after 300ms sleep. This is the result:

image

So apearently 1st place is the best way to go

image

Pulses

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 detected from 5 to 7 pulses instead of 1 (so approx. 6x more). Originally I thought that this was caused by the fact that the growth of current during an event is not linear and that PCF8583 is that 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, and I discovered the 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 after that they are permanently connected. And this is cause the of multiple pulses being detected with one event.

This behavior is not 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.

ThingsBoard

ThingsBoard tips and trick are documented on following page.

Clone this wiki locally