# How make a pulse acquisition from an electrical meter directly into a raspberry pi?

I would like to acquire pulse informations from a french electrical meter. There is a picture of the outputs of this electrical meter.

These pulses vary in frequency and after acquisition, we can calculate the active power (M1) and the reactive power (M2) depending of these frequencies variations. As I understand this documentation, I have to power it at 24VDC (27mA maximum and 10 mA minimum) through MC Pin and take the signal back from M1 & M2. Also, it says one calibrated pulse ("Passing" state) is about 40 ms, 30 ms minimum.

My objective is to read these pulsation directly on the GPIO of the raspberry pi (this part already work, I tested it with a signal generator directly on the rasp).

The fact is, I need to lower this 24VDC signals to the classic 3.3V of the rasp GPIO. I think the best way to do it is to go with an optocoupler circuit. In principle, I shouldn't have problem to see the variation through the optcoupler as one pulse is at 30ms minimum.

There is my first guess for the circuit :

But I think maybe this one could work too ? :

I tried to calculate the resistor from typical optocoupler circuit but I'm not sure at all. I can't access to the electricity meter for know so I can't test it to verify. Moreover, the circuit may be used on other meters, the DC voltage needs to be between 18V and 27V and the current between 10mA and 27mA precisely.

Before I sent you the calculation of the resistors, can someone confirm that one of my schematics make sense for what I want to do ?

• You have the power polarity to your meter the wrong way round. Read the label you attached and note that we are talking NPN transistors. – Andy aka May 24 at 15:07
• Those NPNs to ground in the meter won't need 24v. It may be that just 5v or 3.3v through a pullup will do. Then the meter common (-) and your PI ground share a connection, UNLESS, the meter is actually ghosting its power supply from that external 24v, in which case you'll need to supply 24v, but resistive dividers to the PI should be adequate. Either way, as Andy says, get your supplies the right way round. It's a pity the meter documentation has been drawn 'upside down'. – Neil_UK May 24 at 15:15
• As drawn, your meter's outputs are en.wikipedia.org/wiki/Open_collector – sstobbe May 24 at 15:55
• I didn't notice the NPN transistors were reversed ! I just corrected it ! I don't want to use the 3.3V of the raspberry PI to keep a galvanic isolation (insulation ?) between the meter and my raspberry pi. Moreover, the circuit may be used on other meters where it's specified it needs to be between 18V and 27V and between 10mA and 27mA precisely. I will add this information to my original post, my bad. – A.Girafe May 27 at 15:03