ESP32 read Electricity meter pulse 5-40VDC

I want to read the pulse output of an electricity meter marked 5-40 VDC 1000p/Kwh with an ESP32. What do I need to do to protect the ESP32 from over voltage?

Possibly an opto-coupler with an appropriate series resistor for its internal LED.

1 Like

Sounds like open collector output to me. What do the terminal markings say? Can you post a picture?

https://library.e.abb.com/public/f1db7577ce344f97ac2c5621cc8fd74d/2CMC486001M0201_B_en_C11_User_Manual.pdf?x-sign=pVu7AdCVZvHS0SL9Slxg1xL5eX+0l8oJIaBao391Itg4Frj+EhCpW/bs/t/biX5h

Link corrected: https://library.e.abb.com/public/f1db7577ce344f97ac2c5621cc8fd74d/2CMC486001M0201_B_en_C11_User_Manual.pdf

It would appear that this is indeed, an opto-isolator built into the meter, so requiring no additional isolation though you could add a second opto-isolator "just in case".

As it is, you connect it to ground noting the polarity specified, and provide a 2k2 pull-up resistor to 5 V to provide the specified 2 mA bias.

Selection_064

1 Like

There's a circuit from here that interfaces to a 3.3V Arduino:

1 Like

Ah, sorry, an ESP32. 3.3 V logic. :thinking:

OK, as I said, "-" terminal to ground, 2k2 pullup to 5 V on the "+" terminal, then a diode with cathode to the "+" terminal, anode to the ESP32 pin and use INPUT_PULLUP.

Thanks for your input. Never used a opto-coupler before, certainly know a lot about them now.

Thanks, I tried as per the sketch above. It works even if I feed it with the 3.3v from the ESP32.

It probably does. I was just going with the minimum 5 V and 2 mA specified in the datasheet but if it is simply an optocoupler in the device, there is no particular minimum of either.

But which sketch?

For this one on 3.3 V, you do not want the 320 Ω resistor, but put a 10k for protection between the meter device and the ESP input.

1 Like

I need to read the pulse off as many of these meters as I can from 1 ESP32. Trying with interrupts it works except that I get 280 intterupts for one FALLING of the meter(100ms). Looking for a clean way not to miss interrupts from other pins.

Using 5V supply, voltage divider and hardware debounced ...

image

So used to solve problems with software that I did not even consider a hardware option. Thanks. Smallest I have is 10uF. Will get some tomorrow.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.