Arduino IoT Cloud ESP8266 Alexa

Arduino IoT Cloud ESP8266 NodeMCU Alexa Home Automation system

Make Arduino IoT Cloud ESP8266 NodeMCU Alexa Home Automation system using all FREE tools. Explained this IoT Project with CIrcuit & Code.

In this Arduino IoT cloud project, I have explained how to make Arduino IoT Cloud ESP8266 NodeMCU Alexa Home Automation system. With this NodeMCU ESP8266 project, you can control 4 home appliances with Arduino IoT Cloud dashboard, Alexa, and manual switches. You can also control the relays from Amazon Alexa App from anywhere in the world. You can control the appliances from the manual switches if there is no internet available.

I have used all the FREE tools and you don’t need any Alexa devices or Amazon Echo Dot for this voice control home automation project.

Arduino IoT Cloud ESP8266 Alexa

So if you follow all the steps, you can easily make this Smart Home System with Arduino IoT Cloud and Amazon Alexa to control the appliances with voice commands.

Circuit of the Arduino IoT Cloud projects

Circuit of the Arduino IoT Cloud projects

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

And the GPIO SD3, D3, D7 & RX connected with the pushbuttons to control the relay module manually.

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

As per the source code, when the control pins of the relay module receive the LOW signal the respective relay will turn on and the relay will turn off for the HIGH signal in the control pin.

I have used a 5V 2Amp mobile charger to supply the circuit.

Required Components for the NodeMCU projects

Components for NodeMCU Blynk project
  1. NodeMCU ESP8266 Amazon
  2. 4-channel 5V SPDT Relay Module Amazon
  3. Pushbuttons Amazon
  4. Amazon Echo Dot (optional) Amazon

Tutorial video on Arduino IoT Cloud ESP8266

In the Arduino Cloud tutorial video, I have covered the following steps in detail.

  • Create an account and add things in Arduino IoT Cloud.
  • How to set up Arduino IoT Cloud Dashboard.
  • How to set up Arduino IoT Cloud for ESP8266.
  • Programming the NodeMCU with Arduino IDE
  • Connect Arduino IoT Cloud with Amazon Alexa App.

Arduino IoT Cloud FREE account setup

For this smart house project, I have used the Arduino Cloud Free plan. First, you have to add 4 variables to the Arduino Cloud account.

Please click on the following link for Arduino IoT Cloud setup.

Getting Started with Arduino IoT Cloud

Program NodeMCU with Arduino IDE

In the Tutorial video, I have explained all the steps to program the NodeMCU using Arduino IDE.

  1. Update the Preferences –> Aditional boards Manager URLs:,
  2. Then install the ESP8266 board from the Board manager or Click Here to download the ESP8266 board.
  3. Install all the required libraries in Arduino IDE:
Arduino Cloud ESP8266 Pic 10

Go to Sketch -> Include Libraries -> Manage Libraries in Arduino IDE.

When you try to install the ArduinoIoTCloud library, it will ask you to install all the dependencies. Then Click on Install All.

Code for Arduino IoT Cloud ESP8266 home automation

After uploading the code to NodeMCU, please refer to the following articles for connecting the Arduino IoT Cloud Account with Amazon Alexa App.

After doing all these steps, now you control the appliances with Alexa.

NodeMCU control Relays with Alexa App

NodeMCU control Relays with Alexa App

If the NodeMCU is connected with WiFi, then you can ask Alexa, to turn on the light [“Alexa, Turn ON Room Light“]. Thus, you can control the appliances like light, fan, etc with voice commands using Amazon Alexa App from anywhere in the world.

Control Relays with Arduino IoT Cloud App

Control Relays with Arduino IoT Cloud App

You can also control the relays from Arduino IoT Cloud Remote App. Just download and install the Arduino IoT Cloud Remote app from Google Play Store or App Store, then login your Arduino Cloud account and select the dashboard.

Control Relays manually with Push Buttons

You can always control the appliances manually with push buttons. and if the NodeMCU is not connected with the Wi-Fi, still you can control the appliances with push buttons.

