Purpose Input Output (GPIO) pins that can be used to connect to electronics. These pins allow connecting electronics directly to the system. This is really powerful
3 pins: 1. With the flat side of the sensor facing you connect the pin on the right to the 3.3v pin on the raspberry PI. 2. Connect the pin on the left to a GND pin on the Raspberry PI. 3. Connect the middle pin to the Pin labeled #4 4. Use a 4.7k resistor to connect the right and middle pins.
the sqlite python module for logging the temperature data. SD-Cards like the ones in the Raspberry Pi can only handle a limited number of writes. Left running, and sd-card failed after about a month.
memory • Writes to disk/sd-card are configurable • Can replicate the data to another computer over a network without writing to the sd-card. • Easy to understand
from time import sleep def read_temp_c(): with open('/sys/bus/w1/devices/28-000006b63824/w1_slave') as device: for line in device: value = line.strip().split()[-1] if value.startswith('t='): return float(value[2:])/1000.0 redis_connection = StrictRedis('/var/lib/temp.rdb') temp_readings = List(redis=redis_connection, key='temp_readings') while True: temp_readings.append(read_temp_c()) print('Temp C:', temp_readings[-1]) sleep(1)
StrictRedis from redis_collections import List from time import sleep def read_temp_c(): with open('/sys/bus/w1/devices/28-000006b63824/w1_slave') as device: for line in device: value = line.strip().split()[-1] if value.startswith('t='): return float(value[2:])/1000.0 redis_connection = StrictRedis('/var/lib/temp.rdb', serverconfig={'port': '8002', 'requirepass': 'secret'}) temp_readings = List(redis=redis_connection, key='temp_readings') while True: temp_readings.append(read_temp_c()) print('Temp C:', temp_readings[-1]) sleep(1)