As I mentioned before, I got a Raspberry Pi Zero W to replace my Arduino MKR WIFI 1010 and ENV board in the bathroom. My Pimoroni Enviro Mini pHAT (or bonnet, as Adafruit calls them) finally arrived a few days ago, so I setup a git repository for my code. The Pimoroni git Enviro+/Enviro Mini repository has a one-line configuration, but I’d rather do things manually so I know what I’m doing and also so I can set up a proper requirements.txt in my Python venv.

  1. sudo apt install python3 venv
  2. In my development directory: python3 -m venv .
  3. activate the virtual environment: source bin/activate
  4. pip install enviroplus
  5. Enable I2C and SPI. Either use: sudo raspi-config interactively or their commands. I went for interactive.
  6. I’m not using the Enviro+ and air quality monitor, so I don’t need to enable the serial interface.
  7. install a few more dependencies: pip install numpy smbus setuptools Pillow Rpi.GPIO

That should give you a system that’s ready to work with the pHAT. So I cloned Pimoroni’s repo and ran the in the virtual environment. Turns out if you install numpy via pip and not apt, you’re missing a dependency. So you EITHER need to run

sudo apt install python3-numpy OR sudo apt install libatlas-base-dev

I did the latter.

You will also need to run

sudo apt install python3-pil libopenjp2-7-dev

to make sure you have some dependencies on the system.

The all-in-one-enviro-mini script produces a graph on the screen. To change the graphs, cover the light sensor. It’s the demo that’s on the Adafruit site. It’s not quite what I wanted to base things on. But at least I knew it was now working. Note: Control-C will quite the program, but will not turn off the screen. It just stops updating.

After taking a look at the various examples they have on there, it looks like I’m going to want to base my code on My goals will be to:

  • add MQTT via the Paho library so it can communicate with Home Assistant (or anything else I hook up to MQTT)
  • set it up to turn off the screen at night when we’re asleep (no need to burn out the LEDs if no one’s going to be looking)
  • change the temperature to Fahrenheit
  • set it up to start when the Raspberry Pi starts.
Raspberry Pi Zero W with Pimoroni Enviro Mini pHAT
Raspberry Pi Zero W with Pimoroni Enviro Mini pHAT

Published by Eric Mesa

To find out a little more about me, see About Me