A few months ago, I realised a meter reading system following this french guide: http://www.magdiblog.fr/gpio/teleinfo-edf-suivi-conso-de-votre-compteur-electrique/

I use the following circuit: my circuit
(source: magdiblog.fr)

Which is connected to my Raspberry Pi B+, it works really well but now i'm trying to improve the system to read two electric meters using the same circuit.

I was told that an NPN transistor would allow me to "switch" between the two electric meters. But I don't know how to choose the transistor and where should I place this transistor in the current circuit.

  • 3
    \$\begingroup\$ You might want to explain to us what this circuit is supposed to achieve \$\endgroup\$
    – PlasmaHH
    Dec 12, 2016 at 10:38
  • \$\begingroup\$ Any reason why you can't use two different inputs on the Pi, one fore each signal? \$\endgroup\$
    – Andrew
    Dec 12, 2016 at 11:06
  • \$\begingroup\$ To read the signal I use the RXD GPIO pin and it seems that there is only one RXD pin on a Raspberry Pi. That's why I'm trying to redirect both signals to the same pin. \$\endgroup\$
    – alo48
    Dec 12, 2016 at 11:17
  • \$\begingroup\$ how about connecting another opto? Pin 4 and Pin 3 of second opto can be shorted with Pin 4 and 3 of first opto. assuming data collision is not an issue \$\endgroup\$
    – User323693
    Dec 12, 2016 at 11:29
  • \$\begingroup\$ The electric meter send data continuously so it seems it will cause a data collision. Moreover the program won't be able to determine from which electric meter the data comes from. \$\endgroup\$
    – alo48
    Dec 12, 2016 at 11:40

1 Answer 1


The meter sends data continuously on the serial port. If you use two meters but have only one serial port available on the pi, combining both RX lines will lead to collisions and the data frames will get corrupted.

But maybe listening to one meter at a given time is acceptable, if the meters repeats the same info regularily. For example if you listen to one meter during 0.5 seconds, then the other meter for 0.5 seconds, you'll miss some information, but you may still get the relevant info you need at the frequency you require.

If this is the case, then it is easy: just use the same circuit as above on the second meter, and use a 2-to-1 MUX (e.g. SN74LVC2G157) to switch the RX line from one meter to the second. You'll need an additional GPIO configured as an output on the pi to select one meter or the other. You could use transistors for this, but a single multiplexer chip is simpler.

On the other hand, if you really need to listen to all the frames of both meters continuously, and you can't afford missing frames, you'll absolutely need two serial ports on the pi.

  • \$\begingroup\$ Thanks, I didn't know the 2-to-1 MUX but it seems to be what I need. Do I have to add a resistance to the circuit ? \$\endgroup\$
    – alo48
    Dec 12, 2016 at 11:54
  • \$\begingroup\$ You need the R2 resistance as in the circuit you shown, twice (one for each meter). However, you don't need one at the output of the mux. I realize you may not like the tiny packaging of SN74LVC2G157. If you're more comfortable with DIP chips, use 74HC157 and tie all unused inputs to ground. \$\endgroup\$
    – dim
    Dec 12, 2016 at 12:01
  • \$\begingroup\$ Or use 74HC151, and connect up to 8 meters! Wow! \$\endgroup\$
    – dim
    Dec 12, 2016 at 12:03
  • \$\begingroup\$ Oh okay, it could be great but unfortunately I only have 2 meters! Thanks again, I put the subject to "solved". \$\endgroup\$
    – alo48
    Dec 12, 2016 at 12:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.