Nightscout Notification Light with a Raspberry Pi Zero W - Part 1

Primarily, the hardware consists of a Raspberry Pi Zero W and a Pimoroni Blinkt LED hat.  To make things easy, I ordered the Zero W with the headers pre-installed.


You'll also need a basic usb charging brick and usb-b micro cable for power, and a micro SD card for the OS and storage.  Again, to make things easy I ordered a micro SD card with raspbian stretch lite pre-installed when I ordered the Zero.

There are a number of ways to get your Zero up and running.  You can use a micro HDMI cable and OTG usb cable to connect the pi to a TV/monitor and keyboard.  You can use a console cable to directly connect over a serial connection.  You can enable wifi and ssh and connect that way as well.

Since we'll need wifi anyway, and I didn't have an OTG cable handy, I opted for the wifi & ssh route.  This was fairly straightforward, but I did have to re-flash the OS once using etcher.  It just wasn't working and I was pulling my hair out.  Started with a new fresh copy on the SD card, and it worked the first time.

This post was pretty helpful on setting up the wifi.  Here's a basic rundown of the steps:
  1. Mount the SD card by connecting it to your computer.  It should show up with a label of "boot"
  2. On the "boot" drive that you mounted, you'll need to create 2 files.
    1. First is an empty file named "ssh".  Make sure there's no extension on the filename.  This file tells raspbian to enable ssh.
    2. Second is a file named "wpa-supplicant.conf".  This is where your wifi settings go, and the file contents should look like this:

    3. country=US
      ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
      update_config=1
      network={
          ssid="your_real_wifi_ssid"
          scan_ssid=1
          psk="your_real_password"
          key_mgmt=WPA-PSK
      }
      

  3. Eject the SD card and pop it into your Zero.  Plug in the power and give it 90 seconds to boot up.
  4. Now you should be able to use ssh to connect.  If you're using a windows computer, you may need to install bonjour first - see here.  Note that the default password should be "raspberry"
    ssh pi@raspberrypi.local
    

Once you've got the Zero up and running, and you're able to connect via ssh, we're ready to move on to Part 2 - how to access your Nightscout data

Comments