RPICT4T4: Difference between revisions
No edit summary |
No edit summary |
||
Line 31: | Line 31: | ||
NOTE: Raspberrypi must be switched off while connecting and disconnecting the temperature sensor. | NOTE: Raspberrypi must be switched off while connecting and disconnecting the temperature sensor. | ||
==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/python | |||
import serial | |||
ser = serial.Serial('/dev/ttyS0', 38400, timeout=1) | |||
try: | |||
while 1: | |||
response = ser.readline() | |||
z = response.split(",") | |||
if len(z)>=6: | |||
print "Power 1: %s Watts" % z[0] | |||
print "Power 2: %s Watts" % z[1] | |||
print "Power 3: %s Watts" % z[2] | |||
print "Power 4: %s Watts" % z[3] | |||
print "Temperature 1: %s C" % z[4] | |||
print "Temperature 2: %s C" % z[5] | |||
print "Temperature 3: %s C" % z[6] | |||
print "Temperature 4: %s C" % z[7][:-2] | |||
except KeyboardInterrupt: | |||
ser.close() | |||
==Files== | ==Files== | ||
[http://lechacal.com/RPICT/4CT4T/RPICT4T4_v1_2.ino Sketch version 1.2] | [http://lechacal.com/RPICT/4CT4T/RPICT4T4_v1_2.ino Sketch version 1.2] |
Revision as of 16:41, 14 April 2017
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
- Attiny84 Mcu
Current Sensor
Recommended sensor: SCT-013-000
Burden Resistor: 24 Ohm
Connector: 3.5mm Jack
Default Voltage for power calculation: 240V (can be modified in firmware).
For AC current only.
Temperature Sensor
Connector: 3.5mm Jack
The intended temperature sensor is the DS18B20 which can be configure in either parasite or normal mode.
The connection to a 3.5mm jack connector is shown below.
NOTE: Raspberrypi must be switched off while connecting and disconnecting the temperature sensor.
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/python import serial ser = serial.Serial('/dev/ttyS0', 38400, timeout=1) try: while 1: response = ser.readline() z = response.split(",") if len(z)>=6: print "Power 1: %s Watts" % z[0] print "Power 2: %s Watts" % z[1] print "Power 3: %s Watts" % z[2] print "Power 4: %s Watts" % z[3] print "Temperature 1: %s C" % z[4] print "Temperature 2: %s C" % z[5] print "Temperature 3: %s C" % z[6] print "Temperature 4: %s C" % z[7][:-2] except KeyboardInterrupt: ser.close()