Personal tools

S0 serial reader

From PhotoVoltaic Logger new generation

Revision as of 14:52, 27 February 2014 by KKoPV (talk | contribs) (Created page with "== Abstract == This is a part of the [http://github.com/k-ko/PVLng-scripts PVLng-scripts repository]. Scripts located in S0/ To read S0 impulses from e.g. energy meters, a ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Abstract

This is a part of the PVLng-scripts repository.

Scripts located in S0/

To read S0 impulses from e.g. energy meters, a program and a script to store this into PVLng is included.

Hardware requirements

Energy meter

You need a energy meter with S0 interface, best for 3 phases.

B-Watt.png

B-Watt Swissnox 3x5(80A)

Serial port adapter

If your computer not more have a serial port (like mine), you need a USB serial adapter.

The best choice is an adapter with a FTDI / FT232RL chip set.

DigitusDA70156.png

Digitus DA-70156 USB to Serial Adapter, USB 2.0

Connect your S0 port like this to your serial interface:

S0SerialPins.png

During prototyping is a gender changer (female/female) recommended.

Or you recycle an old serial mouse cable...

S0SerialMouse.png

USB to TTL Serial Cable

I found also a bit cheaper possibility.

FTDI-FT232-USBtoTTL.jpg

This cable is used for Arduino boards but it works perfect also for S0 signals.

Please not:

  • You need a cable with 6 pins, not only 4 pins, although we need only 2 of them!
Wire Signal
Red 5V
Black GND
White RXD
Green TXD
Yellow RTS
Blue CTS

You can find them on eBay, shipping from China to Germany took abt. 3 weeks.

Channel definition

Please put the device where your energy meter is connected to into the channel attribute like this:

S0PowerSensorChannel.png

You should also define a fixed name for your device.

Mode of operation

An energy meter with S0 interface sends depending of the actual power usage an amount of impulses per kilo watt hour.

A common frequency is 1000 or 2000 per kilo watt hour, or 800 as for our energy meter.

The S0 binary listen the device and detects the time between these impulses. It converts them to power usage in watt.

Installation

$ cd S0/bin
$ ./compile

Configuration

Please refer to S0.conf.dist to configure your environment regarding interfaces and channels.

$ cp S0.conf.dist S0.conf

Test

To test your configuration, run

$ ./S0.sh -tv S0.conf

Run with cron

Edit your crontab with

$ crontab -e

and add the following lines

# run S0 reader each 2 minutes
*/2 * * * * /path/to/PVLng-sctipts/S0/S0.sh S0.conf