How to Build An Alexa Home Automation System by@subhajit

How to Build An Alexa Home Automation System


In this IoT project, I have shown how to make an IoT-based Smart Home with Arduino IoT Cloud & Alexa using NodeMCU ESP8266 to control 4 home appliances with voice commands.

If the internet is not available, then you can control the home appliances manually with switches. In the article, I have shown all the steps to make this smart home system.


This IoT-based Home Automation system has the following features:

  • Control appliances with Alexa and Arduino IoT Cloud Dashboard
  • Control appliances manually with switches.
  • Control home appliances manually without internet.
  • All resources used for this project are FREE.

Tutorial Video on Arduino IoT Cloud ESP8266 Alexa Smart Home

Required Components:


  1. NodeMCU board
  2. 4-channel SPDT 5V Relay Module
  3. Push Buttons
  4. Alexa Echo Dot (Optional)

Circuit Diagram of the NodeMCU Home Automation Project


This is the complete circuit diagram for this home automation project. I have explained the circuit in the tutorial video.

The circuit is very simple, I have used the GPIO pins D1, D2, D5 & D6 to control the 4 relays.

And the GPIO pins SD3, D3, D7 & RX connected with push buttons to control the 4 relays manually.

I have used the INPUT_PULLUP function in Arduino IDE instead of using the pull-up resistors.

I have used a 5V mobile charger to supply the smart relay module.

Here, the D3 pin should not be connected with GND during the booting process of NodeMCU.

Create Arduino IoT Cloud FREE Account

For this IoT project, first you have create an FREE Arduino IoT Cloud account.

You can can refer to the following article for step-by-step guide to create Arduino cloud account and add ESP8266: Set up New Arduino IoT Cloud for ESP8266 NodeMCU

Program the NodeMCU ESP8266

To program the NodeMCU, I have used Arduino IDE.

Download the code from here.

In the folder you will get 3 files (1 .ino file & 2 .h files). Keep all the files in the same folder. Now open the .ino file with Arduino IDE.

First, you have to install the ArduinoIoTCloud library. During installation, it may ask to install other dependencies. Then click on Install All.

In the code, you have to update the THING ID and DEVICE ID in the thingProperties.h file.

Then update the Wi-Fi credentials and Secret Key in the arduino_secrets.h file.

You will get the DEVICE ID and THING ID in the Arduino IoT cloud account. And Secret Key from the PDF which you have downloaded during adding the device in Arduino IoT cloud.

I have shown all the steps in the tutorial video.

After doing all these changes, you can upload the code to NodeMCU.

Configure the Alexa App for Arduino IoT Cloud


Download and install the Amazon Alexa App from the Google play store or App Store.

Tap on "More".

Then select "Skills & Games".

Search for Arduino and tap on "Arduino".



Log in with the Arduino Cloud credentials.

Tap on CLOSE.

Tap on "DISCOVER DEVICES". It will take a minute to add devices. During this time the

NodeMCU should be connected with the WiFi.

Tap on "Devices", and tap on "Switches" to see all the devices.

Thus, all the devices from Arduino IoT Cloud will be added to Amazon Alexa App.

Connect the Home Appliances


Connect the 4 home appliances with the relay module as per the circuit diagram.

Please take proper safety precautions while working with high voltage.

Connect 5-volt DC supply with the PCB. (I have used my old mobile charger 5V 2Amp)

Turn on the 110V/230V supply and 5V DC supply.

Finally!! the Arduino Cloud Smart Home System Is Ready


Now you can control your home appliances in a smart way.

I hope you have liked this Arduino IoT and Alexa control home automation project. I have shared all the required information for this project.

I will really appreciate it if you share your valuable feedback. Also if you have any query please write in the comment section.

Thank you & Happy Learning.

Also published on:


Signup or Login to Join the Discussion


Related Stories