Download Raspbian Jessie:

wget -c http://212.187.212.130/bt/dffe8144ecd9af3961fdf142e39794e038f1cfc5/data/2015-09-24-raspbian-jessie.zip
unzip 2015-09-24-raspbian-jessie.zip
rm 2015-09-24-raspbian-jessie.zip

Put in an SD card and check what disks (if any) were auto-mounted:

df -h | grep media
/dev/mmcblk0p3            27M  397K   25M   2% /media/marek/SETTINGS
/dev/mmcblk0p6           6.3G  2.4G  3.6G  41% /media/marek/root
/dev/mmcblk0p5            60M   15M   46M  24% /media/marek/boot

Unmount (any) auto-mounted disks before the install:

umount /media/marek/SETTINGS /media/marek/root /media/marek/boot

Install Raspbian Jessie on the card.

Note

the following command takes a long time to run.

Note

/dev/mmcblk0 is the SD card in my case. It can be different.

sudo dd bs=4M if=2015-09-24-raspbian-jessie.img of=/dev/mmcblk0

Futher info: https://www.raspberrypi.org/documentation/installation/installing-images/linux.md

Setup

SSH into the RPi:

ssh pi@192.168.1.106 # default password is raspberry

Basic upgrade and network setup:

sudo su -
rpi-update
vim /etc/network/interfaces    # change network config and assign static ip
vim /etc/hostname              # change to name of the RPi eg. brew-station
vim /etc/hosts                 # ditto
reboot

/etc/network/interfaces:

auto lo
iface lo inet loopback

#auto eth0
#allow-hotplug eth0
#iface eth0 inet manual
iface eth0 inet static
address 192.168.1.133
netmask 255.255.255.0
gateway 192.168.1.1
dns-domain brew.kuziel.nz
dns-nameservers 8.8.8.8

#auto wlan0
#allow-hotplug wlan0
#iface wlan0 inet manual
#wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

#auto wlan1
#allow-hotplug wlan1
#iface wlan1 inet manual
#wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

Further upgrade:

apt-get update
apt-get upgrade
apt-get install vim
raspi-congig                           # resize img + other config options
reboot

Brew Station

Install required packages:

apt-get install python3-mosquitto      # may not need Python client just yet
apt-get install python3-w1thermsensor
apt-get install mosquitto-clients

Add DS18B20 (one-wire) to /boot/config.txt:

dtoverlay=w1-gpio

Then reboot.

Test if the new devices exist after the reboot:

root@brew-station:~# ls -l /sys/bus/w1/devices/
total 0
lrwxrwxrwx 1 root root 0 Oct 25 05:52 28-0000049581c8 -> ../../../devices/w1_bus_master1/28-0000049581c8
lrwxrwxrwx 1 root root 0 Oct 25 05:52 28-031466351eff -> ../../../devices/w1_bus_master1/28-031466351eff
lrwxrwxrwx 1 root root 0 Oct 25 05:52 w1_bus_master1 -> ../../../devices/w1_bus_master1

Test Python script:

from w1thermsensor import W1ThermSensor

for sensor in W1ThermSensor.get_available_sensors():
    print("Sensor %s has temperature %.2f" % (sensor.id, sensor.get_temperature()))

Run the test script:

root@brew-station:~# python3 t.py
Sensor 0000049581c8 has temperature 19.81
Sensor 031466351eff has temperature 17.88

Warm up one of the sensors to find out which one is which:

  • 031466351eff = IN (water-proof)
  • 0000049581c8 = OUT

Python scripts for both sensors:

root@brew-station:~# cat in.py
from w1thermsensor import W1ThermSensor
sensor = W1ThermSensor(W1ThermSensor.THERM_SENSOR_DS18B20, "031466351eff")
print(sensor.get_temperature())

root@brew-station:~# cat out.py
from w1thermsensor import W1ThermSensor
sensor = W1ThermSensor(W1ThermSensor.THERM_SENSOR_DS18B20, "0000049581c8")
print(sensor.get_temperature())

Comments

comments powered by Disqus