The Official Raspberry Pi Projects Book - Projects_Book_v4

(singke) #1

Tutorial WALKTHROUGH


(^106) The Official Raspberry Pi Projects Book raspberrypi.org/magpi
WINE SAVER:
ROOM TEMPERATURE MONITOR
This project monitors the temperature of a wine storage room hourly,
and sends an email when it exceeds an ‘alarm’ or ‘fail’ level
our author has a wine storage unit in his garage,
and over the last 20 years the compressor has
failed twice during extreme heatwaves. We
weren’t constantly checking the temperature display, so
had no warning of the impending failures, which would
have allowed us to move the wine to an air-conditioned
location and have the compressor repaired. This project
provides hourly logging of the temperature, and sends
warning emails if the temperature exceeds set limits.
Software setup
Download and install the latest version of Raspbian
Jessie Lite on your microSD card. Initialise Raspbian
with sudo raspi-config to the proper international
options (time zone, keyboard, wireless country
code, etc.), change the default password, and set the
host name in advanced options to something like
‘wineroom’. Make sure that you enable both SSH and
1-Wire in the Interface section of raspi-config.
Reboot (otherwise your keyboard settings may not be
correct), and set up the wireless by editing the relevant
config file: sudo nano /etc/wpasupplicant/wpa
supplicant.conf. Add these lines to the end.



Pi Zero W Y
4GB (or larger)
microSD card
Suitable case
for the Pi
Waterproof
DS18B20
temperature
sensor
Stacking header
Gmail account
Empty wine
bottle and a cork
that fits it
You’ll
Need
BILL BALLARD
Bill is a retired physicist who got
back to his programming roots to
find fun things to do with his ten
Raspberry Pi boards.
github.com/wpballa
network={
ssid="your ssid"
psk="your password"
key-mgmt=WPA-PSK
}
Be sure to replace "your ssid" and "your
password" with the actual values for your network,
and keep the quotes. Now reboot again.
Use the ifconfig command to see the IPv4 address
that you will need to SSH into the Pi later. Write it
down (192.168.1.27 or 10.0.0.27 are typical values).
Now you should run the usual update and upgrade to
the operating system:
sudo apt-get update && sudo apt-get upgrade –y
Next, install the mail and ssmtp applications:
sudo apt-get install ssmtp heirloom-mailx
Edit the ssmtp configuration file to point to your
Gmail account as shown. Add the text below to the end
Note the sensor
connections to the
header for the GPIO
A temperature sensor is installed
in the cork, passing through into
the water in the bottle
The Raspberry Pi installed on the chiller unit using Velcro


Free download pdf