Power meter s0 interface <-> GPIO


2 posts
by Jakl » Tue Jun 26, 2012 9:32 am
Hello,

I've just have done RS232 interfaces in my previous carrear, but now I want to go a step further.

Is it possible to connect the GPIO ports of the RaspberryPi with one/multiple s0 interfaces of a power/electricity meter? I want to build a datalogger of the power consumption of our house, but I'm absolutly not familiar with s0 interfaces.

Thank you for your help.
Best regards,
Jakl
Posts: 1
Joined: Tue Jun 26, 2012 8:10 am
by Grumpy Mike » Thu Jun 28, 2012 11:03 pm
Yes it is very easy to do this. Basically the S0 interface is really only an open collector switch that switches a number of times pr kwh (mine is 1000 times pr kwh). This will enable both logging of overall use and instantaneous power usage (by measuring the time between pulses).
From:-
http://forum.micasaverde.com/index.php?topic=522.0

So all you need to do is to connect it to one of the Pi's GPIO pins and add a pull up resistor to 3V3. If you use GPIO 0 or 1 this already has a pull up resistor fitted. You also need to connect the ground of your meter to the ground of the Pi.

Then you need software to measure the time between pulses. This is where it might get tricky because Linux steals time from any running code making accurate timing difficult. However there are various ways round this problem.
User avatar
Posts: 755
Joined: Sat Sep 10, 2011 7:49 pm
Location: Manchester (England England)