Getting mobile notifications from Raspberry Pi GPIO

raspberrypi

In first place we need to setup the GPIO monitoring code. This code moraspberry-pi-logonitors every 5 seconds if the state of the GPIO pin 25 has changed. If so, it makes a post to the Maker IFTTT channel.

It’s important to replace <maker-key> with your maker channel key and <eventname> with your recipe event name.

If we’re executing the code through SSH we need to execute the code in background. To do that you can use screen. Remeber giving execution access to the file.

chmod +x program.py
screen gpio
python program.py &

Then we need to set up the IFTTT recipe:

IF Maker channel post then Notification.

With IFTTT we could use other recipes such as making a log with the Google Spreadsheet channel or a Evernote Log.

With this setup we could attach to the GPIO pin a digital sensor and monitor it in our smartphone. If we attach a switch we are doing a physical DO recipe.