Pi Zero visual appointment reminder

By Russell Barnes. Posted

Make a simple, visual calendar reminder using a Raspberry Pi Zero W, Blinkt! LED strip, and the Google Calendar API

It’s easy to get distracted at work and miss the Google Calendar reminders on your desktop and smartphone, especially if you have back-to-back meetings. To help avoid missing meetings, let’s create a Pi Reminder project, a visual notifier that uses the Raspberry Pi and a bunch of LEDs to remind you about upcoming appointments. Being visual-only, it has the advantage of not interrupting important phone calls or chats. The new Pi Zero W and Blinkt! have everything you need in a small, unobtrusive package. An easy project with very little setup.

The full article can be found in The MagPi 58 and was written by John M Wargo.

Notifications

The Pi connects to a Google Calendar account every minute and checks for upcoming appointments. When it finds one, it flashes the Blinkt! LEDs for following alerts:

  • White @ 10 minutes until 5 minutes
  • Yellow @ 5 minutes until 2 minutes
  • Orange @ 2 minutes

You can easily change the code to flash the lights in any colour or pattern you want.

Implementation

To assemble the hardware, follow the setup instructions for the Pimoroni Pi Zero W Starter Kit. Next, download the latest version of Raspbian and follow the installation instructions. Insert the SD card into the Pi, connect a keyboard, mouse, and a monitor to the Pi using the cables that come with the starter kit, and, finally, power it up using a smartphone charger or some suitable power source. Connect the Pi to your Wireless network.

When the Pi is connected to the network and ready to go, open a Terminal window and update the device’s software using the following commands:

sudo apt-get update
sudo apt-get upgrade

Install the Blinkt! Python libraries and example applications by executing the following command:

curl -sS get.pimoroni.com/blinkt | bash

Next, download the project source code. In the Terminal window, execute the following command:

git clone https://github.com/johnwargo/Pi-Remind-Zero-Blinkt

This will download and extract the project source code to the Pi-Remind-Zero-Blinkt folder. Change to the new folder using the following command:

cd Pi-Remind-Zero-Blinkt

Before you can use the project’s software, you must set up an account with Google so the app can consume the Google Calendar APIs. To set up your account, read the Google Calendar API Python Quickstart and follow its instructions to create your account.

Create a new Google Calendar API application, then download the application’s client secret to a file called client_secret.json in the reminder project’s folder. Be sure to name the downloaded file using that file name. You’ll need it to authorise the app to access your Google Calendar, and that particular file name is hard-coded into the project’s main Python app (remind.py).

Now, install the Google Calendar API Python files along with some other required libraries using the following command:

sudo pip install --upgrade google-api-python-client python-dateutil pytz httplib2 oauth2client

With everything in place, execute the reminder app using the following command:

sudo python ./remind.py

The application will launch, validate its configuration, and then warn you that there’s additional configuration that must be completed, as shown below.

 Initial loading of the Pi Reminder app requires access to your Google Calendar account

Before the app can access the calendar, you’ll need to authorise the app to use the Google Calendar API for your calendar account. The browser will launch and walk you through the process. It starts by prompting you to log in to the Google account for the calendar you want the app to monitor. Enter the email address associated with that account and work through the authorisation process until the browser prompts you to approve the application’s access to your calendar (below). Be sure to click the Allow button to authorise access.

 You must authorise the Pi Reminder application to access your Google Calendar

At this point, the application will access your calendar and start notifying you of your upcoming appointments.

Remember though, if you ever change Google calendars (from a work to a personal calendar or from one work calendar profile to another), you’ll need to whack the existing access token created during the initial startup of the Pi Reminder app. Instructions for deleting the token are available online.

Starting the reminder application automatically

Now that you have the application running, let’s configure the Pi to start the application at boot.

Press CTRL+C to kill the running reminder application. Now, make the project’s Bash script file executable by executing the following command:

chmod +x start-remind.sh

Open the pi user’s session autostart file using the following command:

sudo nano ~/.config/lxsession/LXDE-pi/autostart

Add the following line to the end (bottom) of the file:

@lxterminal -e /home/pi/Pi-Remind-Zero-Blinkt/start-remind.sh

Save your changes: press CTRL+O, then the ENTER key. Next, press CTRL+X to exit the application.

Reboot the Raspberry Pi; when it restarts, the Python remind process should execute in its own Terminal window.

From The MagPi store

Subscribe

Subscribe to the newsletter

Get every issue delivered directly to your inbox and keep up to date with the latest news, offers, events, and more.