Over Serial Configuration - Sketch 2.1: Difference between revisions
No edit summary |
|||
Line 293: | Line 293: | ||
print | print | ||
x | x | ||
Lets save these commands in a file called 1xrpict7v1.conf. To execute them use the command shown below: | |||
while read line; do echo $line > /dev/ttyAMA0; sleep 0.1; done < 1xrpict7v1.conf | |||
If using another configuration only replace the filename 1xrpict7v1.conf with appropriate. | |||
We have preconfigured some usual configuration below. |
Revision as of 13:53, 9 December 2016
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 first. 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 | Description | Parameters value/range | Example |
---|---|---|---|
x | Enter/exit interactive mode. | None | x |
Prints entire configuration | None | ||
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 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 tables below gives all pin assignment:
Pin number | RPICT7V1 | RPICT8 |
---|---|---|
1 | V1 | CT8 |
2 | CT7 | CT7 |
3 | CT6 | CT6 |
4 | CT5 | CT5 |
5 | CT4 | CT4 |
6 | CT3 | CT3 |
7 | CT2 | CT2 |
8 | CT1 | CT1 |
Pin number | Board type |
---|---|
10 | Master |
6 | Slave 1 |
7 | Slave 2 |
8 | Slave 3 |
9 | Slave 4 |
Channels
We are refering as a channel here a data stream to be sent out. For example Vrms and Realpower derived from a same sensor will be two different channels.
These are configured with the addchannel command. Two numbers must follow. The first one is the combination id defined above. The id is given when issuing a print command. The second number identifies the type of channel. For example:
addchannel 0 3
Add another channel using voltage/current combination node id 0. Channel type 3 which is Vrms as shown in the table below.
The table below shows the convention being used:
code | Channel Type | Description |
---|---|---|
0 | None | |
1 | Real Power | Real Power in Watts |
2 | Apparent Power | Apparent Power in Watts. This is Irms*Vrms |
3 | Vrms | Rms Voltage in Volts |
4 | Irms | Rms current in milliAmps |
5 | Estimated Power | Estimated Power in Watts. This is Irms*Vest. |
Using Configuration file
Here is a great feature. All these commands can be saved in a file and executed together using one simple Linux (bash) command.
For example the configuration of a single RPICT7V1 in single board usage would look as such:
x print zero vest 0 addnode 8 10 1 10 addnode 7 10 1 10 addnode 6 10 1 10 addnode 5 10 1 10 addnode 4 10 1 10 addnode 3 10 1 10 addnode 2 10 1 10 addchannel 0 1 addchannel 1 1 addchannel 2 1 addchannel 3 1 addchannel 4 1 addchannel 5 1 addchannel 6 1 addchannel 0 4 addchannel 1 4 addchannel 2 4 addchannel 3 4 addchannel 4 4 addchannel 5 4 addchannel 6 4 addchannel 0 3 print x
Lets save these commands in a file called 1xrpict7v1.conf. To execute them use the command shown below:
while read line; do echo $line > /dev/ttyAMA0; sleep 0.1; done < 1xrpict7v1.conf
If using another configuration only replace the filename 1xrpict7v1.conf with appropriate.
We have preconfigured some usual configuration below.