Continuing from Part 1 where we setup Alexa voice service with the Raspberry Pi, this post will conclude and demonstrate the home automation system that we set out to build. So let’s check out the nitty gritty of building the final solution using Amazon Alexa.
Follow the schematic and make the connections. The SSR Trigger is connected to the GPIO18. (Note that this schematic does not show the speaker and mic connections that was covered in part 1)
Once the hardware part is ready, let’s setup the web part 다운로드.
PubNub is a global Data Stream Network (DSN) and realtime infrastructure-as-a-service (IaaS) company based in San Francisco, California. The company makes products for software and hardware developers to build realtime web, mobile, and Internet of Things (IoT) applications – source Wikipedia 넷믹스.
In this demo, we are using PubNub to signal the light switch on/off commands from IFTTT cloud to RPi.
Follow the steps for obtaining API Keys for Data Messaging,
PubNub provides 70+ SDK’s for various programming languages, for this project we need to follow the following SDK’s,
IFTTT is a free web-based service that allows users to create chains of simple conditional statements, called “recipes”, which are triggered based on changes to other web services such as Gmail, Facebook, Instagram, and Pinterest. IFTTT is an abbreviation of “If This Then That” (pronounced like “gift” without the “g”) – Source Wikipedia.
For this demo, IFTTT is used to trigger the light switch on/off commands based on the speech command received by Alexa service running on RPi.
Let’s sync up the Alexa Service with IFTTT,
We are now ready with all the web components for the demo.
In this Python script, the RPi subscribes to the PubNub and waits for the trigger messages. It then controls the light according to the trigger messages.
Refer the README file to check the pre requisites before executing the code contained in this repository under RPi.
Now we are all set for the demo, Make sure you are running all the three services from the Part 1 (the three terminals) before continuing.
To issue any command you need to wake up Alexa service by calling “Alexa” each time you want to send a command. You will hear a beep sound. Once you hear the beep, say “Alexa Trigger Turn on the Light.” You can see the light turns ON within a moment. And then if you say “Alexa Trigger Turn off the Light”, the light should turn OFF.
We have done it !!
Do share your feedback about this demo and I also look forward to receiving your suggestions to make it more feature rich. If u have any technical doubts then you can post your comments below and I will get back to you.
This Alexa Powered Dictionary Bot Can Expedite Your Vocabulary Buildup
Voice Controlled Home Automation using Alexa – Part 1
The Top API Management Platforms in 2020
The Evolution of APIs: Past, Present and the Future
CPaaS Use Case: RCS Messaging, The Future of Business SMS
Reimagining Telemedicine with Cloud Technologies For Real-time Clinical Interventions
Please log in again. The login page will open in a new window. After logging in you can close it and return to this page.