DIY Home Automation with NodeMCU & Alexa: A Beginner’s Guide

Are you tired of getting up to turn off the lights or control the temperature in your home? Do you want to automate your home but don’t know where to start? Look no further! In this beginner’s guide, we’ll show you how to use NodeMCU and Alexa to automate your home.

DIY Home Automation with NodeMCU & Alexa: A Beginner's Guide

Required Materials

Before we begin, you’ll need the following materials:
– NodeMCU board
– Relay module
– Breadboard
– Jumper wires
– Alexa-enabled device
– Amazon Developer account

Step 1: Setting up NodeMCU board

  1. Download the Arduino IDE.
  2. Open Arduino IDE, go to “File”-> “Preferences” and add the following link to Additional Boards Manager URLs: “”.
  3. Go to “Tools” -> “Boards” -> “Boards Manager” and search for “esp8266”.
  4. Install the esp8266 board.
  5. Choose the board type “NodeMCU 1.0 (ESP-12E Module)”.

Step 2: Wiring the NodeMCU board and Relay module

  1. Connect the VCC and GND pins of both modules to the breadboard.
  2. Connect the IN pin of the Relay module to pin D1 of the NodeMCU board.
  3. Connect the VCC pin of the Relay module to 3V3 pin of the NodeMCU board.
  4. Connect the GND pin of the Relay module to the GND pin of the NodeMCU board.

Step 3: Setting up Amazon Developer account

  1. Go to the Amazon Developer website and log in or create an account.
  2. Create a new Amazon Alexa Skill and give it a name.
  3. Add the intent schema, sample utterances, and custom slot types.
  4. Create a Lambda function and connect it to your Alexa Skill.
  5. Add the NodeMCU code to the Lambda function.

Step 4: Writing the NodeMCU code

  1. Open the Arduino IDE and create a new sketch.
  2. Copy and paste the code from our GitHub repository.
  3. Replace the Wi-Fi SSID, password, and the Lambda function URL with your own.

Step 5: Uploading the code to NodeMCU board

  1. Connect your NodeMCU board to your computer using a USB cable.
  2. Select the correct board and port.
  3. Click the “Upload” button.

Congratulations! You have successfully automated your home with NodeMCU and Alexa. Now, you can control your lights, thermostat, and other home devices using your voice.


  • Make sure to secure your Wi-Fi network and use strong passwords.
  • Test your code thoroughly before deploying it.
  • Keep the Alexa Skill and Lambda function updated with the latest code changes.


  • Check your wiring connections.
  • Check your code for syntax errors.
  • Check your Wi-Fi connection and credentials.
  • Check if your Alexa Skill and Lambda function are properly configured.


Q: I have no experience in programming or electronics, can I still follow this guide?
A: Yes, this guide is specifically designed for beginners with no prior experience in programming or electronics. The guide will walk you through each step in detail, and you will learn along the way.

Q: Can I use a different voice assistant, such as Google Assistant, instead of Alexa?
A: Yes, you can use a different voice assistant, but the guide is specifically written for Alexa. To use a different voice assistant, you would need to modify the code accordingly.

Q: Can I control other devices besides a light switch with this setup?
A: Yes, this setup can be modified to control any device that can be connected to a NodeMCU. You would need to modify the code accordingly to control different devices.