Skip to content

Latest commit

 

History

History
145 lines (121 loc) · 11.4 KB

File metadata and controls

145 lines (121 loc) · 11.4 KB

Smart-home-device-control-using-Alexa-App

The project presents hardware, software and instructions to design home automation that paves way to develop a full fledged Do It Yourself (DIY) home automation system. The hardware is designed around tiny NodeMCU ESP8266 board with inexpensive components and software developed in the Arduino environment. Alexa App is used on Mobile to control the home automation system. Alternately, Google Assistant can also be used .

Home automation or domotics refers to automation of a house. Such a system monitors and (or) controls parameters such as climate, lighting, entertainment, electronic gadgets etc. When it comes to home security, it controls access and alarm systems also. In this project, the home appliances are controlled by Alexa app via internet, thus Internet of Things (IoT). Smart home appliances like fan, bulb, cooler etc. works at 115V/230V ac. Care must be exercised during rigging and testing of the hardware, as there is a chance of getting a shock!
In the following, I describe the hardware and software that simulates the smart home project. Neverthless, it paves way to develop a full fledged DIY home automation system. Broadly speaking, home automation can be accomplished by two methods:
Method 1: using commercially available devices like: Apple Home Kit, Google Nest Hub, Control4, Amazon Alexa echo etc. or
Method 2: without using (1), using a microcontroller, SinricPro software and Alexa app.
A pictorial representation of these two methods are shown below.


In this project, I am explaining the implementation of home automation system using the second method.

Components required

  • NodeMCU ESP8266 Module
  • Bread board
  • DIP Switch
  • Light Emitting Diodes
  • Resistors and Jumper wires
  • 5V dc source/Power bank



Now, we shall turn our attention towards program development that makes the above hardware and apps work successfully.

Methodology

The hardware described in this project works at 3.3V, and hence no fear of shock. DIP (Dual In-line Package) switches works like ON-OFF switches. The upper half of the first figure below shows the connection between the NodeMCU ESP8266 module and other components like DIP switches and LEDs. In the lower half of the first figure, circuit design pertaining to relays and bulbs working at 115/230V is also given. The following second diagram shows the photograph of the completed circuit using the second scheme, i.e., without using Amazon Echo. A detailed hardware description is given in the following YouTube video link.

[(https://www.youtube.com/watch?v=zVuE34ZBaYs)]


Software plays an important role in this project. It has the following three parts:

Part-I:

In this part, a program is developed in Arduino environment in order to interface and control LEDs and switches with the digital Input/Output (DIO) pins of the ESP8266 module. Parameters that need to be used in the main program include:

  • (a). WiFi Credentials (Network name, Password)
  • (b). APP_KEY and APP_SECRET_KEY
  • (c). Device IDs corresponding to the voice control

The first parameter (a) is user known. The second and third parameters (b and c) needs to obtained from the Sinric Pro.

Part-II:

This part pertains to entering the above parameters to Amazon Alexa after downloading and installing the app on the mobile from Google play store.

Part-III:

In order to get the parameters mentioned in (b) and (c) above, account needs to be created in Sinric Pro. After creating the account successfully, Sinric Pro presents APP_KEY, APP_SECRET_KEY and unique Device IDs. As they are lengthy strings having alphabetics and numerals, they need to be copied and pasted in the main progrm.

Let us take a bottom-up approach

Creating an account in Sinric Pro

Open the following website:

[(https://portal.sinric.pro/register)]

Enter name, email ID, password etc. and click on Register.
Log in to Sinric Pro by entering email address and password after opening the following website:

[(https://portal.sinric.pro/login)]

Click on Credentials and make note of APP_KEY and APP_SECRET. I am re-naming APP_SECRET as APP_SECRET_KEY.

Creating Rooms and Devices in Sinric Pro

Create room in Sinric Pro by selecting Rooms in the left side menu. Click on Add Room button. Enter the Room Name and its description. Click on Save button. In this way you can create number of rooms like: Living Room, Bath Room, Kitchen etc. Sinric Pro gives an opportunity to add three devices free of cost. Select Devices from the left side menu. Click on Add Device button. Enter the Device Name and its Description. Select the Device Type. Also, select the Room for the device and click Next. I stopped selection of parameters at this point. Also, there are optional parameters like: Timer, Energy usage etc. Snapshots of monitor corresponding to display of the Keys, Rooms, Devices are shown in the following figures.


Connecting Sinric Pro with Alexa App


Steps to connect Sinric Pro with Alexa App
  • First, open the Alexa App, press More followed by selecting Skills and Games.
  • Second, press the Sinric Pro
  • Third, press on ENABLE TO USE and
  • Fourth, authorize Amazon to access the selected devices by signing in with email Id and Password used for the Sinric Pro account.
    The following figure shows these steps


Steps to add Devices to Alexa App
  • First, after the creation of account in Sinric Pro press CLOSE
  • Second, press the tab: DISCOVER DEVICES
  • Third, Alexa App takes some time to discover the devices that were added in the Sinric Pro (in the above steps)
  • Fourth, press the Devices at the bottom of the App and press PLUGS .
All the Selected Devices will be opened in the Alexa App on the Mobile

All the above steps are shown diagramatically below:


Now, let us turn our attention towards successful program development using the developed hardware and apps. As mentioned earlier, the program is developed in the Arduino environment. Steps involved in the program development are given below:

  • Initialize the program by adding the following header files (Before doing this, these header files should be included in the Arduino library by selecting Tools in the Arduino sketch followed by Manage Libraries and Library Manager):

    Arduino.h, ESP8266WiFi.h , SinricPro.h, SinricProSwitch.h
  • Add WiFi Credentials

  • Add APP_KEY, APP_SECRET_KEY, device_IDs

  • Define DIO Pins of ESP8266, Switches, Relay Pins (Not in this project)

  • Other details are given in the program and video descriptions



The web link for the video description is given below:

[(https://youtu.be/oHHlB7pPxhM)]