RPICT4V3 Version 5: Difference between revisions

From lechacal
Jump to navigation Jump to search
 
(49 intermediate revisions by the same user not shown)
Line 1: Line 1:


RPICT4V3 Version 5
RPICT4V3 Master Version 5


[[File:IMG_0430_small.png | right | 300px]]
[[File:Link_to_the_shop.png | link=http://lechacalshop.com/gb/internetofthing/87-rpict4v3version5.html ]]
 
This page is for board specific information. More information can be found on the [[Raspberrypi_Current_and_Temperature_Sensor_Adaptor | generic page for RPICT series]].


[http://lechacalshop.com/gb/internetofthing/87-rpict4v3version5.html Link to shop]


This page is for board specific information. More information can be found on the [[Raspberrypi_Current_and_Temperature_Sensor_Adaptor | generic page for RPICT series]].


=Overview=
=Overview=
Line 16: Line 16:
* MCP3208 12 bits ADC
* MCP3208 12 bits ADC
* Stackable (up to 5 boards together)
* Stackable (up to 5 boards together)
[[File:20220405_103740_small.png | 300px]]
=Applications=


A typical application for the RPICT4V3 is 3 phase systems power reading. The 3 voltages are coupled with 3 CT to perform power computation on each line.
A typical application for the RPICT4V3 is 3 phase systems power reading. The 3 voltages are coupled with 3 CT to perform power computation on each line.


[[File:3_phase_diagram_rpict4v3.png | 600px]]
[[File:3_phase_diagram_rpict4v3.png | 600px]]
Another use of the RPICT4V3 is for computing power on single phase lines that have different voltages.
The use of 3 phase or individual phase is selectable in the configuration of the device.


=Compatibility=
=Compatibility=
Line 30: Line 38:
|Raspberrypi 1 A
|Raspberrypi 1 A
|No
|No
|-
|Raspberrypi 1 B
|No mounting holes.
|-
|-
|Raspberrypi 1 B+
|Raspberrypi 1 B+
Line 44: Line 55:
|-
|-
|Raspberrypi 4 B
|Raspberrypi 4 B
|Yes
|-
|Raspberrypi 5
|Yes
|Yes
|-
|-
Line 50: Line 64:
* Asus Tinkerboard has been reported to work with RPICT units. Note we won't be able to provide support for the Tinkerboard.
* Asus Tinkerboard has been reported to work with RPICT units. Note we won't be able to provide support for the Tinkerboard.


==Recommended sensors==
=Recommended sensors=
* AC Current sensor:  
* AC Current sensor:  
** SCT-013-000
** SCT-013-000 100A/50mA
** SCT-019
** SCT-019 200A/33mA
** SCT-006
** SCT-006 20A/25mA
** SCT-024 400A/100mA
** SCT-031 600A/100mA
* AC Voltage sensor:
* AC Voltage sensor:
** [[ZMPT101B_Module_1x_v2 | ZMPT101B Module]]
** [https://lechacalshop.com/gb/internetofthing/75-zmpt101b-voltage-sensor.html ZMPT101B Module]
** [https://lechacalshop.com/gb/internetofthing/93-zmp-3x-voltage-sensor.html 3X ZMPT Module]
** UK: 77DB-06-09
** UK: 77DB-06-09
** EU: 77DE-06-09
** EU: 77DE-06-09
** US: 77DA-10-09
** US: 77DA-10-09


VOLTAGE OUTPUT CT SUCH AS SCT-013-030 and other SCT-013-0XX ARE NOT COMPATIBLE WITH THIS BOARD. Only use the SCT-013-000 which is a current output CT.
VOLTAGE OUTPUT CT SUCH AS SCT-013-0'''30''' and other SCT-013-0XX ARE NOT COMPATIBLE WITH THIS BOARD. Only use the SCT-013-'''000''' which is a current output CT.




[[File:IMG_1239_small.png | 240px]]
[[File:IMG_1239_small.png | 240px]]


==Stacking Configuration==
=Stacking Configuration=


General stacking information is described in the RPICT stacking page.
General stacking information is described in the RPICT stacking page.
[[RPICT_Stacking Version 5]]
[[RPICT_Stacking Version 5]]


=Software Configuration=
===Legacy firmware===
For any units ordered before the 1st of February 2022 the firmware version is version 3. Follow this link below for configuration. If possible upgrade to firmware version 4.<br>
[[Before 1st March 22 RPICT4V3 Configuration]]<br>
[[Upgrading to sketch version 4]]


==Software Configuration==
===Configuration via web interface===


Using a serial line terminal program one can configure the following:
First make sure the lcl-package is installed if not done already.
  - Polling interval
  wget lechacal.com/RPICT/tools/lcl-rpict-package_latest.deb
  - Output format (csv or emoncms)
  sudo dpkg -i lcl-rpict-package_latest.deb
- Calibration values (Voltage and Current)
- Voltage/current combinations for real power computation.
- Output channels


Now starts a server instance on the Raspberrypi using.
lcl-server.sh


You can now access the Raspberrypi configuration server if you point your browser to the link below


The documentation for serial configuration can be found on this page. <br>
http://raspberrypi:8000/
For the 3Phase sketch.<br>
[[Configuration for 3Phase firmware]]<br>
For the individual phase sketch.<br>
[[Over Serial Configuration - Sketch 3.0]]<br>


You can now edit the configuration.


===Auto Reset===
[[File:Screenshot_2021-11-01_20-22-56.png | 450px]]


Version 5 units have auto reset support. When using the lcl-rpict-config.py command it is possible to reset the RPICT remotely with the -a option.
An online version of this web interface exists on this link below.
lcl-rpict-config.py -a
or
lcl-rpict-config.py -a -w myfile.conf


==Files==
http://lechacal.com/RPICT/config/generator/latest/index.html
===3Phase sketch===


This is the default firmware from manufacture.
===Configuration via command line===


[http://lechacal.com/RPICT/sketch/RPICT4V3_3Phase_V5_v1.3.ino 3Phase Sketch V1.3]<br>
The documentation for serial configuration can be found on this page. <br>
[[Over_Serial_Configuration_-_Sketch_4]]<br>


This sketch can be loaded directly from the Raspberrypi following [[Upload_Arduino_sketch_from_Raspberrypi_to_RPICT | this guide]] and executing the commands below.
The tool to upload the configuration is called lcl-rpict-config.py.
wget lechacal.com/RPICT/sketch/RPICT4V3_3Phase_V5_v1.3.ino.hex
To read the configuration use
  lcl-upload-sketch RPICT4V3_3Phase_V5_v1.3.ino.hex
  lcl-rpict-config.py -a
This produce the /tmp/rpict.conf file containing the configuration of the device.


===Individual Phase Sketch===
One can modify this file and write it back using
lcl-rpict-config.py -a -w /tmp/rpict.conf


If not using the RPICT4V3 for 3 phase you can use the firmware for individual line.
=Files=


[http://lechacal.com/RPICT/sketch/RPICT_MCP3208_v3.2.0.ino Default Sketch V3.2.0.]<br>
Unit are sold with the sketch below already loaded.


This sketch can be loaded directly from the Raspberrypi following [[Upload_Arduino_sketch_from_Raspberrypi_to_RPICT | this guide]] and executing the commands below.
[http://lechacal.com/RPICT/sketch/RPICT_MCP3208_v4.1.0.ino Default Sketch V4.1.0.]<br>
wget lechacal.com/RPICT/sketch/RPICT_MCP3208_v3.2.0.ino.hex
lcl-upload-sketch RPICT_MCP3208_v3.2.0.ino.hex


Using this sketch the configuration tool below can be used to setup each channels individually.
[http://lechacal.com/RPICT/sketch/RPICT_MCP3208_v4.2.0.ino Default Sketch V4.2.0.]<br>


[[File:Online_config_01.png | 300px| link=http://lechacal.com/RPICT/config/generator/v3.1/]]


===noOSC Sketch===
If needed this sketch can be loaded directly from the Raspberrypi following [[Upload_Arduino_sketch_from_Raspberrypi_to_RPICT | this guide]] and executing the commands below.
The Default sketch allows up to 28 computation nodes to be run. If more are needed for higher stacks then we recommend to use the noOSC sketch. This is the same as the default sketch but Over Serial Configuration (OSC) as been removed to allow up to 40 nodes to be computed. Configuration has to be edited in the sketch.
wget lechacal.com/RPICT/sketch/RPICT_MCP3208_v4.2.0.ino.hex
lcl-upload-sketch RPICT_MCP3208_v4.2.0.ino.hex


[http://lechacal.com/RPICT/sketch/RPICT_noOSC_v1_0.ino noOSC Sketch v1.0]<br>
=Simple Python Example=
[http://lechacal.com/RPICT/sketch/RPICT_noOSC_v1_1.ino noOSC Sketch v1.1]<br>
 
==Simple Python Example==
The example python script below will work well with the default configuration.
The example python script below will work well with the default configuration.
<syntaxhighlight lang="python">
<syntaxhighlight lang="python">
  import serial
  import serial
  ser = serial.Serial('/dev/ttyAMA0', 38400)
  ser = serial.Serial('/dev/ttyAMA0', 38400)
   
   
  try:
  try:
      while 1:
        while 1:
            # Read one line from the serial buffer
            # Read one line from the serial buffer
            line = ser.readline()
            line = ser.readline().decode().strip()
            # Remove the trailing carriage return line feed
            line = line[:-2]
            # Create an array of the data
            Z = line.split(' ')
   
   
            # Print it nicely
            # Create an array of the data
            if len(Z)>16:
            Z = line.split(' ')
                print ("----------")
                print ("          \tCT1\tCT2\tCT3\tCT4")
                print ("Vrms    :\t%s\t%s\t%s\t%s" % (Z[1], Z[2], Z[3], Z[4]))
                print ("RealPower:\t%s\t%s\t%s\t%s" % (Z[5], Z[6], Z[7], Z[8]))
                print ("Irms    :\t%s\t%s\t%s\t%s" % (Z[9], Z[10], Z[11], Z[12]))
                print ("P Factor :\t%s\t%s\t%s\t%s" % (Z[13], Z[14], Z[15], Z[16]))
   
   
            # Print it nicely
            if len(Z)>10:
                print ("----------")
                print ("          \tCT1\tCT2\tCT3\tCT4")
                print ("Vrms    :\t%s\t%s\t%s\t%s" % (Z[8], Z[9], Z[10], ""))
                print ("RealPower:\t%s\t%s\t%s\t%s" % (Z[1], Z[2], Z[3], ""))
                print ("Irms    :\t%s\t%s\t%s\t%s" % (Z[4], Z[5], Z[6], Z[7]))
   
   
                       
  except KeyboardInterrupt:
  except KeyboardInterrupt:
      ser.close()
        ser.close()
 
</syntaxhighlight>
</syntaxhighlight>
To run this first of all make sure you have python-serial package installed
To run this first of all make sure you have python-serial package installed


  $ sudo apt-get install python-serial
  $ sudo apt-get install python3-serial




Then run the command below to download the script.
Then run the command below to download the script.
  wget lechacal.com/RPICT/example/RPICT4V3_DEMO_02.py.zip
  wget lechacal.com/RPICT/example/RPICT4V3_DEMO_03.py.zip
  unzip RPICT4V3_DEMO_02.py.zip
  unzip RPICT4V3_DEMO_03.py.zip
and run it using
and run it using
  python RPICT4V3_DEMO_02.py
  python RPICT4V3_DEMO_03.py


==Data Output==
=Data Output=


===3Phase firmware===
The default data output is:
This is the default from manufacture.
Using the three phase firmware the data output is:


  NodeID Vrms1 Vrms2 Vrms3 Irms1 Irms2 Irms3 Realpower1 Realpower2 Realpower3 PF1 PF2 PF3
  NodeID P1 P2 P3 Irms1 Irms2 Irms3 Irms4 Vrms1 Vrms2 Vrms3


Using this firmware channels can not be modified with the configuration. Power associations are as follow.
Real Powers are computed using the following rules:


RealPower1 -> CT1 & V1<br>
P1 -> CT1 & V1<br>
RealPower2 -> CT2 & V2<br>
P2 -> CT2 & V2<br>
RealPower3 -> CT3 & V3<br>
P3 -> CT3 & V3<br>
Irms4 -> CT4<br>


===Individual Phase firmware===
P1, P2 and P3 are active power (or real power).
Using the individual phase firmware the data output is:
 
NodeID Vrms1 Vrms2 Vrms3 Vrms4 Realpower1 Realpower2 Realpower3 Realpower4 Irms1 Irms2 Irms3 Irms4 PF1 PF2 PF3 PF4
 
Real Powers are computed using the following rules:
 
RealPower1 -> CT1 & V1<br>
RealPower2 -> CT2 & V2<br>
RealPower3 -> CT3 & V3<br>
RealPower4 -> CT4 & V3<br>


These rules can be modified in the configuration if needed.
These rules can be modified in the configuration if needed.
Line 201: Line 202:
All outputs type available are
All outputs type available are
* Vrms (V)
* Vrms (V)
* Irms (mA)
* Irms (A)
* Real Power (W)
* Real Power (W)
* Apparent Power (W)
* Apparent Power (W)
Line 207: Line 208:
* Estimated Power
* Estimated Power


==Restore Default Config==
=Restore Default Config=
$ wget lechacal.com/RPICT/config/B4/rpict4v3_3phase.conf
 
$ lcl-rpict-config.py -w rpict4v3_3phase.conf
You should have received a key when acquiring the unit. Use this key to download and restore the default configuration.<br>
If the key was XXXX then execute these commands below. Replace XXXX with your own key.


These command above will restore the default configuration for a 100A rated board. For all other rating see the corresponding table [http://lechacal.com//wiki/index.php?title=Raspberrypi_Current_and_Temperature_Sensor_Adaptor#Measured_range here].<br>
$ wget lechacal.com/hardware/c/XXXX.conf
Then for parameter kcal replace all the 83.33 with the corresponding calibration coefficient found in the table.
$ lcl-rpict-config.py -a -w XXXX.conf


==Emoncms Config (Emonhub)==
=Emoncms Config (Emonhub)=


Make sure you read [[Raspberrypi_Current_and_Temperature_Sensor_Adaptor#Using_Emoncms | this]] first.
Make sure you read [[Raspberrypi_Current_and_Temperature_Sensor_Adaptor#Using_Emoncms | this]] first.


For default configuration.  
For the default configuration use the configuration below.  


   <nowiki>[[11]]</nowiki>
   <nowiki>[[11]]</nowiki>
Line 224: Line 226:
     hardware = RPICT4V3
     hardware = RPICT4V3
     [[[rx]]]
     [[[rx]]]
         names = Vrms1,Vrms2,Vrms3,Vrms4,Realpower1,Realpower2,Realpower3,Realpower4,Irms1,Irms2,Irms3,Irms4,PF1,PF2,PF3,PF4
         names = P1,P2,P3,Irms1,Irms2,Irms3,Irms4,Vrms1,Vrms2,Vrms3
         datacode = 0
         datacode = 0
         scales = 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
         scales = 1,1,1,1,1,1,1,1,1,1
         units = V,V,V,V,W,W,W,W,mA,mA,mA,mA
         units = W,W,W,A,A,A,A,V,V,V


==Enclosure==
=Enclosure=


Enclosures kit are available as a 3D printed product. [http://lechacalshop.com/gb/internetofthing/41-enclosure-kit-for-rpict4v3.html Link to the shop].
Enclosures kit are available as a 3D printed product. [http://lechacalshop.com/gb/internetofthing/41-enclosure-kit-for-rpict4v3.html Link to the shop].
Line 239: Line 241:




==Related Pages==
=Related Pages=


[[Howto_setup_Raspbian_for_serial_read]]
[[Howto_setup_Raspbian_for_serial_read]]
[[Gen5_Passive_Component_Setup]]


[[How to calibrate the Voltage Port]]
[[How to calibrate the Voltage Port]]


[[Update RPICT firmware (CT7V1/CT4V3/CT8)]]
[[Upload Arduino sketch from Raspberrypi to RPICT]]
 
[[Use Emonhub with RPICT]]
 
[[2 Watt Meter method]]

Latest revision as of 12:48, 11 November 2023

RPICT4V3 Master Version 5

This page is for board specific information. More information can be found on the generic page for RPICT series.


Overview

  • 4 AC current sensors.
  • 3 AC Voltage sensors.
  • Compute real power.
  • Fit on Raspberrypi 4 holes mounting pattern.
  • AtMega328 Mcu (Arduino UNO)
  • MCP3208 12 bits ADC
  • Stackable (up to 5 boards together)

Applications

A typical application for the RPICT4V3 is 3 phase systems power reading. The 3 voltages are coupled with 3 CT to perform power computation on each line.

Another use of the RPICT4V3 is for computing power on single phase lines that have different voltages.

The use of 3 phase or individual phase is selectable in the configuration of the device.

Compatibility

Version Compatible?
Raspberrypi 1 A No
Raspberrypi 1 B No mounting holes.
Raspberrypi 1 B+ Yes
Raspberrypi 2 B Yes
Raspberrypi 3 B Yes
Raspberrypi 3 B+ Yes
Raspberrypi 4 B Yes
Raspberrypi 5 Yes
  • Asus Tinkerboard has been reported to work with RPICT units. Note we won't be able to provide support for the Tinkerboard.

Recommended sensors

  • AC Current sensor:
    • SCT-013-000 100A/50mA
    • SCT-019 200A/33mA
    • SCT-006 20A/25mA
    • SCT-024 400A/100mA
    • SCT-031 600A/100mA
  • AC Voltage sensor:

VOLTAGE OUTPUT CT SUCH AS SCT-013-030 and other SCT-013-0XX ARE NOT COMPATIBLE WITH THIS BOARD. Only use the SCT-013-000 which is a current output CT.


Stacking Configuration

General stacking information is described in the RPICT stacking page.

RPICT_Stacking Version 5

Software Configuration

Legacy firmware

For any units ordered before the 1st of February 2022 the firmware version is version 3. Follow this link below for configuration. If possible upgrade to firmware version 4.
Before 1st March 22 RPICT4V3 Configuration
Upgrading to sketch version 4

Configuration via web interface

First make sure the lcl-package is installed if not done already.

wget lechacal.com/RPICT/tools/lcl-rpict-package_latest.deb
sudo dpkg -i lcl-rpict-package_latest.deb

Now starts a server instance on the Raspberrypi using.

lcl-server.sh

You can now access the Raspberrypi configuration server if you point your browser to the link below

http://raspberrypi:8000/

You can now edit the configuration.

An online version of this web interface exists on this link below.

http://lechacal.com/RPICT/config/generator/latest/index.html

Configuration via command line

The documentation for serial configuration can be found on this page.
Over_Serial_Configuration_-_Sketch_4

The tool to upload the configuration is called lcl-rpict-config.py. To read the configuration use

lcl-rpict-config.py -a

This produce the /tmp/rpict.conf file containing the configuration of the device.

One can modify this file and write it back using

lcl-rpict-config.py -a -w /tmp/rpict.conf

Files

Unit are sold with the sketch below already loaded.

Default Sketch V4.1.0.

Default Sketch V4.2.0.


If needed this sketch can be loaded directly from the Raspberrypi following this guide and executing the commands below.

wget lechacal.com/RPICT/sketch/RPICT_MCP3208_v4.2.0.ino.hex
lcl-upload-sketch RPICT_MCP3208_v4.2.0.ino.hex

Simple Python Example

The example python script below will work well with the default configuration.

 import serial
 ser = serial.Serial('/dev/ttyAMA0', 38400)
 
 try:
        while 1:
             # Read one line from the serial buffer
             line = ser.readline().decode().strip()
 
             # Create an array of the data
             Z = line.split(' ')
 
             # Print it nicely
             if len(Z)>10:
                 print ("----------")
                 print ("          \tCT1\tCT2\tCT3\tCT4") 
                 print ("Vrms     :\t%s\t%s\t%s\t%s" % (Z[8], Z[9], Z[10], ""))
                 print ("RealPower:\t%s\t%s\t%s\t%s" % (Z[1], Z[2], Z[3], ""))
                 print ("Irms     :\t%s\t%s\t%s\t%s" % (Z[4], Z[5], Z[6], Z[7]))
 
                        
 except KeyboardInterrupt:
        ser.close()

To run this first of all make sure you have python-serial package installed

$ sudo apt-get install python3-serial


Then run the command below to download the script.

wget lechacal.com/RPICT/example/RPICT4V3_DEMO_03.py.zip
unzip RPICT4V3_DEMO_03.py.zip

and run it using

python RPICT4V3_DEMO_03.py

Data Output

The default data output is:

NodeID P1 P2 P3 Irms1 Irms2 Irms3 Irms4 Vrms1 Vrms2 Vrms3

Real Powers are computed using the following rules:

P1 -> CT1 & V1
P2 -> CT2 & V2
P3 -> CT3 & V3
Irms4 -> CT4

P1, P2 and P3 are active power (or real power).

These rules can be modified in the configuration if needed.

Other output type can be streamed out. This should be configured in the unit.

All outputs type available are

  • Vrms (V)
  • Irms (A)
  • Real Power (W)
  • Apparent Power (W)
  • Power Factor
  • Estimated Power

Restore Default Config

You should have received a key when acquiring the unit. Use this key to download and restore the default configuration.
If the key was XXXX then execute these commands below. Replace XXXX with your own key.

$ wget lechacal.com/hardware/c/XXXX.conf
$ lcl-rpict-config.py -a -w XXXX.conf

Emoncms Config (Emonhub)

Make sure you read this first.

For the default configuration use the configuration below.

 [[11]]
   nodename = RPICT4V3
   hardware = RPICT4V3
   [[[rx]]]
       names = P1,P2,P3,Irms1,Irms2,Irms3,Irms4,Vrms1,Vrms2,Vrms3
       datacode = 0
       scales = 1,1,1,1,1,1,1,1,1,1
       units = W,W,W,A,A,A,A,V,V,V

Enclosure

Enclosures kit are available as a 3D printed product. Link to the shop.

Both Raspberrypi 3 and 4 format are available.


Related Pages

Howto_setup_Raspbian_for_serial_read

Gen5_Passive_Component_Setup

How to calibrate the Voltage Port

Upload Arduino sketch from Raspberrypi to RPICT

Use Emonhub with RPICT

2 Watt Meter method