3

(coco) #1
FORGE

PREPARING THE SOFTWARE
Download and install Raspbian to an SD card –
Raspbian Lite is perfect for this project. During
setup you will need a monitor and keyboard
attached, but these can be removed once the
system in installed in place.
Once the Raspberry Pi has started, run the
raspi-config utility:


sudo raspi-config

Under ‘Interfacing Options’, enable the
1-Wire interface.
It is also useful to enable SSH at the same time
to allow remote access to the Raspberry Pi so you
don’t need to dismantle everything if the code
needs to be tweaked. Make sure you change the
default password when you do this.
It’s also at this stage you need to ensure the Pi
can connect to your WiFi network so that data can
be uploaded.


INSTALLING THE REQUIRED PYTHON
LIBRARIES
Additional Python libraries are required for the
Blinkt! LEDs and for pygsheets, which will be used
to upload the data to Google Sheets.
Installation of the Blinkt! packages is done by
entering this Terminal command:


curl https://get.pimoroni.com/blinkt | bash

Installation of pygsheets is achieved by
entering this command:
pip install pygsheets

THE PYTHON SCRIPT
The full code can be downloaded from
hsmag.cc/issue4.

EXPLAINING THE CODE
The script is made up of 7 key sections:

PART 1
Import libraries
The non-standard functions are loaded.

PART 2
Key variables are defined
There are two areas that need to be manually
customised for each project:


  1. temp_max is the temperature you consider to
    be fully hot, and temp_min is the temperature
    where it’s no longer hot enough – it may take
    a few days of experimenting to find the ideal
    settings for these.

  2. Then there is a list of eight sensor addresses.
    These will be different for every project, so
    you must find the correct 64-bit serial numbers
    for your sensors and change them


1

3

5

7

9

11

4.7K Ω

Above
All eight sensors
are wired in series,
with a single 4.7 kΩ
resistor between
data and 3.3 V
Free download pdf