How to Control Light/Home Lights Using Arduino and Amazon Alexa
by Kishor Prajapati in Circuits > Arduino
2905 Views, 42 Favorites, 0 Comments
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.
Components Used
HARDWARE USED
- Arduino UNO & Genuino UNO
- Resistor 221 ohm
- LED (generic)
- Raspberry Pi 3 Model B
SOFTWARE REQUIRED
- Arduino IDE
Amazon Alexa Alexa Skills Kit
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
Upload Program

After uploading program,open serial terminal.
When you write N led will turn on.
When you write F led will turn off.
Downloads
Make a Python Script


Run it using python lighcontrol.py
Downloads
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
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.
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
https://developer.amazon.com/docs/custom-skills/de...
If there is any error you will see in red color.
Write below code in the box
{
"intents": [
{
"intent": "LightOn"
},
{
"intent": "LightOff"
} ]
}
save it and move to next page.
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.
For SSL Certificate Choose Second Option. Save It and Move to Next Page.

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.
Servers Getting Requests

Requested Are Posted

Schematics Arduino

Schematics LED

Hope you all like it.