User:Tom/Arduino Project: Difference between revisions
No edit summary |
No edit summary |
||
| (188 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
=Overpeinzingen= | = Overpeinzingen = | ||
===Te meten=== | === Te meten === | ||
=====Digitaal===== | ===== Digitaal ===== | ||
* Voordeur, deur meterkast, deur cvkast, deur garage-woonkamer, deur garage-achter, deur garage-voor-links-rechts. | * Voordeur, deur meterkast, deur cvkast, deur garage-woonkamer, deur garage-achter, deur garage-voor-links-rechts. | ||
| Line 11: | Line 11: | ||
* PIR hal beneden, hal boven, woonkamer, garage. | * PIR hal beneden, hal boven, woonkamer, garage. | ||
=====Analoog===== | ===== Analoog ===== | ||
* Temperatuur hal, hal radiator,woonkamer, geluidsinstallatie, meterkast, cvkast, garage, garage radiator. buiten voor, buiten achter, onder de vloer | * Temperatuur hal, hal radiator,woonkamer, geluidsinstallatie, meterkast, cvkast, garage, garage radiator. buiten voor, buiten achter, onder de vloer | ||
* Weerstation buiten (wind, temperatuur, zonlicht, CO2, luchtdruk). | * Weerstation buiten (wind, temperatuur, zonlicht, CO2, luchtdruk). | ||
===Plaatsen voor Arduino=== | === Plaatsen voor Arduino === | ||
Over | * meterkast | ||
* garage | |||
* hobbykamer | |||
* houthok in tuin | |||
* boom bij cirkel in tuin | |||
Over naar raspberry pi's. | |||
Onderhoud/configuratie met ansible en monitoring met Icinga/Nagios. | Onderhoud/configuratie met ansible en monitoring met Icinga/Nagios. | ||
Raspberrys verzamelen gegevens en sturen deze iedere minuut naar Atlas. | |||
Bewaar de samples als het versturen mislukt en stuur de vorige samples opnieuw. | |||
Stuur naar Atlas wanneer samples niet lukte en hoeveel samples er niet en later wel verstuurd zijn. | |||
=== Naamgeving records Carbon === | |||
roggedomo.solar.totalwattstoday | |||
roggedomo.solar.wattsnow | |||
roggedomo.solar.temperature | |||
roggedomo.solar.pv1voltagedc | |||
roggedomo.solar.pv2voltagedc | |||
roggedomo.solar.pv1currentdc | |||
roggedomo.solar.pv2currentdc | |||
roggedomo.solar.voltageac | |||
roggedomo.solar.currentac | |||
roggedomo.solar.frequency | |||
roggedomo.solar.totalwattstoday | |||
roggedomo.solar.totalkWhsincereset | |||
= Sensoren = | |||
[[User:Tom/Arduino Project - Valse meldingen sensoren | Valse meldingen van sensoren]] | |||
==== DHT22 Temperature/humidity ==== | |||
[[File:DHT22pins.jpg|250px|right|DHT22]] | |||
==== DS18B20 Temperature ==== | |||
Bij verlengen aansluitkabel met cat-5 kabel dient de data en ground aansluiting in hetzelfde twisted pair te zitten. Laat de overige aansluitingen ongemoeid, verbind deze niet met massa. | |||
DS18B20 serienummers: | |||
* A24340 | |||
* A2535A | |||
* A2566A | |||
* A29539 | |||
* A29A8B | |||
* A2C311 | |||
* A2F0D9 | |||
* A3BB16 | |||
* A3E76A | |||
En waar zijn de reeds aangesloten sensoren | |||
* DE70FF | |||
* E252FF | |||
==== RTC DS1307 ==== | |||
Real Time Clock module met CR1220 knoopcel. | |||
==== HC-SR501 Bewegingsensor ==== | |||
[[File:HC-SR501-bewegingssensor-pins.png|450px|right|PIR HC-SR501]] | |||
Gevoeligheid: Je kunt de afstand waarover de sensor werkt aanpassen (3m tot 7m). | |||
Output timing: Deze instelling regelt hoe lang de uitgang hoog wordt gehouden na de sensor wordt geactiveerd (5 seconden tot 300 seconden). | |||
Jumper Auto reset: De sensor blijft geactiveerd totdat de beweging stopt. | |||
Jumper Geen reset: De sensor blijft de ingestelde ‘Output timing' periode geactiveerd bij de detectie van een beweging. | |||
==== YF-S201 Waterflow Sensor ==== | |||
[[File:Water-flow-sensor model YF-S201.jpg|450px|right|YF-S201]] | |||
Er is ook een groter model (YF-G1 DN25 1inch Water Flow Sensor) max 100L/min. | |||
Aansluitdraden: | |||
* Zwart - Ground | |||
* Rood - Vcc 5V | |||
* Geel - Signal / Data | |||
Sample code: | |||
#!/usr/bin/env python | |||
import RPi.GPIO as GPIO | |||
import time, sys | |||
FLOW_SENSOR = 23 | |||
GPIO.setmode(GPIO.BCM) | |||
GPIO.setup(FLOW_SENSOR, GPIO.IN, pull_up_down = GPIO.PUD_UP) | |||
global count | |||
count = 0 | |||
def countPulse(channel): | |||
global count | |||
count = count+1 | |||
print count | |||
GPIO.add_event_detect(FLOW_SENSOR, GPIO.FALLING, callback=countPulse) | |||
while True: | |||
try: | |||
time.sleep(1) | |||
except KeyboardInterrupt: | |||
print '\ncaught keyboard interrupt!, bye' | |||
GPIO.cleanup() | |||
sys.exit() | |||
Debounce code: | |||
#initialise a previous input variable to 0 (assume button not pressed last) | |||
prev_input = 0 | |||
while True: | |||
#take a reading | |||
input = GPIO.input(17) | |||
#if the last reading was low and this one high, print | |||
if ((not prev_input) and input): | |||
print("Button pressed") | |||
#update previous input | |||
prev_input = input | |||
#slight pause to debounce | |||
time.sleep(0.05) | |||
==== Samples queuen ==== | |||
===== Pseudo code ===== | |||
If Sample Ok | |||
Then | |||
Send Sample to server | |||
If Send Ok | |||
Then | |||
If sample files found | |||
Then | |||
Do while sample files available | |||
send sample to server | |||
if Send Ok | |||
then | |||
Remove sample file | |||
else | |||
Log error retry sample failed | |||
Fi | |||
Done | |||
Else | |||
nop | |||
Fi | |||
Else | |||
Store sample as a file in directory | |||
Fi | |||
Else | |||
Tell Sample failed | |||
Fi | |||
===== Pseudo code variant eerst schrijven naar file in directory ===== | |||
Uitbreiden met nagios monitoring en retries inzichtelijk maken. | |||
If Sample Ok | |||
Then | |||
write sample to file | |||
If write-ok | |||
Then | |||
Do while sample files available | |||
send sample to server | |||
if Send Ok | |||
then | |||
Remove sample file | |||
else | |||
Log error retry sample failed | |||
Fi | |||
Done | |||
Else | |||
tell write failed | |||
Fi | |||
Else | |||
Tell Sample failed | |||
Fi | |||
===== Aap ===== | |||
pi@roggeberry1:~ $ cat /home/pi/sample/sample.py | |||
#!/usr/bin/python2 | |||
import sys | |||
import time | |||
import os | |||
import platform | |||
import subprocess | |||
from socket import socket | |||
import Adafruit_DHT | |||
CARBON_SERVER = '192.168.2.100' | |||
CARBON_PORT = 2003 | |||
sock = socket() | |||
try: | |||
sock.connect( (CARBON_SERVER,CARBON_PORT) ) | |||
except: | |||
print "Couldn't connect to %(server)s on port %(port)d, is carbon-agent.py running?" % { 'server':CARBON_SERVER, 'port':CARBON_PORT } | |||
sys.exit(1) | |||
def gettemp(id): | |||
try: | |||
mytemp='' | |||
filename = 'w1_slave' | |||
f = open('/sys/bus/w1/devices/' + id + '/' + filename, 'r') | |||
line = f.readline() | |||
crc = line.rsplit(' ',1) | |||
crc = crc[1].replace('\n','') | |||
if crc=='YES': | |||
line = f.readline() | |||
mytemp = line.rsplit('t=',1) | |||
else: | |||
mytemp = 0 | |||
f.close() | |||
return int(mytemp[1]) | |||
except: | |||
return 0 | |||
humidity, temperature = Adafruit_DHT.read_retry(Adafruit_DHT.DHT22, 4) | |||
humidity = round(humidity, 2) | |||
temperature = round(temperature, 2) | |||
if humidity is not None and temperature is not None: | |||
now = int( time.time() ) | |||
lines = [] | |||
#We're gonna report all three loadavg values | |||
lines.append("roggedomo.livingroom.temperature %s %d" % (temperature,now)) | |||
lines.append("roggedomo.livingroom.humidity %s %d" % (humidity,now)) | |||
lines.append("roggedomo.livingroom.ground.temperature %s %d" % (gettemp('28-051691de70ff')/float(1000),now)) | |||
lines.append("roggedomo.livingroom.floor.temperature %s %d" % (gettemp('28-051691e252ff')/float(1000),now)) | |||
message = '\n'.join(lines) + '\n' #all lines must end in a newline | |||
print "sending message\n" | |||
print '-' * 80 | |||
print message | |||
print | |||
sock.sendall(message) | |||
else | |||
print 'No data from DHT22' | |||
pi@roggeberry1:~ $ | |||
=== ADC === | |||
===== MCP3008 ===== | |||
8 analoge input channels met 10-bit resolutie. | |||
===== ADS1x15 ===== | |||
[[Image:Ads1115-16-bit-adc-4-channel-with-pga-ada-1085-ec3.jpg|right|200px|ADS1115]] | |||
4 input channels met 12/16-bit precisie en instelbare gevoeligheid/versterking. | |||
ADS1015 12 bits precisie en ADS1115 met 16-bit precisie. | |||
= Raspberries = | |||
[[Image:Raspbery-pi-3-gpio-pinout-40-pin-header-block-connector-1-1.png|right|300px|Raspberry Pi 3 GPIO pins]] | |||
=== Meterkast === | |||
Host roggeberry2. | |||
'''DHT22''' pin 1 5V (3.3?) | |||
pin 2 Data | |||
pin 3 Not connected | |||
pin 4 Ground | |||
Pullup 10k resistor between pin 1 and 2 | |||
'''DS18B20''' rood 3V0 - 5V5 | |||
groen Ground | |||
geel Data | |||
UTP kabel DS18B20 | |||
oranje --> connector rood (onder) | |||
wit --> connector geel (links) Kijkend naar voorzijde wcd) | |||
groen --> connector groen (rechts) | |||
'''HP206C''' | |||
zwart Ground | |||
rood +5V | |||
wit SDA | |||
geel SCL | |||
'''HC SR-501''' | |||
zwart GND | |||
geel Output | |||
rood VCC +5V | |||
==== Sensoren ==== | |||
====== Roggeberry2 ====== | |||
'''---------------- Carbon resource name --------------- Sensor - ID - - GPIO pin - - Junction -''' | |||
''' --- box ----''' | |||
GND 30 Ground 1.1.1 | |||
+3V3 | |||
+5V | |||
roggedomo.boilerroom.humidity DHT22 DHT22-11 32 GPIO 12 1.1.1 | |||
roggedomo.boilerroom.temperature.room DHT22 1.1.1 | |||
roggedomo.boilerroom.temperature.cvin DS18B20 ------ -- GPIO 04 1.1.2 | |||
roggedomo.boilerroom.temperature.cvout DS18B20 ------ -- GPIO 04 1.1.3 | |||
roggedomo.boilerroom.temperature.tap DS18B20 ------ -- GPIO 04 1.1.4 | |||
roggedomo.bedroom.humidity DHT22 DHT22-12 GPIO 1.1.4 | |||
roggedomo.bedroom.temperature DHT22 1.1.4 | |||
roggedomo.bedroom.movement HC-SR501 PIR-11 GPIO 1.1.5 | |||
roggedomo.boilerroom.movement HC-SR501 PIR-11 37 GPIO 1.2.1 | |||
roggedomo.boilerroom.door Reed REED-11 37 GPIO 1.2.1 | |||
roggedomo.crawlspace.humidity DHT22 DHT22-12 36 GPIO 16 1.3.1 4 | |||
roggedomo.crawlspace.temperature DHT22 1.3.1 | |||
roggedomo.crawlspace.temperature.ground DS18B20 111111 37 GPIO 26 1.3.2 | |||
roggedomo.hall.barometer HP206C BARO-11 1.4.1 9 | |||
roggedomo.hall.door Reed REED-12 29 GPIO 5 1.4.2 | |||
roggedomo.hall.doorbell Reed REED-13 31 GPIO 6 1.4.3 | |||
roggedomo.hall.mailbox Reed REED-14 33 GPIO 13 1.4.4 | |||
roggedomo.hall.humidity DHT22 DHT22-13 38 GPIO 20 1.4.5 | |||
roggedomo.hall.temperature DHT22 1.4.5 | |||
roggedomo.hall.movement HC-SR501 PIR-12 13 GPIO 27 1.4.6 | |||
roggedomo.hall.lamp SRD-05VDC RELA-11 11 GPIO 17 1.4.7 | |||
roggedomo.livingroom.humidity DHT22 DHT22-14 40 GPIO 21 1.5.1 5 | |||
roggedomo.livingroom.temperature.ground DHT22 1.5.1 | |||
roggedomo.livingroom.temperature.ground+200 DS18B20 111111 37 GPIO 26 1.5.2 | |||
roggedomo.livingroom.temperature.ground+80 DS18B20 111111 37 GPIO 26 1.5.3 | |||
roggedomo.livingroom.audio.temperature.tuner DS18B20 111111 37 GPIO 26 1.5.4 | |||
roggedomo.livingroom.audio.temperature.amplifier DS18B20 111111 37 GPIO 26 1.5.5 | |||
roggedomo.livingroom.audio.temperature.cd DS18B20 111111 37 GPIO 26 1.5.6 | |||
roggedomo.livingroom.audio.temperature.casette DS18B20 111111 37 GPIO 26 1.5.7 | |||
roggedomo.livingroom.audio.temperature.tape | |||
roggedomo.livingroom.audio.lamp SRD-05VDC RELA-12 35 GPIO 19 1.5.8 | |||
roggedomo.livingroom.audio.current | |||
====== Connector 1-10 Boilerroom ====== | |||
[[File:Roggedomo - Switchbox 1.2.jpg |250px|right|Junction box 1.1]] | |||
[[File:502px-Roggedomo - Switchbox 1 2b.jpg |250px|right|Junction box 1.1b]] | |||
[[File:Roggedomo - Switchbox 1.1. Printconnectors detail.jpg|250px|right|Junction box 1.2]] | |||
[[File:Roggedomo - Switchbox 1.1 plane rear.jpg |250px|right|Junction box 1.2 achterzijde]] | |||
Connector 1-10 | |||
1 2 3 | |||
4 5 6 7 pin-layout chassisdeel | |||
8 9 10 | |||
1 geel Mapping pin naar kleur | |||
2 blauw | |||
3 zwart | |||
4 wit | |||
5 rood | |||
6 oranje | |||
7 paars | |||
8 grijs | |||
9 groen | |||
10 bruin | |||
Connector 4-7 | |||
nok | |||
1 2 | |||
3 4 5 | |||
6 7 | |||
pin connector chassisdeel | |||
1 bruin bruin | |||
2 lichtgroen grijs | |||
3 lichtbruin oranje | |||
4 wit wit | |||
5 groen groen | |||
6 blauw blauw | |||
7 lichtblauw geel | |||
'''1.1. printbanen''' | |||
10 | |||
1 GND zwart | |||
2 +3V3 oranje | |||
3 +5V0 rood | |||
4 paars | |||
5 bruin | |||
6 groen | |||
7 grijs | |||
8 wit | |||
9 geel | |||
10 blauw | |||
11 | |||
12 | |||
13 | |||
14 | |||
15 +5V0 | |||
16 +3V3 | |||
17 GND | |||
'''1.2. printbanen''' | |||
1 GND | |||
2 +3V3 | |||
3 +5V0 | |||
4 | |||
5 | |||
6 | |||
7 | |||
8 | |||
9 | |||
10 | |||
11 | |||
12 | |||
13 | |||
14 | |||
15 | |||
====== Roggeberry2 ====== | |||
'''------------- Carbon resource name ------------ Sensor - ID - ------- GPIO pins ------ - Junction - - Connector -''' | |||
''' Data + Ground - box - - pins -''' | |||
roggedomo.garage.humidity.binnen DHT22 DHT22-1 36 GPIO 16 17 39 2.1.1 | |||
roggedomo.garage.temperature.binnen DHT22 2.1.1 | |||
roggedomo.garage.humidity.buiten DHT22 DHT22-1 38 GPIO 20 17 39 2.1.2 | |||
roggedomo.garage.temperature.buiten DHT22 2.1.2 | |||
roggedomo.garage.crawlspace.humidity DHT22 DHT22-1 40 GPIO 21 17 39 2.1.3 | |||
roggedomo.garage.crawlspace.temperature DHT22 2.1.3 | |||
roggedomo.garage.crawlspace.temperature.ground-20 DS18B20 A2C311 32 GPIO 12 17 39 2.1.4 | |||
roggedomo.garage.temperature.radiator DS18B20 A2F0D9 32 GPIO 12 17 39 2.1.4 | |||
roggedomo.garage.event.zijdeur REED REED-21 29 GPIO 5 17 39 | |||
roggedomo.garage.event.achterdeur REED REED-22 31 GPIO 6 17 39 | |||
roggedomo.garage.event.voordeur.links REED REED-23 33 GPIO 13 17 39 | |||
roggedomo.garage.event.voordeur.rechts REED REED-24 35 GPIO 19 17 39 | |||
roggedomo.garage.verlichting.tuin SRD-05VDC RELA-21 21 GPIO 9 2 39 | |||
roggedomo.garage.verlichting.algemeen SRD-05VDC RELA-22 23 GPIO 11 2 39 | |||
roggedomo.garage.verlichting.werkbank SRD-05VDC RELA-23 37 GPIO 26 2 39 | |||
roggedomo.garage.movement HC-SR501 PIR-21 19 GPIO 10 17 39 | |||
roggedomo.regen.buffer.hoog SWITCH SWITC-21 22 GPIO 25 17 39 | |||
roggedomo.regen.buffer.laag SWITCH SWITC-22 24 GPIO 8 17 39 | |||
roggedomo.regen.buffer.druk SWITCH SWITC-23 26 GPIO 7 17 39 | |||
roggedomo.regen.flow.hemelwater (in) FLOW FLOW-21 16 GPIO 23 17 39 | |||
roggedomo.regen.flow.overloop (spill) FLOW FLOW-22 18 GPIO 24 17 39 | |||
roggedomo.regen.flow.pomp (uit) | |||
====== Roggeberry3 ====== | |||
Camera V2.1 | |||
'''--------- Carbon resource name --------- Sensor - ID - ------- GPIO pins ------ Connector''' | |||
''' Data + Ground ''' | |||
roggedomo.garden.humidity DHT22 DHT22-5 40 GPIO 21 17 39 1 | |||
roggedomo.garden.temperature.ground+120 DHT22 | |||
roggedomo.garden.temperature.ground-40 DS18B20 A2F0D9? 36 GPIO 16 17 34 2 | |||
roggedomo.garden.temperature.ground+10 DS18B20 A29539? ' ' ' ' | |||
roggedomo.garden.temperature.ground+80 DS18B20 A2C311? ' ' ' ' | |||
roggedomo.garden.movement HC-SR501 PIR-2 08 GPIO 14 04 06 | |||
Latest revision as of 18:55, 7 October 2019
Overpeinzingen
Te meten
Digitaal
- Voordeur, deur meterkast, deur cvkast, deur garage-woonkamer, deur garage-achter, deur garage-voor-links-rechts.
- Brievenbus
- Bel
- Uitlezen elektriciteitsmeter, gasmeter, watermeter.
- PIR hal beneden, hal boven, woonkamer, garage.
Analoog
- Temperatuur hal, hal radiator,woonkamer, geluidsinstallatie, meterkast, cvkast, garage, garage radiator. buiten voor, buiten achter, onder de vloer
- Weerstation buiten (wind, temperatuur, zonlicht, CO2, luchtdruk).
Plaatsen voor Arduino
- meterkast
- garage
- hobbykamer
- houthok in tuin
- boom bij cirkel in tuin
Over naar raspberry pi's.
Onderhoud/configuratie met ansible en monitoring met Icinga/Nagios.
Raspberrys verzamelen gegevens en sturen deze iedere minuut naar Atlas. Bewaar de samples als het versturen mislukt en stuur de vorige samples opnieuw. Stuur naar Atlas wanneer samples niet lukte en hoeveel samples er niet en later wel verstuurd zijn.
Naamgeving records Carbon
roggedomo.solar.totalwattstoday roggedomo.solar.wattsnow roggedomo.solar.temperature roggedomo.solar.pv1voltagedc roggedomo.solar.pv2voltagedc roggedomo.solar.pv1currentdc roggedomo.solar.pv2currentdc roggedomo.solar.voltageac roggedomo.solar.currentac roggedomo.solar.frequency roggedomo.solar.totalwattstoday roggedomo.solar.totalkWhsincereset
Sensoren
DHT22 Temperature/humidity
DS18B20 Temperature
Bij verlengen aansluitkabel met cat-5 kabel dient de data en ground aansluiting in hetzelfde twisted pair te zitten. Laat de overige aansluitingen ongemoeid, verbind deze niet met massa.
DS18B20 serienummers:
- A24340
- A2535A
- A2566A
- A29539
- A29A8B
- A2C311
- A2F0D9
- A3BB16
- A3E76A
En waar zijn de reeds aangesloten sensoren
- DE70FF
- E252FF
RTC DS1307
Real Time Clock module met CR1220 knoopcel.
HC-SR501 Bewegingsensor
Gevoeligheid: Je kunt de afstand waarover de sensor werkt aanpassen (3m tot 7m).
Output timing: Deze instelling regelt hoe lang de uitgang hoog wordt gehouden na de sensor wordt geactiveerd (5 seconden tot 300 seconden).
Jumper Auto reset: De sensor blijft geactiveerd totdat de beweging stopt.
Jumper Geen reset: De sensor blijft de ingestelde ‘Output timing' periode geactiveerd bij de detectie van een beweging.
YF-S201 Waterflow Sensor
Er is ook een groter model (YF-G1 DN25 1inch Water Flow Sensor) max 100L/min.
Aansluitdraden:
- Zwart - Ground
- Rood - Vcc 5V
- Geel - Signal / Data
Sample code:
#!/usr/bin/env python
import RPi.GPIO as GPIO
import time, sys
FLOW_SENSOR = 23
GPIO.setmode(GPIO.BCM)
GPIO.setup(FLOW_SENSOR, GPIO.IN, pull_up_down = GPIO.PUD_UP)
global count
count = 0
def countPulse(channel):
global count
count = count+1
print count
GPIO.add_event_detect(FLOW_SENSOR, GPIO.FALLING, callback=countPulse)
while True:
try:
time.sleep(1)
except KeyboardInterrupt:
print '\ncaught keyboard interrupt!, bye'
GPIO.cleanup()
sys.exit()
Debounce code:
#initialise a previous input variable to 0 (assume button not pressed last)
prev_input = 0
while True:
#take a reading
input = GPIO.input(17)
#if the last reading was low and this one high, print
if ((not prev_input) and input):
print("Button pressed")
#update previous input
prev_input = input
#slight pause to debounce
time.sleep(0.05)
Samples queuen
Pseudo code
If Sample Ok
Then
Send Sample to server
If Send Ok
Then
If sample files found
Then
Do while sample files available
send sample to server
if Send Ok
then
Remove sample file
else
Log error retry sample failed
Fi
Done
Else
nop
Fi
Else
Store sample as a file in directory
Fi
Else
Tell Sample failed
Fi
Pseudo code variant eerst schrijven naar file in directory
Uitbreiden met nagios monitoring en retries inzichtelijk maken.
If Sample Ok
Then
write sample to file
If write-ok
Then
Do while sample files available
send sample to server
if Send Ok
then
Remove sample file
else
Log error retry sample failed
Fi
Done
Else
tell write failed
Fi
Else
Tell Sample failed
Fi
Aap
pi@roggeberry1:~ $ cat /home/pi/sample/sample.py
#!/usr/bin/python2
import sys
import time
import os
import platform
import subprocess
from socket import socket
import Adafruit_DHT
CARBON_SERVER = '192.168.2.100'
CARBON_PORT = 2003
sock = socket()
try:
sock.connect( (CARBON_SERVER,CARBON_PORT) )
except:
print "Couldn't connect to %(server)s on port %(port)d, is carbon-agent.py running?" % { 'server':CARBON_SERVER, 'port':CARBON_PORT }
sys.exit(1)
def gettemp(id):
try:
mytemp=
filename = 'w1_slave'
f = open('/sys/bus/w1/devices/' + id + '/' + filename, 'r')
line = f.readline()
crc = line.rsplit(' ',1)
crc = crc[1].replace('\n',)
if crc=='YES':
line = f.readline()
mytemp = line.rsplit('t=',1)
else:
mytemp = 0
f.close()
return int(mytemp[1])
except:
return 0
humidity, temperature = Adafruit_DHT.read_retry(Adafruit_DHT.DHT22, 4)
humidity = round(humidity, 2)
temperature = round(temperature, 2)
if humidity is not None and temperature is not None:
now = int( time.time() )
lines = []
#We're gonna report all three loadavg values
lines.append("roggedomo.livingroom.temperature %s %d" % (temperature,now))
lines.append("roggedomo.livingroom.humidity %s %d" % (humidity,now))
lines.append("roggedomo.livingroom.ground.temperature %s %d" % (gettemp('28-051691de70ff')/float(1000),now))
lines.append("roggedomo.livingroom.floor.temperature %s %d" % (gettemp('28-051691e252ff')/float(1000),now))
message = '\n'.join(lines) + '\n' #all lines must end in a newline
print "sending message\n"
print '-' * 80
print message
print
sock.sendall(message)
else
print 'No data from DHT22'
pi@roggeberry1:~ $
ADC
MCP3008
8 analoge input channels met 10-bit resolutie.
ADS1x15
4 input channels met 12/16-bit precisie en instelbare gevoeligheid/versterking. ADS1015 12 bits precisie en ADS1115 met 16-bit precisie.
Raspberries
Meterkast
Host roggeberry2.
DHT22 pin 1 5V (3.3?)
pin 2 Data
pin 3 Not connected
pin 4 Ground
Pullup 10k resistor between pin 1 and 2
DS18B20 rood 3V0 - 5V5
groen Ground
geel Data
UTP kabel DS18B20 oranje --> connector rood (onder) wit --> connector geel (links) Kijkend naar voorzijde wcd) groen --> connector groen (rechts)
HP206C
zwart Ground
rood +5V
wit SDA
geel SCL
HC SR-501
zwart GND
geel Output
rood VCC +5V
Sensoren
Roggeberry2
---------------- Carbon resource name --------------- Sensor - ID - - GPIO pin - - Junction -
--- box ----
GND 30 Ground 1.1.1
+3V3
+5V
roggedomo.boilerroom.humidity DHT22 DHT22-11 32 GPIO 12 1.1.1
roggedomo.boilerroom.temperature.room DHT22 1.1.1
roggedomo.boilerroom.temperature.cvin DS18B20 ------ -- GPIO 04 1.1.2
roggedomo.boilerroom.temperature.cvout DS18B20 ------ -- GPIO 04 1.1.3
roggedomo.boilerroom.temperature.tap DS18B20 ------ -- GPIO 04 1.1.4
roggedomo.bedroom.humidity DHT22 DHT22-12 GPIO 1.1.4
roggedomo.bedroom.temperature DHT22 1.1.4
roggedomo.bedroom.movement HC-SR501 PIR-11 GPIO 1.1.5
roggedomo.boilerroom.movement HC-SR501 PIR-11 37 GPIO 1.2.1
roggedomo.boilerroom.door Reed REED-11 37 GPIO 1.2.1
roggedomo.crawlspace.humidity DHT22 DHT22-12 36 GPIO 16 1.3.1 4 roggedomo.crawlspace.temperature DHT22 1.3.1 roggedomo.crawlspace.temperature.ground DS18B20 111111 37 GPIO 26 1.3.2
roggedomo.hall.barometer HP206C BARO-11 1.4.1 9 roggedomo.hall.door Reed REED-12 29 GPIO 5 1.4.2 roggedomo.hall.doorbell Reed REED-13 31 GPIO 6 1.4.3 roggedomo.hall.mailbox Reed REED-14 33 GPIO 13 1.4.4 roggedomo.hall.humidity DHT22 DHT22-13 38 GPIO 20 1.4.5 roggedomo.hall.temperature DHT22 1.4.5 roggedomo.hall.movement HC-SR501 PIR-12 13 GPIO 27 1.4.6 roggedomo.hall.lamp SRD-05VDC RELA-11 11 GPIO 17 1.4.7
roggedomo.livingroom.humidity DHT22 DHT22-14 40 GPIO 21 1.5.1 5 roggedomo.livingroom.temperature.ground DHT22 1.5.1 roggedomo.livingroom.temperature.ground+200 DS18B20 111111 37 GPIO 26 1.5.2 roggedomo.livingroom.temperature.ground+80 DS18B20 111111 37 GPIO 26 1.5.3 roggedomo.livingroom.audio.temperature.tuner DS18B20 111111 37 GPIO 26 1.5.4 roggedomo.livingroom.audio.temperature.amplifier DS18B20 111111 37 GPIO 26 1.5.5 roggedomo.livingroom.audio.temperature.cd DS18B20 111111 37 GPIO 26 1.5.6 roggedomo.livingroom.audio.temperature.casette DS18B20 111111 37 GPIO 26 1.5.7 roggedomo.livingroom.audio.temperature.tape roggedomo.livingroom.audio.lamp SRD-05VDC RELA-12 35 GPIO 19 1.5.8 roggedomo.livingroom.audio.current
Connector 1-10 Boilerroom
Connector 1-10
1 2 3 4 5 6 7 pin-layout chassisdeel 8 9 10
1 geel Mapping pin naar kleur 2 blauw 3 zwart 4 wit 5 rood 6 oranje 7 paars 8 grijs 9 groen 10 bruin
Connector 4-7
nok 1 2 3 4 5 6 7
pin connector chassisdeel 1 bruin bruin 2 lichtgroen grijs 3 lichtbruin oranje 4 wit wit 5 groen groen 6 blauw blauw 7 lichtblauw geel
1.1. printbanen
10 1 GND zwart 2 +3V3 oranje 3 +5V0 rood 4 paars 5 bruin 6 groen 7 grijs 8 wit 9 geel 10 blauw 11 12 13 14 15 +5V0 16 +3V3 17 GND
1.2. printbanen
1 GND 2 +3V3 3 +5V0 4 5 6 7 8 9 10 11 12 13 14 15
Roggeberry2
------------- Carbon resource name ------------ Sensor - ID - ------- GPIO pins ------ - Junction - - Connector -
Data + Ground - box - - pins -
roggedomo.garage.humidity.binnen DHT22 DHT22-1 36 GPIO 16 17 39 2.1.1
roggedomo.garage.temperature.binnen DHT22 2.1.1
roggedomo.garage.humidity.buiten DHT22 DHT22-1 38 GPIO 20 17 39 2.1.2
roggedomo.garage.temperature.buiten DHT22 2.1.2
roggedomo.garage.crawlspace.humidity DHT22 DHT22-1 40 GPIO 21 17 39 2.1.3
roggedomo.garage.crawlspace.temperature DHT22 2.1.3
roggedomo.garage.crawlspace.temperature.ground-20 DS18B20 A2C311 32 GPIO 12 17 39 2.1.4
roggedomo.garage.temperature.radiator DS18B20 A2F0D9 32 GPIO 12 17 39 2.1.4
roggedomo.garage.event.zijdeur REED REED-21 29 GPIO 5 17 39 roggedomo.garage.event.achterdeur REED REED-22 31 GPIO 6 17 39 roggedomo.garage.event.voordeur.links REED REED-23 33 GPIO 13 17 39 roggedomo.garage.event.voordeur.rechts REED REED-24 35 GPIO 19 17 39 roggedomo.garage.verlichting.tuin SRD-05VDC RELA-21 21 GPIO 9 2 39 roggedomo.garage.verlichting.algemeen SRD-05VDC RELA-22 23 GPIO 11 2 39 roggedomo.garage.verlichting.werkbank SRD-05VDC RELA-23 37 GPIO 26 2 39 roggedomo.garage.movement HC-SR501 PIR-21 19 GPIO 10 17 39 roggedomo.regen.buffer.hoog SWITCH SWITC-21 22 GPIO 25 17 39 roggedomo.regen.buffer.laag SWITCH SWITC-22 24 GPIO 8 17 39 roggedomo.regen.buffer.druk SWITCH SWITC-23 26 GPIO 7 17 39 roggedomo.regen.flow.hemelwater (in) FLOW FLOW-21 16 GPIO 23 17 39 roggedomo.regen.flow.overloop (spill) FLOW FLOW-22 18 GPIO 24 17 39 roggedomo.regen.flow.pomp (uit)
Roggeberry3
Camera V2.1
--------- Carbon resource name --------- Sensor - ID - ------- GPIO pins ------ Connector
Data + Ground
roggedomo.garden.humidity DHT22 DHT22-5 40 GPIO 21 17 39 1
roggedomo.garden.temperature.ground+120 DHT22
roggedomo.garden.temperature.ground-40 DS18B20 A2F0D9? 36 GPIO 16 17 34 2
roggedomo.garden.temperature.ground+10 DS18B20 A29539? ' ' ' '
roggedomo.garden.temperature.ground+80 DS18B20 A2C311? ' ' ' '
roggedomo.garden.movement HC-SR501 PIR-2 08 GPIO 14 04 06