PCB for the NodeMCU Smart Home Project

Solder the Components on PCB

If you want, you can also use this PCB to make the circuit compact and give the project a professional look.

I hope you like this Smart house IoT projects idea with the Arduino Cloud NodeMCU ESP8266.

Click Here for more such ESP8266 projects.

Please do share your feedback on this IoT project. Thank you for your time.


  1. Hi
    thanks for your projeckt. that was so interesting but i have problem in compiling;

    C:\Users\NICK\Documents\Arduino\libraries\ArduinoIoTCloud\src\cbor\lib\tinycbor\src\cborpretty.c: In function ‘hexDump’:

    C:\Users\NICK\Documents\Arduino\libraries\ArduinoIoTCloud\src\cbor\lib\tinycbor\src\cborpretty.c:195:32: error: expected ‘)’ before ‘__INT8’

    195 | err = stream(out, “%02” PRIx8, *buffer++);

    | ^

    | )

    C:\Users\NICK\Documents\Arduino\libraries\ArduinoIoTCloud\src\cbor\lib\tinycbor\src\cborpretty.c: In function ‘utf8EscapedDump’:

    C:\Users\NICK\Documents\Arduino\libraries\ArduinoIoTCloud\src\cbor\lib\tinycbor\src\cborpretty.c:251:39: error: expected ‘)’ before ‘__INT32’

    251 | err = stream(out, “\\u%04” PRIX32 “\\u%04” PRIX32,

    | ^

    | )

    C:\Users\NICK\Documents\Arduino\libraries\ArduinoIoTCloud\src\cbor\lib\tinycbor\src\cborpretty.c:257:39: error: expected ‘)’ before ‘__INT32’

    257 | err = stream(out, “\\u%04” PRIX32, uc);

    | ^

    | )

    C:\Users\NICK\Documents\Arduino\libraries\ArduinoIoTCloud\src\cbor\lib\tinycbor\src\cborpretty.c: In function ‘value_to_pretty’:

    C:\Users\NICK\Documents\Arduino\libraries\ArduinoIoTCloud\src\cbor\lib\tinycbor\src\cborpretty.c:382:34: error: expected ‘)’ before ‘__INT64’

    382 | err = stream(out, “%” PRIu64, val);

    | ^

    | )

    C:\Users\NICK\Documents\Arduino\libraries\ArduinoIoTCloud\src\cbor\lib\tinycbor\src\cborpretty.c:387:39: error: expected ‘)’ before ‘__INT64’

    387 | err = stream(out, “-%” PRIu64, val);

    | ^

    | )

    C:\Users\NICK\Documents\Arduino\libraries\ArduinoIoTCloud\src\cbor\lib\tinycbor\src\cborpretty.c:457:30: error: expected ‘)’ before ‘__INT64’

    457 | err = stream(out, “%” PRIu64 “%s(“, tag, get_indicator(it, flags));

    | ^

    | )

    C:\Users\NICK\Documents\Arduino\libraries\ArduinoIoTCloud\src\cbor\lib\tinycbor\src\cborpretty.c:473:37: error: expected ‘)’ before ‘__INT8’

    473 | err = stream(out, “simple(%” PRIu8 “)”, simple_type);

    | ^

    | )

    C:\Users\NICK\Documents\Arduino\libraries\ArduinoIoTCloud\src\cbor\lib\tinycbor\src\cborpretty.c:531:36: error: expected ‘)’ before ‘__INT64’

    531 | err = stream(out, “%s%” PRIu64 “.%s”, val lastTag,

    | ^

    | )

    C:\Users\NICK\Documents\Arduino\libraries\ArduinoIoTCloud\src\cbor\lib\tinycbor\src\cbortojson.c:316:40: error: expected ‘)’ before ‘__INT64’

    316 | if (fprintf(out, “,\”v\”:\”%c%” PRIx64 “\””, flags & NumberWasNegative ? ‘-‘ : ‘+’,

    | ^

    | )

    C:\Users\NICK\Documents\Arduino\libraries\ArduinoIoTCloud\src\cbor\lib\tinycbor\src\cbortojson.c: In function ‘tagged_value_to_json’:

    C:\Users\NICK\Documents\Arduino\libraries\ArduinoIoTCloud\src\cbor\lib\tinycbor\src\cbortojson.c:351:35: error: expected ‘)’ before ‘__INT64’

    351 | if (fprintf(out, “{\”tag%” PRIu64 “\”:”, tag) < 0)

    | ^

    | )

    C:\Users\NICK\Documents\Arduino\libraries\ArduinoIoTCloud\src\cbor\lib\tinycbor\src\cbortojson.c:359:39: error: expected ')' before '__INT64'

    359 | if (fprintf(out, ",\"tag%" PRIu64 "$cbor\":{", tag) < 0 ||

    | ^

    | )

    C:\Users\NICK\Documents\Arduino\libraries\ArduinoIoTCloud\src\cbor\lib\tinycbor\src\cbortojson.c: In function 'value_to_json':

    C:\Users\NICK\Documents\Arduino\libraries\ArduinoIoTCloud\src\cbor\lib\tinycbor\src\cbortojson.c:578:38: error: expected ')' before '__INT8'

    578 | if (fprintf(out, "\"simple(%" PRIu8 ")\"", simple_type) < 0)

    | ^

    | )

    C:\Users\NICK\Documents\Arduino\libraries\ArduinoIoTCloud\src\cbor\lib\tinycbor\src\cbortojson.c:637:39: error: expected ')' before '__INT64'

    637 | r = fprintf(out, "%s%" PRIu64, val < 0 ? "-" : "", ival);

    | ^

    | )

    exit status 1

    Error compiling for board NodeMCU 1.0 (ESP-12E Module).

    • As I said in the video, you have to install all the dependencies of ArduinoIOTCloud library. Otherwise, you can also program it from Arduino Web editor

  2. Hi, I had the same problem.
    The solution is to install the ESP8266 V.2.7.4 board and install the ArduinoIoTCloud V.1.0.2 library.
    The problem is in the versions.

  3. Hy .. I am a regular follower of your videos and got very much inspired. I am working on the same project, but added some more features to it. I have interfaced Fan regulator (using 3 relays) and IR transmitter too, to control AC, TV and soundbar using Arduino Iot and Alexa. If you can make such interface in this project this can be an ultimate home automation where we can control every appliance.

  4. Hi, I want to add 8 channel relay module instead of a 4 channel relay module. So what are the changes in code that I would have to make? Also Would appreciate if you give me a circuit diagram with 8channel relay module. Thank you

    • ArduinoIoTCloud library was not properly installed. Refer to the article, install all the dependencies of the ArduinoIoTCloud library. Keep all the files in the same folder. Then try to compile the code.

  5. Gr8 tutorial but this and the 8 channel relay both have one big flaw in them, because of which they cannot be practically used. Flaw is that they both assume that once switch on the power outage will never happen.

    In practical situations say that one is using either of the two projects to control for e.g. ceiling fan – scenario is such that user switched on fan before going to bed, while user is sleeping in middle of night power outage happened, and then after a while power comes back – the program by default does not resume the last state of the relays – it simply switches off the fan – and user’s sleep is disoriented.

    For practical application – the state of the relay needs to be saved in eprom and when the power comes back every relay must resume its state as it was before outage happened – just as sonoff.

    Without this basic facility both projects remain just LAB PROJECTS UNFIT FOR PRACTICAL APPLICATION.

  6. Ciao io ho compilato tutto,manualmente e con l’app arduino iot remote controll funziona tutto bene ma non riesco a collegarlo con l’app alexa,il dispositivo si collga al wifi infatti la luce diventa blu ma alexa non riesce a trovarlo

  7. Ho risolto tutto,errore di distrazione.
    Tutto funzionante davvero molto bello,mi piacerebbe vedere un uscita a 16 relè

  8. Everything works for me, it is connected to wifi and from the serial monitor I can see the commands but as soon as I connect the relay it is always energized even if the switches are off

Leave a Reply

Your email address will not be published. Required fields are marked *