Introduction: How to Control Light/Home Lights Using Arduino and Amazon Alexa
I have explained how to control light which is connected to UNO and controlled by Alexa.
Step 1: Components Used
- Arduino UNO & Genuino UNO
- Resistor 221 ohm
- LED (generic)
- Raspberry Pi 3 Model B
- Arduino IDE
Amazon Alexa Alexa Skills Kit
Step 2: Setting Up Raspberry Pi & Arduino IDE
1.First install binaries
sudo apt-get install python-pip
pip install flask
pip install flask-ask
sudo apt-get install pyserial
sudo apt-get intall libpython2.7-dev
2. Installing Arduino IDE on RPi
To install Arduino in RPi
1. Go to official site and download previous release. https://www.arduino.cc/en/Main/OldSoftwareRelease...
After that unzip it and go to directory of arduino and start it with ./arduino
Step 3: Upload Program
After uploading program,open serial terminal.
When you write N led will turn on.
When you write F led will turn off.
Step 4: Make a Python Script
Run it using python lighcontrol.py
Step 5: Download Ngrok
Ngrok is secure tunneling platform to make your device online. With this platform you can make your web application or any application goes online with a very simple way. For download go to official site and download for ARM.
Unzip it and go to directory where you extract it. Run it using command
./ngrok http 5000
Step 6: Setting Up Alexa
1. Login to Amazon account.If you have an account then login it, if not signup there and login.
2. Go to Developer Console on top right side.
Step 7: Go to Alexa ==> Alexa Skill Kit ==> Add New Skill
You will see page like this. On this page it will ask skill type,
name, language and invocation name .You can give any name, in invocation name you have to give name which you say while giving command to Alexa.
Please note select appropriate language which is used in you country if you select different language while creating skill. It will not work.
At the end update it ,save it and press next.
On next page, it will ask intents.An intent represents an action that fulfills a user’s spoken request. For more information
If there is any error you will see in red color.
Write below code in the box
save it and move to next page.
Step 10: On Next Page It Will Ask Two Option for End Point One Is AWS and HTTPS
Select HTTPS & save it and move to next page.
Step 11: For SSL Certificate Choose Second Option. Save It and Move to Next Page.
Step 12: Checking Service "on"
To test whether service is working or not . Make sure your Ngrok server is working and Python script also running otherwise it will not work.
You can see servers are getting request and post it.
Step 13: Servers Getting Requests
Step 14: Requested Are Posted
Step 15: Schematics Arduino
Step 16: Schematics LED
Hope you all like it.