Table of Contents
Overview
This page provides the User's Guide for the Pi-Plates CURRENTplate. The CURRENTplate is compatible with all of our other products (except the TINKERplate). And as many as eight CURRENTplates can be stacked together to provide a maximum of 64 isolated, two-wire 4-20mA inputs.
Board Layout
Getting Started
If you haven't already done so, visit the Getting Started page to set up the interfaces on your Raspberry Pi and to install the Python modules.
Address Selection
View the address selection header from the top of the board as shown in the picture above
Then move the jumpers as shown below to select the desired address for your board. If you only have a single CURRENTplate, there is no need to change the address from the default value of 0.
Functions
Definitions
addr: the CURRENTplate has a set of jumpers on the board that allow its address to be set to a value between 0 and 7.
channel: each CURRENTplate has eight individually addressable input channels numbered 1 through 8.
Reading Loop Currents
The eight inputs on the CURRENTplate are arranged as shown in the image below:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
import piplates.CURRENTplate as CURR import time addr=0 N=1000 data=N*[0] #initialize N-size list print(CURR.getID(addr)) #get and print the ID Iavg=0 t0=time.time() for i in range(N): data[i]=CURR.getI(addr,1) #get current measurement from channel 1 and save to list Iavg=Iavg+data[i]/N tAvg=(time.time()-t0)/N print(N,'Samples of Input 1, Average Current:',round(Iavg,4),'mA, Average Measurement Time:',round(tAvg,6)) |
The output from the above script is:
pi@raspberrypi:~ $ python getIsingle.py
Pi-Plate CURRENTplate
1000 Samples of Input 1, Average Current: 15.1476 mA, Average Measurement Time: 0.000675
Note that with an RPi 4 model B, the average measured time between readings was 675μsec this is equivalent to a max sample rate of about 1,481 samples per second which is actually 48% faster than the specified max of 1Ksps.
Next example: perform ten getIall readings:
1 2 3 4 5 6 7 8 9 10 |
import piplates.CURRENTplate as CURR import time addr=0 N=10 print(CURR.getID(addr)) #get and print the ID t0=time.time() for i in range(N): print(CURR.getIall(addr)) #get all current measurements and print tAvg=(time.time()-t0)/N print(N,'Measurements, Average Measurement Time:',round(tAvg,6)) |
The output from the above script is:
pi@raspberrypi:~ $ python getIall.py
Pi-Plate CURRENTplate
[15.1443, 0.0652, 0.0861, 0.0311, 0.0297, 0.0, 0.0, 0.0319]
[15.145, 0.0656, 0.0861, 0.0311, 0.0293, 0.0, 0.0, 0.0315]
[15.149, 0.0652, 0.0864, 0.0315, 0.03, 0.0, 0.0, 0.0315]
[15.1483, 0.0652, 0.0861, 0.0315, 0.0293, 0.0, 0.0, 0.0315]
[15.1465, 0.0648, 0.0861, 0.0311, 0.0293, 0.0, 0.0, 0.0308]
[15.1465, 0.0652, 0.0861, 0.0322, 0.0289, 0.0, 0.0, 0.0326]
[15.1479, 0.0648, 0.0868, 0.0311, 0.0289, 0.0, 0.0, 0.0315]
[15.1479, 0.0648, 0.0857, 0.0322, 0.0289, 0.0, 0.0, 0.0326]
[15.1465, 0.0656, 0.0861, 0.0308, 0.0293, 0.0, 0.0, 0.0311]
[15.1461, 0.0656, 0.0861, 0.0311, 0.0289, 0.0, 0.0, 0.0315]
10 Measurements, Average Measurement Time: 0.004022
Our test setup only had a single connected signal on Channel 1. All the other channels were disconnected and, in some cases, showing some strange values. It has to be remembered that currents below 4mA are out of range and can produce inaccurate readings - even if the input is not connected.
Note that it takes, on the average, just over 4msec to execute the getIall function.
LED Control
The green LED on the CURRENTplate board can be controlled with the following functions:
setLED(addr) - turn on the LED
clrLED(addr) - turn off the LED
toggleLED(addr) - if LED is on, turn off. If LED is off, turn on.
System Functions
The CURRENTplate supports the following common functions
help() - returns a concise list of the CURRENTplate functions along with explanations
getID(addr) - return Pi-Plate descriptor string, "Pi-Plate CURRENTplate"
getFWrev(addr) - return FW revision in decimal format
getHWrev(addr) - return HW revision in decimal format
getVersion() - returns revision of python module
getADDR(addr) - returns address of pi-plate. Used for polling available boards at power up.
RESET(addr) - set CURRENTplate to power on state.