Environment Monitor

For my first mini project of 2017, I will be trying out a couple of software tools I haven’t used before: Etcher, Adafruit IO and Fusion 360. With the help of these tools, I will create a wall mounted environment monitor with a Pi Zero and Enviro pHAT.

Burn Image with Etcher

Up until now, I’ve always been using the command line to burn images onto SD cards, using “dd”. This process requires various commands to determine the device name, unmount and flash it.

Recently, LifeHacker posted an article about Etcher, a new, super easy to use tool to burn images onto SD cards. It’s cross-platform, so it works on Windows, Linux and Mac!

The first step is to select an image. In this particular case, I used the latest Raspbian image. For the second step, the tool automatically tries to determine which device represents the SD card, so no action should be required unless multiple flash drives are connected. Finally, the flash process can be started. After a couple of minutes, the image is burned on the SD card!

To enable wifi and ssh without hooking up the Pi to a display:

  • put an empty file called “ssh” on the SD card
  • put a file called “wpa_supplicant.conf” with your network’s SSID and key:
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev

    ssid="<your ssid>"
    psk="<your key>"

After boot, connect via SSH, and:

  • expand the filesystem
  • update the hostname
  • update the default SSH password
  • upgrade the installed packages
pi@raspberrypi:~ $ sudo raspi-config
pi@enviropi:~ $ sudo apt-get update && sudo apt-get upgrade -y

Monitor with Enviro pHAT

The Enviro pHAT is one of the many awesome pHATs by Pimoroni. It has a bunch of sensors on board to monitor your environment (pressure, temp, light, colour and motion) and some analog inputs to add your own.


As with many of their pHATs, the software can be installed with a single command:

pi@enviropi:~ $ curl -sS | bash

The installation process will install the necessary files and enable the required interfaces such as I2C for example.

Mounting Plate with Fusion 360

Earlier this week, my prize for the Pi IoT Design Challenge finally arrived: the CEL Robox 3D printer. So creating a mounting plate for the Pi Zero would be a great test for printing accuracy.

I normally design models in SketchUp, but seeing so many people use Fusion 360, I thought I’d give it a try as well. The software can be downloaded as a trial version, but makers, hobbyists and startups can activate it for free!
At first, the software was a bit intimidating, but I rather quickly managed to sketch something basic based on the Pi Zero’s dimensions.

The STL file of the model has been uploaded on Thingiverse so anyone with access to a 3D printer can download and print it.

I printed the mounting plate with a resolution of 0.2mm and it fit without any post-processing!

Display with Adafruit IO

Adafruit IO (currently in beta) is an online system by Adafruit, that allows you to make data connections easily and with very little programming. Using various building blocks like buttons, sliders, graphs, etc … custom dashboards can be created to visualise your data.

The blocks are linked to feeds, which provide the data. The feeds are automatically created when using the client, but keep in mind that (due to the beta?) there is a limit of 10 feeds. For this particular application, this is enough.


A Python client is available on Adafruit’s GitHub page and can be installed easily, as follows:

pi@enviropi:~ $ git clone
pi@enviropi:~ $ cd io-client-python
pi@enviropi:~/io-client-python $ sudo python install

I’ve created following script, capable of sending the data from the Enviro pHAT straight to IO. Don’t forget to put your own IO client ID!

By adding the script to cron, it can be executed every minute, or whatever desired interval, automatically. To do this, use the crontab command:

pi@enviropi:~ $ sudo crontab -e

# m h dom mon dow command
* * * * * /home/pi/io-client-python/

Et voila, that’s it, data should start appearing in the IO dashboard and be updated every minute.

What will you be monitoring? Let me know in the comments!

© Frederick Vandenbosch, 2014-2021. Unauthorised use and/or duplication of this material without express and written permission from this blog’s author and owner is strictly prohibited. Excerpts and links may be used, provided that full and clear credit is given to Frederick Vandenbosch with appropriate and specific direction to the original content.