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:
After boot, connect via SSH, and:

  • expand the filesystem
  • update the hostname
  • update the default SSH password
  • upgrade the installed packages

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:

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:

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:

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!

4 thoughts on “Environment Monitor

  1. Cool Frederick (via fb/raspberrypirates). Heb je al wat test results? Kan die color reader kleur lezen? En zo ja, hoe precies is dat (in hex?).

    1. Hey Wouter,

      de color reader zelf heb ik niet geprobeerd, maar de andere sensoren wel. De Python library is super gemakkelijk.
      De color sensor geeft 3 waarden terug: R, G en B, elk tussen 0 en 255.

Leave a Reply

Your email address will not be published. Required fields are marked *