Alexa & ESP32 Based Smart & Manual Home Automation System
Alexa & ESP32 Based Smart & Manual Home Automation - Combine Alexa's voice command with switches to control Relays with ESP32 Arduino Code
- Suitable forB.Tech/Diploma ESP32/IoT students
- Build time1-2 weeks
- LevelIntermediate
- Available atAjvika Labs, Kakinada
About this project
Overview
In this
IoT project
, I demonstrate how to set up Manual & Smart
Home Automation
project with
Alexa
using the
ESP32
and
Amazon Echo Dot
. This ESP32 Alexa Home Automation project solely relies on the
Amazon Alexa App
for controlling home devices with 4
relays
. Even without the internet, you can manage devices with
push buttons
. Once the device is online, the ESP32 auto-connects to
WiFi
, preserving the relay module’s last state.
Earlier we built ESP32 Home Automation project using
WebServer
Blynk
AWS IoT Core
and
Arduino IoT Cloud
. We have designed the
custom PCB
for this project to make the device portable. We have also provided the complete
schematic
, PCB details,
Gerber File
, Bill of Materials and Source Code. The system works without any third-party IoT apps, making it straightforward for
home automation setup
Bill of Materials
For this project, we will need the following components. The component list, footprint, and quantity are given below.
S.N.
Component
Designator
Footprint
Quantity
1
Capacitor 100nf
C1, C3, C6, C7, C8, C9, C10, C11
CAP_0805
8
2
Capacitor 10uf
C2, C4, C5
CAP_0805
3
3
Capacitor 220uF, 25V
C12
FP-RAD-TH-D_10_0_5-L_16_1-MFG
1
4
Diode 1N4007
D1, D2, D3, D4
DIOM5027X262N
4
5
SP4322-01ETG
D5
SP432201ETG
1
6
Optocoupler PC817C
IC1, IC3, IC4, IC5
DIP762W60P254L458H450Q4N
4
7
ESP32 WROOM-32
IC2
ESP32WROOM3216MB
1
8
2-Pin Terminal Block
J1
1
9
3-Pin Terminal Block
J2, J3, J4, J5
4
10
Relay SRD-05VDC-SL-C
K1, K2, K3, K4
SRD
4
11
LED Red
LED1, LED2, LED3, LED4, LED5
LEDC2012X80N
5
12
Male Header 6 Pin
P1
HDR1X6
1
13
HLK-10M05
PS1
HLK10M05
1
14
Transistor BC847B
Q1, Q2, Q3, Q4, Q5, Q6
BC847B215
6
15
Resistor 220R
R1, R3, R9, R11, R14, R16, R17, R19
805
8
16
DNP
R2, R10, R15, R18
805
4
17
Resistor 12K
R4, R12, R13
805
3
18
Resistor 1K
R5, R7, R8, R24
805
4
19
Resistor 470R
R6
805
1
20
Resistor 10K
R20, R21, R22, R23
805
4
21
Push Button Switch
S1, S2, S3, S4
B3W1020
4
22
Manual Switch (Optional)
SW1, SW2, SW3, SW4
HDR1X2
4
23
HT7333 3.3V Voltage Regulator
U1
IC_HT7333
1
Circuit Diagram & Hardware Design
Let us take a look at the
Schematic
of Alexa Based Manual & Smart Home Automation Project with ESP32. The schematic is drawn using the
Altium Designer
Software.
We used SMD resistors, capacitors, and LED with the 0805 package. To convert
220V AC
to
5V DC
, we used an
AC-to-DC Converter
from
Hi-Link
. For providing power to ESP32 raw chip and other peripherals, a low-power
LDO HT7333
IC was used. To separate the high-power line from the 3.3V circuit
PC817 optocoupler
IC is used. The LED5 in the circuit is used to indicate power.
Similarly the
LED1, LED2, LED3
&
LED4
is used to represent
Relay1, Relay2, Relay3
&
Relay4
output respectively. The LED5 is a power indication LED. The 4 Relays are connected to ESP32 via GPIO Pins 12, 14, 27, 26. The push buttons
SW1, SW2, SW3
, and
SW4
are used in the manual controlling of Relays. They are connected to GPIO Pins 5, 17, 13, 16. You may attach a
manual switch
there and program the controller to control the circuit.
You can connect
4 home appliannces
using the Relay connections at 3 Pin Terminal
J2, J3. J4, J
5. The 2 Pin Terminal
J1
is used to supply
AC Power
directly to the Circuit. A Capacitor C12 of 220uF, 25V is connected to PCB stop voltage fluctuations.
To program the
ESP32 raw chip
, the
FTDI pin
is provided. We can connect an
FTDI Module
(USB-to-TTL Converter) to program the ESP32 Chip directly.
Project PCB Gerber File & PCB Ordering Online
We have designed the
PCB
using the
Altium Designer Software
. It took quite a lot of time fixing all the isses in the PCB but still we managed to design a complete working custom PCB. The PCB design looks like this.
Here is the
3D View
of the PCB from the front side as well as from the backside.
The Gerber File for the PCB is given below. You can simply download the Gerber File and order the PCB from
PCBGOGO
at
1$
only.
Download Gerber File:
ESP32 Home Automation Gerber File
You can use this Gerber file to order high-quality PCB for this project. To do that visit the
PCBGOGO
official website by clicking here:
https://www.pcbgogo.com/
You can now upload the Gerber File by choosing the Quote Now option. From these options, you can choose the Material Type, Dimensions, Quantity, Thickness, Solder Mask Color and other required parameters.
After filling all details, select your country and shipping method. Finally you can place the order.
PCB & Hardware Assembly
After ordering the PCB, it took almost 5 days and I got my PCB.
The PCB quality from
PCBGOGO
is superb with very high quality. That is why most people trust
PCBGOGO
for PCB/PCBA Services.
PCB Top Side
PCB Bottom Side
First solder all the
SMD components
like resistors, capacitors, transistors, LEDs, voltage regulators & diodes. Be careful about the SMD LED polarity, place it in the proper direction. The SMD soldering is to be done on the both sides.
After soldering all these, you can solder the
ESP32 raw chip
. The final stage would be soldering all the through-hole components like Optocoupler IC, terminal block, Relays, male-female headers, and AC-to-DC Converter Module.
After soldering all the components, the ESP32 Alexa Manual & Smart Home Automation Board is ready for the test. You can upload a blink sketch by connecting a
USB-to-TTL Converter
Module.
Note:
There were some voltage fluctuation issues in the designed PCB, so I have updated the design by adding 220uF capacitor. Also, some connection issues have been fixed. The Gerber file above is updated and the PCB would be little different from shown above. But overall the functionality is same.
Espalexa Library
In this project, we will be using the
Espalexa library
to integrate the
ESP32 Home Automation
Board with
Alexa Echo Dot
Download
:
Espalexa Library
So, you’ve got this cool library called
Espalexa
. What’s it all about? Imagine being able to chat with Alexa and get her to control your
ESP gadgets
such as ESP32. This library makes that chat a breeze, and the best part? It’s all packed into an
Arduino-friendly
format.
Now, what sets Espalexa apart from other similar tools? Well, it gives you a ton of flexibility with
voice commands
. Instead of just turning things on or off, you can get precise. Tell Alexa, “Hey, dim that light to 75%,” or “Can we get the room to 21 degrees?” And she’ll handle it.
Even cooler? Espalexa has jumped onto the
color train
! Now you can say, “Alexa, let’s get a blue mood in here,” and your light will change color. If you’re more into shades of white, it’s got you covered too. By the starting line, Espalexa can juggle up to
10 devices
Source Code/Program for ESP32 Alexa Home Automation Project
Here is the
code
for the
Smart
&
Manual Home Automation
Project with
Alexa
&
ESP32
. This code is all about giving you two ways to
control devices
in your home. Imagine you have four lamps, and each lamp is connected to a
relay
(which is like a remote-controlled switch). Now, with this code:
You can ask Alexa to turn on or adjust any of these lamps. “
Alexa, turn on Lamp 1!
” and it’ll do just that.
But what if your internet goes down? No worries! There are manual switches you can press to control the lamps too.
The system is smart enough to keep checking if it’s connected to the internet. If it finds a connection, it’ll set itself up so you can use Alexa. If not, it’ll keep working with the manual switches.
Here is the complete code. In this code make changes to the
WiFi SSID
and
Password
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
1
In this
IoT project
, I demonstrate how to set up Manual & Smart
Home Automation
project with
Alexa
using the
ESP32
and
Amazon Echo Dot
. This ESP32 Alexa Home Automation project solely relies on the
Amazon Alexa App
for controlling home devices with 4
relays
. Even without the internet, you can manage devices with
push buttons
. Once the device is online, the ESP32 auto-connects to
WiFi
, preserving the relay module’s last state.
Earlier we built ESP32 Home Automation project using
WebServer
Blynk
AWS IoT Core
and
Arduino IoT Cloud
. We have designed the
custom PCB
for this project to make the device portable. We have also provided the complete
schematic
, PCB details,
Gerber File
, Bill of Materials and Source Code. The system works without any third-party IoT apps, making it straightforward for
home automation setup
Bill of Materials
For this project, we will need the following components. The component list, footprint, and quantity are given below.
S.N.
Component
Designator
Footprint
Quantity
1
Capacitor 100nf
C1, C3, C6, C7, C8, C9, C10, C11
CAP_0805
8
2
Capacitor 10uf
C2, C4, C5
CAP_0805
3
3
Capacitor 220uF, 25V
C12
FP-RAD-TH-D_10_0_5-L_16_1-MFG
1
4
Diode 1N4007
D1, D2, D3, D4
DIOM5027X262N
4
5
SP4322-01ETG
D5
SP432201ETG
1
6
Optocoupler PC817C
IC1, IC3, IC4, IC5
DIP762W60P254L458H450Q4N
4
7
ESP32 WROOM-32
IC2
ESP32WROOM3216MB
1
8
2-Pin Terminal Block
J1
1
9
3-Pin Terminal Block
J2, J3, J4, J5
4
10
Relay SRD-05VDC-SL-C
K1, K2, K3, K4
SRD
4
11
LED Red
LED1, LED2, LED3, LED4, LED5
LEDC2012X80N
5
12
Male Header 6 Pin
P1
HDR1X6
1
13
HLK-10M05
PS1
HLK10M05
1
14
Transistor BC847B
Q1, Q2, Q3, Q4, Q5, Q6
BC847B215
6
15
Resistor 220R
R1, R3, R9, R11, R14, R16, R17, R19
805
8
16
DNP
R2, R10, R15, R18
805
4
17
Resistor 12K
R4, R12, R13
805
3
18
Resistor 1K
R5, R7, R8, R24
805
4
19
Resistor 470R
R6
805
1
20
Resistor 10K
R20, R21, R22, R23
805
4
21
Push Button Switch
S1, S2, S3, S4
B3W1020
4
22
Manual Switch (Optional)
SW1, SW2, SW3, SW4
HDR1X2
4
23
HT7333 3.3V Voltage Regulator
U1
IC_HT7333
1
Circuit Diagram & Hardware Design
Let us take a look at the
Schematic
of Alexa Based Manual & Smart Home Automation Project with ESP32. The schematic is drawn using the
Altium Designer
Software.
We used SMD resistors, capacitors, and LED with the 0805 package. To convert
220V AC
to
5V DC
, we used an
AC-to-DC Converter
from
Hi-Link
. For providing power to ESP32 raw chip and other peripherals, a low-power
LDO HT7333
IC was used. To separate the high-power line from the 3.3V circuit
PC817 optocoupler
IC is used. The LED5 in the circuit is used to indicate power.
Similarly the
LED1, LED2, LED3
&
LED4
is used to represent
Relay1, Relay2, Relay3
&
Relay4
output respectively. The LED5 is a power indication LED. The 4 Relays are connected to ESP32 via GPIO Pins 12, 14, 27, 26. The push buttons
SW1, SW2, SW3
, and
SW4
are used in the manual controlling of Relays. They are connected to GPIO Pins 5, 17, 13, 16. You may attach a
manual switch
there and program the controller to control the circuit.
You can connect
4 home appliannces
using the Relay connections at 3 Pin Terminal
J2, J3. J4, J
5. The 2 Pin Terminal
J1
is used to supply
AC Power
directly to the Circuit. A Capacitor C12 of 220uF, 25V is connected to PCB stop voltage fluctuations.
To program the
ESP32 raw chip
, the
FTDI pin
is provided. We can connect an
FTDI Module
(USB-to-TTL Converter) to program the ESP32 Chip directly.
Project PCB Gerber File & PCB Ordering Online
We have designed the
PCB
using the
Altium Designer Software
. It took quite a lot of time fixing all the isses in the PCB but still we managed to design a complete working custom PCB. The PCB design looks like this.
Here is the
3D View
of the PCB from the front side as well as from the backside.
The Gerber File for the PCB is given below. You can simply download the Gerber File and order the PCB from
PCBGOGO
at
1$
only.
Download Gerber File:
ESP32 Home Automation Gerber File
You can use this Gerber file to order high-quality PCB for this project. To do that visit the
PCBGOGO
official website by clicking here:
https://www.pcbgogo.com/
You can now upload the Gerber File by choosing the Quote Now option. From these options, you can choose the Material Type, Dimensions, Quantity, Thickness, Solder Mask Color and other required parameters.
After filling all details, select your country and shipping method. Finally you can place the order.
PCB & Hardware Assembly
After ordering the PCB, it took almost 5 days and I got my PCB.
The PCB quality from
PCBGOGO
is superb with very high quality. That is why most people trust
PCBGOGO
for PCB/PCBA Services.
PCB Top Side
PCB Bottom Side
First solder all the
SMD components
like resistors, capacitors, transistors, LEDs, voltage regulators & diodes. Be careful about the SMD LED polarity, place it in the proper direction. The SMD soldering is to be done on the both sides.
After soldering all these, you can solder the
ESP32 raw chip
. The final stage would be soldering all the through-hole components like Optocoupler IC, terminal block, Relays, male-female headers, and AC-to-DC Converter Module.
After soldering all the components, the ESP32 Alexa Manual & Smart Home Automation Board is ready for the test. You can upload a blink sketch by connecting a
USB-to-TTL Converter
Module.
Note:
There were some voltage fluctuation issues in the designed PCB, so I have updated the design by adding 220uF capacitor. Also, some connection issues have been fixed. The Gerber file above is updated and the PCB would be little different from shown above. But overall the functionality is same.
Espalexa Library
In this project, we will be using the
Espalexa library
to integrate the
ESP32 Home Automation
Board with
Alexa Echo Dot
Download
:
Espalexa Library
So, you’ve got this cool library called
Espalexa
. What’s it all about? Imagine being able to chat with Alexa and get her to control your
ESP gadgets
such as ESP32. This library makes that chat a breeze, and the best part? It’s all packed into an
Arduino-friendly
format.
Now, what sets Espalexa apart from other similar tools? Well, it gives you a ton of flexibility with
voice commands
. Instead of just turning things on or off, you can get precise. Tell Alexa, “Hey, dim that light to 75%,” or “Can we get the room to 21 degrees?” And she’ll handle it.
Even cooler? Espalexa has jumped onto the
color train
! Now you can say, “Alexa, let’s get a blue mood in here,” and your light will change color. If you’re more into shades of white, it’s got you covered too. By the starting line, Espalexa can juggle up to
10 devices
Source Code/Program for ESP32 Alexa Home Automation Project
Here is the
code
for the
Smart
&
Manual Home Automation
Project with
Alexa
&
ESP32
. This code is all about giving you two ways to
control devices
in your home. Imagine you have four lamps, and each lamp is connected to a
relay
(which is like a remote-controlled switch). Now, with this code:
You can ask Alexa to turn on or adjust any of these lamps. “
Alexa, turn on Lamp 1!
” and it’ll do just that.
But what if your internet goes down? No worries! There are manual switches you can press to control the lamps too.
The system is smart enough to keep checking if it’s connected to the internet. If it finds a connection, it’ll set itself up so you can use Alexa. If not, it’ll keep working with the manual switches.
Here is the complete code. In this code make changes to the
WiFi SSID
and
Password
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
1
Technologies used
Hardware components
- ESP32
- Arduino
- Relay
Software & tools
- Blynk
What you get
- Working project / hardware kit, tested before delivery
- Complete source code with explanation
- Project demo and guidance for your viva
- Project report, PPT and IEEE paper support (on request)
Delivery & Payment
Delivery takes a minimum of two weeks from the date your inquiry is confirmed.
Payment is in two parts:
• 50% advance to start the project
• Remaining 50% before delivery
Note:
• Documentation and PPT are not included by default
• If you need documentation/PPT, it can be arranged for extra time and cost
We'll confirm the exact timeline and cost with you after reviewing your requirements.