RPICT4T4: Difference between revisions

From lechacal
Jump to navigation Jump to search
No edit summary
 
(31 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[File:IMG_0750.JPG | 300px | right]]
[[File:332.jpg | 300px | right]]


[http://lechacalshop.com/en/internetofthing/15-raspberrypi-4-current-sensor-adaptor-4-temperature-emoncms.html Link to shop]
[[File:Link_to_the_shop.png | link=http://lechacalshop.com/en/internetofthing/15-raspberrypi-4-current-sensor-adaptor-4-temperature-emoncms.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]].
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]].
Line 7: Line 7:
* 4x AC Current Sensors
* 4x AC Current Sensors
* 4x DS18B20 Temperature Sensors
* 4x DS18B20 Temperature Sensors
* Attiny84 Mcu
* Microcontroller: Atmel ATtiny84
* 10bit ADC


==Current Sensor==
==Compatibility==
[[File:333.jpg | right | 300px]]
{| class="wikitable" 
|+
|-
!Version
!Compatible?
|-
|Raspberrypi 1 A
|No
|-
|Raspberrypi 1 B+
|Yes
|-
|Raspberrypi 2 B
|Yes
|-
|Raspberrypi 3 B
|Yes
|-
|Raspberrypi 3 B+
|Yes
|-
|Raspberrypi 4 B
|Yes
|-
|Raspberrypi 5
|Yes
|-
|}


Recommended sensor: SCT-013-000


Burden Resistor: 24 Ohm
* Asus Tinkerboard has been reported to work with RPICT units. Note we wont be able to provide support for the Tinkerboard.


Connector: 3.5mm Jack
==Current Sensor==
 
[[File:334.jpg | right | 300px]]
Default Voltage for power calculation: 240V (can be modified in firmware).
Recommended sensor: SCT-013-000


For AC current only.
For AC current only.
Line 24: Line 53:
Connector: 3.5mm Jack
Connector: 3.5mm Jack


The intended temperature sensor is the DS18B20 which can be configure in either parasite or normal mode.
The intended temperature sensor is the [http://lechacalshop.com/gb/internetofthing/4-ds18b20-with-35mm-jack-connector-encapsulated.html DS18B20].
 
The connection to a 3.5mm jack connector is shown below.
 
[[Image:3.5mmJACK.png]]


NOTE: Raspberrypi must be switched off while connecting and disconnecting the temperature sensor.
The connector is a 3 way screw terminal connector.


==Configuration==
==Configuration==
Line 38: Line 63:
See general instructions for [[Attiny Over Serial Configuration | configuration over serial]].
See general instructions for [[Attiny Over Serial Configuration | configuration over serial]].


==Emoncms Config (Emonhub)==
For default configuration.
  <nowiki>[[11]]</nowiki>
    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==
==Python Example==
Line 48: Line 85:
Then copy the following into an executable file and run it.
Then copy the following into an executable file and run it.


  #!/usr/bin/python
<syntaxhighlight lang="python">
  #!/usr/bin/python2
  import serial
  import serial
  ser = serial.Serial('/dev/ttyAMA0', 38400)
  ser = serial.Serial('/dev/ttyAMA0', 38400)
Line 54: Line 92:
  try:
  try:
         while 1:
         while 1:
                response = ser.readline()
            # Read one line from the serial buffer
                z = response.split(",")
            line = ser.readline()
                if len(z)>6:
                        print "Power 1: %s Watts" % z[0]
            # Remove the trailing carriage return line feed
                        print "Power 2: %s Watts" % z[1]
            line = line[:-2]
                        print "Power 3: %s Watts" % z[2]
                        print "Power 4: %s Watts" % z[3]
            # Create an array of the data
                        print "Temperature 1: %s C" % z[4]
            Z = line.split(' ')
                        print "Temperature 2: %s C" % z[5]
                        print "Temperature 3: %s C" % z[6]
            # Print it nicely
                         print "Temperature 4: %s C" % z[7][:-2]
            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:
  except KeyboardInterrupt:
         ser.close()
         ser.close()
</syntaxhighlight>


==Files==
==Files==
[http://lechacal.com/RPICT/4CT4T/RPICT4T4_v1_2.ino Sketch version 1.2]


[http://lechacal.com/RPICT/4CT4T/RPICT4T4_v1_3.ino Sketch version 1.3]
[http://lechacal.com/RPICT/4CT4T/RPICT4T4_v1_6.ino Sketch version 1.6]


[http://lechacal.com/RPICT/4CT4T/RPICT4T4_v1_4.ino Sketch version 1.4]
[http://lechacal.com/RPICT/4CT4T/RPICT4T4_v2.0.ino Sketch version 2.0]


==Related Pages==
==Related Pages==


[[Configure RPICT for EmonCMS]]
[[Howto_setup_Raspbian_for_serial_read]]
 
[[Gen3_Passive_Component_Setup]]
 
[[How to program an Attiny85 or Attiny84]]
 
 
[[File:Rpict4t4_drawing.png]]

Latest revision as of 12:49, 11 November 2023

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
  • 10bit ADC

Compatibility

Version Compatible?
Raspberrypi 1 A No
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 wont be able to provide support for the Tinkerboard.

Current Sensor

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.

 #!/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()

Files

Sketch version 1.6

Sketch version 2.0

Related Pages

Howto_setup_Raspbian_for_serial_read

Gen3_Passive_Component_Setup

How to program an Attiny85 or Attiny84