How to connect a kwh meter using S0 and which sketch to use

  • Hi there,

    I want to connect 2 kwh meters using their S0 bus ( instead of using a light sensor ).

    Each kwh meter is going to be connected to their own sensor, which should send the data to a Domoticz gateway.

    Used the wiring diagram used in and the energymeter sketch.

    I do get a reading, but it's totally off 😒

    Is there someone out there who has a working mysensors sketch using a S0 kwh meter ?

    Thanks !!!


  • I have combined and changed the default Mysensors pulsecounter sketches for two S0 pulsecounters (water/solar)sketch

    Connect the S0 wires to ground and the digital inputs mentioned in the sketch. The internal pull up resistors are enabled.

  • Hi Mediacj,

    Are you using the S0 bus of the lightsensor to messure your solar panels ?

    If using the S0 bus, how did you wire it up ?



  • I am using the S0 busses of the kwh meters directly, and connect one wire to the ground and the other one to a digital input as mentioned in the sketch(D3 and D5) that's all 🙂

    The internal pull up's of the Arduino nano are enabled in the sketch. I understand your misunderstanding the comments in the sketch are from the original and mention the light sensor, I removed those comments now.

  • Cool !

    I will try it lateron ( at work now )

    Building 3 separate sensors ( in order to get rid of the piface-2 in Domoticz )

    • Water meter
    • Energy ( solarpanels on the house )
    • Energy ( solarpanels on the gardenshed )

    Next challenge would be to get a battery level in the sketch 🙂


  • Nice challenge:) I am using it also with Domoticz.

    Take care of the poles, plus on the digital in and ground to ground.

  • Which poles do you mean ?

    Btw, which sensor do you use for your water meter ?

    Right now i use a metal detector connected to a piface ( see )

    I tested this sensor with the watercounter sketch and it worked perfectly, so i only have to move the wires from the senor from the piface to the mysensor arduino.

  • The S0 bus has a + and - pole But it is not really critical I think, it won't harm the port the pulses are to short but maybe it doesn't count correctly when connected wrong.

    I am using a dedicated water pulsecounter.

  • @Mediacj

    I am still working on the S0 sketch, the problem I have is how to set the starting value, how did you solve this ?

  • @Slorf said:


    I am still working on the S0 sketch, the problem I have is how to set the starting value, how did you solve this ?

    Looking forward how to set a "starting value" (via domotics)

  • Hi @Mediacj ! This is Fay from codebender. I just wanted to let you know that the sketch you are using here has been deleted and so it is not available for users to view it. You could replace it or create a new one! Let me know if you have any questions!

Log in to reply

Suggested Topics

  • 3
  • 2
  • 2
  • 3
  • 10
  • 15