How to Make a Smart Home Automation System Using ESP8266 and Relays

Publisher:温柔的爱情Latest update time:2023-06-08 Source: elecfansKeywords:ESP8266 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

This article will introduce you to a home automation system that can easily control lights, fans, and other home appliances through voice commands using NodeMCU and Relay modules.


In this IoT project, I have made an Alexa smart home automation system using NodeMCU ESP8266 and relay modules. You can easily control lights, fans, and other home appliances through voice commands. To connect Echo Dot smart speaker with NodeMCU, I have only used Amazon Alexa app.


If you don't have an Echo Dot smart speaker, you can still control your home appliances. You can also monitor the relay timing feedback of switches from your smartphone.


Alternatively, you can also use an ESP32 board instead of the NodeMCU microcontroller.

Components required:

poYBAGLCqjSAN3dFAAP4pB1MPkU339.png

Alexa Echo Dot

Relay Module

NodeMCU or ESP32 development board

Components required for the relay module:

Relay 5v (SPDT)

BC547 transistor

LED 5mm

220 ohm resistor

Connectors

Circuit diagram:

pYYBAGLCqjCAc8AMAAO-c6UYzgs018.png

As you can see, the circuit for this home automation project is very simple. You can easily make this circuit using Relay module and NodeMCU.

Here, I have used D1, D2, D5, D6, D7 pins of NodeMCU to control 5 relays.

I used a 5V mobile charger to power the circuit.

Programming the NodeMCU:

pYYBAGLCqiuALlkYAAHo9WxNqYo130.png

As I said, you can use NodeMCU or ESP32 for this project. I used ESPAlexa library for this project.

If you use NodeMCU ESP8266, you must download and install the ESP8266 board version (2.5.1) (as shown in the picture).

I'm having some issues with the latest version of the ESp8266 board library when uploading code.

poYBAGLCqieAZnvCAAGpv1-JtAw303.png

Enter your WiFi credentials in the code and set the names of devices such as room lights, fans, night lights, etc.

Here, I have used an active high relay module so if you are using an active low relay module then you just need to make few modifications in the code as shown in the tutorial video.

However, if you face any issues, please let me know in the comments section.

I have attached the code for this Alexa Home Automation Project.

To configure the Amazon Alexa app:

pYYBAGLCqiOAfuQKAAOB3rkddwY026.png

First, download and install the Amazon Alexa App from Google PlayStore or App Store.

Your phone and NodeMCU should be connected to the same wifi network.

Steps to add a device in the Amazon Alexa App:

Open the Amazon Alexa app.

Go to Devices.

Click the "+" icon at the top and select Add a device.

Select Light, then select Other.

Click Discover Devices.

It may take some time to discover all devices.

After that, add all the devices one by one to the Amazon Alexa App.

Design PCB:

poYBAGLCqh-Ab_ryAAX2U66ZzXk208.png

Although you don't need any custom designed PCB to make this smart home system. But to make the circuit more compact and make the project look more professional, I designed a PCB for this Alexa project.

Solder all components:

pYYBAGLCqhuAV0xnAAaul_5DQUo785.png

After that solder all the components according to the circuit diagram.

Then connect the NodeMCU.

Connect home appliances:

pYYBAGLCqhWAE2chAANgqipkhIQ305.png

Connect the home appliances according to the circuit diagram.

Take proper safety precautions when working with high voltage.

Connect a 5V DC power supply to the PCB as shown in the circuit.

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

Finally, control the lights and fan with Alexa:

poYBAGLCqhGAZzVGAAOV4Ok-NVw655.png

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

Just tell Alexa which devices you want to turn on or off, and Alexa will do the work for you.

poYBAGLCqg2ANrk_AAQkzM_xJko816.png


Keywords:ESP8266 Reference address:How to Make a Smart Home Automation System Using ESP8266 and Relays

Previous article:Specific methods of transforming fresh-keeping warehouse with air conditioner
Next article:Class D audio amplifier circuit based on power chip TDA8929T

Recommended ReadingLatest update time:2024-11-16 12:45

Infrared remote control design of smart home based on ESP8266 microcontroller
The PCB schematic is as follows. I remember it was drawn with protel at that time. The circuit schematic is as follows: Drawing software is the same as above Experiment reference C language code #include "stc12c2052ad.h" #include "wifi_IR.h" #include intrins.h //#define ENABLE_IAP 0x83 //if SYSCLK 20MHz #def
[Microcontroller]
Infrared remote control design of smart home based on ESP8266 microcontroller
Latest Embedded Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号