RPICT4T4

From lechacal
Revision as of 13:20, 18 May 2019 by Administrator (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
IMG 1814 small.png

Link to shop

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

  • 4x AC Current Sensors
  • 4x DS18B20 Temperature Sensors
  • Microcontroller: Atmel ATtiny84

Compatibility

Version Compatible?
Raspberrypi 1 A No
Raspberrypi 1 B+ Yes
Raspberrypi 2 B Yes
Raspberrypi 3 B Yes
Raspberrypi 3 B+ Yes

Current Sensor

IMG 1542 small.png

Recommended sensor: SCT-013-000

For AC current only.

Temperature Sensor

Connector: 3.5mm Jack

The intended temperature sensor is the DS18B20.

The connector is a 3 way screw terminal connector.

Configuration

Starting from sketch version 1.4 the RPICT4T4 is configured over serial.

See general instructions for configuration over serial.

Emoncms Config (Emonhub)

For default configuration.

 [[11]]
   nodename = RPICT4T4
   hardware = RPICT4T4
   [[[rx]]]
       names = Power1, Power2, Power3, Power4, T1, T2, T3, T4
       datacode = 0
       scales = 1,1,1,1,1,1,1,1
       units = W,W,W,W,C,C,C,C

Python Example

Please note the uploaded sketch must have CSV enabled. The example script below will be a good starting point.

First of all make sure you have python-serial package installed

$ sudo apt-get install python-serial

Then copy the following into an executable file and run it.

<syntaxhighlight lang="Python" line='line'>

#!/usr/bin/python2
import serial
ser = serial.Serial('/dev/ttyAMA0', 38400)

try:
       while 1:
            # Read one line from the serial buffer
            line = ser.readline()

            # Remove the trailing carriage return line feed
            line = line[:-2]

            # Create an array of the data
            Z = line.split(' ')

            # Print it nicely
            print ("----------")
            for i in range(len(Z)):
                if i==0:
                    print ("NodeID: %s" % Z[0])
                elif i in [1,2,3,4]:
                    print ("Power %d: %s W" % (i, Z[i]))
                else:
                    print ("Temperature %d: %s C" % (i,Z[i]))
                       
except KeyboardInterrupt:
       ser.close()

</syntaxhighlight>

Files

Sketch version 1.6

Sketch version 2.0

Related Pages

Howto_setup_Raspbian_for_serial_read

How to program an Attiny85 or Attiny84


Rpict4t4 drawing.png