Make a motion-activated lamp using IFTTT
In this section, we are now going to use what we learned in this chapter and combine it with what we already learned in the previous chapters about the web service IFTTT. We are going to use this knowledge to build a lamp that is automatically activated when motion is detected by a motion sensor.
For this section, you will need two Raspberry Pi modules: one with a motion sensor and one connected to a lamp via the PowerSwitch tail. To learn how to assemble these modules, please refer to the previous chapters of the book.
This is the assembled Raspberry Pi Zero with a PIR motion sensor on GPIO18:
We are first going to create the IFTTT recipes so you and the two boards can communicate. First, make sure that the Maker channel is activated on your IFTTT account:
Then, create a new recipe, with the Maker channel as the trigger:
For the event, enter motion_detected
:
Choose the Maker channel as the action channel:
For the action itself, choose Make a web request...