Over Serial Configuration - Sketch 2.1

From lechacal
Jump to navigation Jump to search

This article is for sketch RPICT7V1 version 2.1.
Note a web interface page will be develop in a close future.

Preliminaries

To configure the RPIct7V1 (version 2) over serial a serial terminal tool is required. We recommend using simple Linux terminal command (stty, cat, echo).

Two terminal windows will be opened (ssh, putty etc...). One for reading the other for sending commands.

On the first terminal configure the serial like so:

stty -F /dev/ttyS0 raw speed 38400

Then start reading the data from the rpict board:

$ cat /dev/ttyS0

On the second terminal command can be sent to the serial port using the echo command. For example:

$ echo "a_command" > /dev/ttyS0

This will send the command a_command to the serial port.

As the RPICT7V1 continuously send current/power/voltage data at regular intervals we need to interrupt the board. The "x" command is used for this. This will instruct the rpict7v1 to stop sending data and listen for commands. We will call this the interactive mode.

$ echo "x" > /dev/ttyS0

Command list

The table below shows all available commands.

Command list
Command Description Parameters value/range Example
x Enter/exit interactive mode. None x
print Prints entire configuration None print
polling <interval> Change the polling interval. <interval> in seconds in the range 0 to 255. polling 5
format <f> Modify the output format. <f> is 0 or 1.
0: CSV.
1: Emoncms
format 0
id <nodeid> For Emoncms format only. Modify the Emoncms node ID. <nodeid> in the range 0 to 255. id 11
vcal <vcal> Modify the voltage calibration coefficient. <vcal> can be any floating point number. vcal 548.0
ical <ical> Modify the current calibration coefficient. <ical> can be any floating point number. ical 83.33
addnode <current_pin> <slave_pin> <voltage_pin> <slave_pin> Add an additional node for computing power with a given current/voltage combination. See below for further details on pins number. <current_pin> and <voltage_pin> must be one of 1,2,3,4,5,6,7,8.
<slave_pin> must be one of 10,6,7,8,9.
addnode 8 6 1 10
The above will use current on ct1 on slave1 computed against voltage1 on the master board.
addchannel <combid> <type> Add an output channel. <comid> is the combination node id calculating the data. Use print to find out. <type> is the type of data (real power, vrms, etc..). <comid> is a number from 0 to 255.
<type> is a number from 0 to 4.
0: None
1: RealPower
2: ApparentPower
3: Vrms
4: Irms
addchannel 0 3< br> this example add a realpower channel computed from combination id 0.
rmnode remove the last combination node None rmnode
rmchannel remove the last channel None rmchannel
zero remove all combination nodes and channels None zero


A print example

This is an example of what the print command output looks like:

# 
# Polling: 5
# Format: 0
# Emoncms ID: 65
# VCAL: 548.00
# ICAL: 83.33
# Nodes
# id sct sla vol sla
# 0 8 10 1 10
# 1 7 10 1 10
# 2 6 10 1 10
# 3 5 10 1 10
# 4 4 10 1 10
# 5 3 10 1 10
# 6 2 10 1 10
#
# Channels
# n id type
# 0 0 1
# 1 1 1
# 2 2 1
# 3 3 1
# 4 4 1
# 5 5 1
# 6 6 1
# 7 0 4
# 8 1 4
# 9 2 4
# 10 3 4
# 11 4 4
# 12 5 4
# 13 6 4
# 14 0 3


Combination nodes

Combination nodes are small programs in the microcontroller that computes power given a current/voltage couple.

When configuring the board with addnode the four given parameters are the pin numbers where to find the current and voltage and also which slave (or master) is to be used.

For example

addnode 8 6 1 10

will use current ct1 (8) on slave 1 (6) computed against voltage1 (1) on master board (10).

The table below gives all pin assignment:

Current?voltage
Pin number RPICT7V1 other
Enter/exit interactive mode. None x
print Prints entire configuration None print
polling <interval> Change the polling interval. <interval> in seconds in the range 0 to 255. polling 5
format <f> Modify the output format. <f> is 0 or 1.
0: CSV.
1: Emoncms
format 0
id <nodeid> For Emoncms format only. Modify the Emoncms node ID. <nodeid> in the range 0 to 255. id 11
vcal <vcal> Modify the voltage calibration coefficient. <vcal> can be any floating point number. vcal 548.0
ical <ical> Modify the current calibration coefficient. <ical> can be any floating point number. ical 83.33
addnode <current_pin> <slave_pin> <voltage_pin> <slave_pin> Add an additional node for computing power with a given current/voltage combination. See below for further details on pins number. <current_pin> and <voltage_pin> must be one of 1,2,3,4,5,6,7,8.
<slave_pin> must be one of 10,6,7,8,9.
addnode 8 6 1 10
The above will use current on ct1 on slave1 computed against voltage1 on the master board.
addchannel <combid> <type> Add an output channel. <comid> is the combination node id calculating the data. Use print to find out. <type> is the type of data (real power, vrms, etc..). <comid> is a number from 0 to 255.
<type> is a number from 0 to 4.
0: None
1: RealPower
2: ApparentPower
3: Vrms
4: Irms
addchannel 0 3< br> this example add a realpower channel computed from combination id 0.
rmnode remove the last combination node None rmnode
rmchannel remove the last channel None rmchannel
zero remove all combination nodes and channels None zero