Introduction: Voice Activated Media Appliances Using Alexa

About: Hello, I am 17 year old innovator living in India. My interest lies in Electronics. Surf through my creations and enjoy!!!!1

The unit developed here makes your appliances like TV, amplifier, CD and DVD players control with voice commands using Alexa and Arduino. Advantage of this unit is that you have to just give voice commands. This unit can work with all appliances that uses RS-232 port ports. These ports are very much useful in connections. They are mostly used in media devices. Now, no need to use IR remotes.

The unit is inexpensive. It contains, Arduino Board. You can use any arduino board but i prefer Arduino Nano because it is compact. The other things are ESP 8266, Amazon Alexa, RS 232-TTL Converter. I have also included instructions for Particle.

Step 1: Things You Will Need

1. Particle Photon

2. Amazon Alexa

3. Amazon Echo Dot

4. ESP 8266

5. RS232-TTL Converter

6. Arduino UNO/Nano/Micro...

Step 2: Connecting Arduino to ESP 8266

Connect the Arduino’s 3v3 (3.3V) output to ESP8266. The ESP8266 works with 3.3V and not 5V, so this is necessary.

Connect the RES or RESET pin, When you ground the reset pin, the Arduino works as a dumb USB to serial connector, which is what we want to talk to the ESP8266.

Connect the RXD pin of the Arduino to the RX pin of the ESP8266.

Connect the TXD pin of the Arduino to the TX pin of the ESP. When we want two things to talk to each other over serial, we connect the TX pin of one to the RX of the other (send goes to receive and the opposite). Here we do not have the Arduino talk to the ESP8266 though, our computer is talking to it viathe Arduino. Connect GND and VCC.

Finally CH_PD connects.

Step 3: Connecting RS 232-TTL Converter

Now, it is easy to connect RS 232-TTL converter to Arduino and ESP which we connected earlier as connections mentioned below:

Connect GND of Arduino/Particle to GND of converter

Connect VCC of Arduino/Particle to VCC of converter

Connect TX of Arduino/Particle to TX of converter

Connect RX of Arduino/Particle to RX of converter

Step 4: Creating Amazon Skills

If you are using particle Board Follow this steps.

You need a developer account with Amazon, if you don't have one you can sign for free. Go to https://developer.amazon.com/alexa

In developer account go to Alexa skills kit.

Then click "Create a new skill"

You have to select followings:
"Smart Home Skill API" in Skill Type

In payload version, select v3

And then click Save.

Step 5: Configuration Window

Once saving, next step shows you your Application ID.

Click next button
Then comes the configuration window. Here you have to use curl command where in user ID place the access token and in www.example.com you need to give particle website.

Attachments

Step 6: Amazon AWS

For this you have to login to https://aws.amazon.com/.

Select Author form Scratch option.

Then, copy the code which is in the text file.

Set your Device ID in your program.
You need to change the commands to your specific device.

After doing all the steps, test the skills in Lambda Configuration.

Step 7: For Arduino

For using voice skills with Arduino, you will need to use Amazon Echo Dot.

Connect to wifi using the following code:

#include "debug.h" // Serial debugger printing
#include "WifiConnection.h" // Wifi connection // this file is part of my tutorial code #include
// IR library

WifiConnection* wifi; // wifi connection IRsend* irSend; // infrared sender

//SET YOUR WIFI CREDS const char* myWifiSsid = "***"; const char* myWifiPassword = "*******";

//SET TO MATCH YOUR HARDWARE #define SERIAL_BAUD_RATE 9600

//PIN 0 is D3 ON THE CHIP #define IR_PIN 0

/*---------------------------------------*/ //Runs once, when device is powered on or code has just been flashed void setup() { //if set wrong, your serial debugger will not be readable Serial.begin(SERIAL_BAUD_RATE);

//initialize wifi connection wifi = new WifiConnection(myWifiSsid, myWifiPassword); wifi->begin();

//connect to wifi if (wifi->connect()) { debugPrint("Wifi Connected"); } }

/*---------------------------------------*/ //Runs constantly void loop() { }

Step 8: Connect WEMO Server

Then, run the WEMO server, it is the best method for ESP8266.

Now, we have to install the ESPAsyncTCP library.

Code for Testing:

#include "debug.h" // Serial debugger printing
#include "WifiConnection.h" // Wifi connection #include "Wemulator.h" // Our Wemo emulator #include // IR library

WifiConnection* wifi; // wifi connection Wemulator* wemulator; // wemo emulator IRsend* irSend; // infrared sender

//SET YOUR WIFI CREDS const char* myWifiSsid = "***"; const char* myWifiPassword = "*******";

//SET TO MATCH YOUR HARDWARE #define SERIAL_BAUD_RATE 9600

//PIN 0 is D3 ON THE CHIP #define IR_PIN 0 /*---------------------------------------*/ //Runs once, when device is powered on or code has just been flashed void setup() { //if set wrong, your serial debugger will not be readable Serial.begin(SERIAL_BAUD_RATE);

//initialize wifi connection wifi = new WifiConnection(myWifiSsid, myWifiPassword); wifi->begin();

//initialize the IR irSend = new IRsend(IR_PIN, false); irSend->begin();

//initialize wemo emulator wemulator = new Wemulator();

//connect to wifi if (wifi->connect()) { wemulator->begin();

//start the wemo emulator (it runs as a series of webservers) wemulator->addDevice("tv", new WemoCallbackHandler(&commandReceived)); wemulator->addDevice("television", new WemoCallbackHandler(&commandReceived)); wemulator->addDevice("my tv", new WemoCallbackHandler(&commandReceived)); wemulator->addDevice("my television", new WemoCallbackHandler(&commandReceived)); } }

/*---------------------------------------*/ //Runs constantly void loop() { //let the wemulator listen for voice commands if (wifi->isConnected) { wemulator->listen(); } }

Step 9: Thank You!

Now, you have made your own voice activated device to control your Media Devices.

Try saying "Alexa Turn on TV"

Thus, in this way you can make your own voice controlling unit using Arduino or Particle.

Thanks for stopping by!

Voice Activated Challenge

Participated in the
Voice Activated Challenge