{"id":53313,"date":"2019-01-08T08:19:20","date_gmt":"2019-01-08T08:19:20","guid":{"rendered":"http:\/\/randomnerdtutorials.com\/?p=53313"},"modified":"2020-03-05T00:46:54","modified_gmt":"2020-03-05T00:46:54","slug":"alexa-echo-with-esp32-and-esp8266","status":"publish","type":"post","link":"https:\/\/randomnerdtutorials.com\/alexa-echo-with-esp32-and-esp8266\/","title":{"rendered":"Alexa (Echo) with ESP32 and ESP8266 &#8211; Voice Controlled Relay"},"content":{"rendered":"<p>In this project, you&#8217;re going to learn how to control the ESP8266 or the ESP32 with voice commands using Alexa (Amazon Echo Dot). As an example, we&#8217;ll control two 12V lamps connected to a relay module. We&#8217;ll also add two 433 MHz RF wall panel switches to physically control the lamps.\u00a0<!--more--><\/p>\n<p><span style=\"color: #ff0000;\"><strong>Note<\/strong>: this tutorial is compatible with all Echo Dot generations and with the latest fauxmoESP library (3.1.0). It works with ESP32 and ESP8266.<\/span><\/p>\n<h2>Watch the Project Video Demonstration<\/h2>\n<p style=\"text-align:center\"><iframe width=\"720\" height=\"405\" src=\"https:\/\/www.youtube.com\/embed\/wj9B7FTWWfQ?rel=0\" frameborder=\"0\" allowfullscreen><\/iframe><\/p>\n<p>We recommend the following tutorials as a reference:<\/p>\n<ul>\n<li><a href=\"https:\/\/randomnerdtutorials.com\/getting-started-with-esp8266-wifi-transceiver-review\/\">Getting Started with ESP8266 Wi-Fi Transceiver<\/a><\/li>\n<li><a href=\"https:\/\/randomnerdtutorials.com\/getting-started-with-esp32\/\">Getting Started with ESP32 Dev Module<\/a><\/li>\n<li><a href=\"https:\/\/randomnerdtutorials.com\/decode-and-send-433-mhz-rf-signals-with-arduino\/\">Decode and Send 433 MHz RF Signals with Arduino<\/a><\/li>\n<li><a href=\"https:\/\/randomnerdtutorials.com\/guide-for-relay-module-with-arduino\/\" target=\"_blank\" rel=\"noopener noreferrer\">Guide for Relay Module with Arduino<\/a><\/li>\n<\/ul>\n<h2>Project Overview<\/h2>\n<p>This project works both with ESP8266 and ESP32. We provide instructions for both development boards. Before getting straight to the project, read this section to see what you&#8217;ll achieve by the end of this project.<\/p>\n<h3>Control Lamps using Alexa<\/h3>\n<p>By the end of this project you&#8217;ll be able to control two lamps (lamp 1 and lamp 2) with voices commands using Alexa. The figure below shows a high-level overview on how the project works to control lamp 1 &#8211; it works similarly for lamp 2.<\/p>\n<p><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter size-full wp-image-53414\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/alexa-esp8266-esp32-f2.jpg?resize=750%2C357&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"750\" height=\"357\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/alexa-esp8266-esp32-f2.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/alexa-esp8266-esp32-f2.jpg?resize=300%2C143&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/p>\n<p>Alexa will respond to the following commands:<\/p>\n<ul>\n<li><em>&#8220;Alexa, turn on lamp 1&#8221;<\/em><\/li>\n<li><em>&#8220;Alexa, turn off lamp 1&#8221;<\/em><\/li>\n<li><em>&#8220;Alexa, turn on lamp 2&#8221;<\/em><\/li>\n<li><em>&#8220;Alexa, turn on lamp 2&#8221;<\/em><\/li>\n<li><em>&#8220;Alexa, turn on lamps&#8221; turns on both lamps<\/em><\/li>\n<li><em>&#8220;Alexa, turn off lamps&#8221; turns off both lamps<\/em><\/li>\n<\/ul>\n<p>When you say something like <em>&#8220;Alexa, turn on lamp 1&#8221;<\/em>, the ESP8266 or ESP32 will trigger a relay to turn on lamp 1. When you say something like\u00a0<em>&#8220;Alexa, turn off lamp 1&#8221;<\/em>, the ESP8266 or ESP32 will send a signal to the relay to turn off the lamp. This works similarly for lamp 2.<\/p>\n<h3>Control Lamps using 433 MHz Wall Switches<\/h3>\n<p>In this project, we&#8217;ll also add two 433 MHz wall switches to physically control the lamps. You&#8217;ll have a switch for each lamp. The switch changes the lamp&#8217;s state to the opposite of its current state. For example, if the lamp is off, press the wall switch to turn it on. To turn it off, you just need to press the switch again. Take a look at the figure below that illustrates how it works.<\/p>\n<p><img data-recalc-dims=\"1\" decoding=\"async\" class=\"aligncenter size-full wp-image-53341\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/esp32-433-lamp.jpg?resize=750%2C431&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"750\" height=\"431\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/esp32-433-lamp.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/esp32-433-lamp.jpg?resize=300%2C172&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/p>\n<h2>Parts Required<\/h2>\n<p>Here\u2019s a complete list of the parts required for this project (click the links below to find the best price at\u00a0<a href=\"https:\/\/makeradvisor.com\/tools\/\" target=\"_blank\" rel=\"noopener noreferrer\">Maker Advisor<\/a>):<\/p>\n<p><img data-recalc-dims=\"1\" decoding=\"async\" class=\"aligncenter size-full wp-image-53613\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/parts-required.jpg?resize=750%2C421&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"750\" height=\"421\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/parts-required.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/parts-required.jpg?resize=300%2C168&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/p>\n<ul>\n<li>ESP Board (you can use either ESP32 or ESP8266):\n<ul>\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/esp8266-esp-12e-nodemcu-wi-fi-development-board\/\" target=\"_blank\" rel=\"noopener noreferrer\">ESP8266<\/a>\u00a0\u2013 read\u00a0<a href=\"https:\/\/makeradvisor.com\/best-esp8266-wi-fi-development-board\/\" target=\"_blank\" rel=\"noopener noreferrer\">Best ESP8266 Wi-Fi Development Boards<\/a><\/li>\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/esp32-dev-board-wi-fi-bluetooth\/\" target=\"_blank\" rel=\"noopener noreferrer\">ESP32<\/a> &#8211; we use the<a href=\"https:\/\/makeradvisor.com\/tools\/esp32-dev-board-wi-fi-bluetooth\/\" target=\"_blank\" rel=\"noopener noreferrer\">\u00a0ESP32 DOIT DEVKIT V1 Board\u00a0\u2013 36 GPIOs<\/a>\u00a0(read\u00a0<a href=\"https:\/\/makeradvisor.com\/esp32-development-boards-review-comparison\/\" target=\"_blank\" rel=\"noopener noreferrer\">ESP32 development boards comparison<\/a>)<\/li>\n<\/ul>\n<\/li>\n<li>Alexa &#8211; Echo, Echo Show or Echo Dot <strong>(read the next section for more details)<\/strong><\/li>\n<li><a href=\"https:\/\/makeradvisor.com\/433-mhz-rf-wall-switch\/\" target=\"_blank\" rel=\"noopener noreferrer\">433 MHz RF Wall Panel Switch<\/a><\/li>\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/433mhz-receiver-transmitter-module\/\" target=\"_blank\" rel=\"noopener noreferrer\">433 MHz transmitter\/receiver<\/a><\/li>\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/12v-2a-power-adaptor-dc-jack\/\" target=\"_blank\" rel=\"noopener noreferrer\">12V 2A power adaptor<\/a><\/li>\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/lm2577lm2596-step-down-buck-converter\/\" target=\"_blank\" rel=\"noopener noreferrer\">Step-down buck converter<\/a><\/li>\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/5v-2-channel-relay-module-optocoupler\/\" target=\"_blank\" rel=\"noopener noreferrer\">Relay module<\/a><\/li>\n<li>12V lamp<\/li>\n<li>12V lamp holder<\/li>\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/dc-power-male-plug-jack-adapter-2-1mm\/\" target=\"_blank\" rel=\"noopener noreferrer\">Male DC barrel jack 2.1mm<\/a><\/li>\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/prototyping-circuit-board-stripboard\/\" target=\"_blank\" rel=\"noopener noreferrer\">Stripboard\u00a0<\/a>or <a href=\"https:\/\/makeradvisor.com\/tools\/mb-102-solderless-breadboard-830-points\/\" target=\"_blank\" rel=\"noopener noreferrer\">breadboard<\/a><\/li>\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/jumper-wires-kit-120-pieces\/\">Jumper Wires<\/a><\/li>\n<\/ul>\n<p>You can use the preceding links or go directly to <a href=\"https:\/\/makeradvisor.com\/tools\/?utm_source=rnt&utm_medium=post&utm_campaign=post\" target=\"_blank\">MakerAdvisor.com\/tools<\/a> to find all the parts for your projects at the best price!<\/p><p style=\"text-align:center;\"><a href=\"https:\/\/makeradvisor.com\/tools\/?utm_source=rnt&utm_medium=post&utm_campaign=post\" target=\"_blank\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/header-200.png?w=1200&#038;quality=100&#038;strip=all&#038;ssl=1\"><\/a><\/p>\n<h2>How to Buy An Amazon Echo<\/h2>\n<p>You can use the links below to buy an Amazon Echo. There are several models available &#8211; all of them are compatible with this project.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-53336\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/Alexas.jpg?resize=750%2C392&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"750\" height=\"392\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/Alexas.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/Alexas.jpg?resize=300%2C157&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/p>\n<p>Buying an Amazon Echo through Amazon is not possible for all countries. We provide links for Amazon in UK, USA, and Germany. If the Amazon Echo does not ship to your country through Amazon, you can get one from eBay (available worldwide).<\/p>\n<p><strong>Echo Dot (2nd Generation)<\/strong><\/p>\n<ul>\n<li><strong><a href=\"http:\/\/amzn.to\/2FeWb6F\" target=\"_blank\" rel=\"noopener nofollow noreferrer\">United States &#8211; Amazon.com<\/a>*<\/strong><\/li>\n<li><strong><a href=\"http:\/\/ebay.to\/2HWBbjO\" target=\"_blank\" rel=\"noopener nofollow noreferrer\">Available Worldwide &#8211; eBay.com<\/a><\/strong><\/li>\n<li><a href=\"http:\/\/amzn.to\/2HYlcSi\" target=\"_blank\" rel=\"noopener nofollow noreferrer\">United Kingdom &#8211; Amazon.co.uk<\/a>*<\/li>\n<li><a href=\"http:\/\/amzn.to\/2oI1DVo\" target=\"_blank\" rel=\"noopener nofollow noreferrer\">Germany\u00a0&#8211; Amazon.de<\/a>*<\/li>\n<\/ul>\n<p><strong>Echo (2nd Generation)<\/strong><\/p>\n<ul>\n<li><strong><a href=\"http:\/\/amzn.to\/2oBdV2I\" target=\"_blank\" rel=\"noopener nofollow noreferrer\">United States &#8211; Amazon.com<\/a>*<\/strong><\/li>\n<li><strong><a href=\"http:\/\/ebay.to\/2F6I93K\" target=\"_blank\" rel=\"noopener nofollow noreferrer\">Available Worldwide &#8211; eBay.com<\/a><\/strong><\/li>\n<li><a href=\"http:\/\/amzn.to\/2FKUVGq\" target=\"_blank\" rel=\"noopener nofollow noreferrer\">United Kingdom &#8211; Amazon.co.uk<\/a>*<\/li>\n<li><a href=\"http:\/\/amzn.to\/2HUNOMa\" target=\"_blank\" rel=\"noopener nofollow noreferrer\">Germany\u00a0&#8211; Amazon.de<\/a>*<\/li>\n<\/ul>\n<p><strong>Echo Show<\/strong><\/p>\n<ul>\n<li><strong><a href=\"http:\/\/amzn.to\/2FKwJ6N\" target=\"_blank\" rel=\"noopener nofollow noreferrer\">United States &#8211; Amazon.com<\/a>*<\/strong><\/li>\n<li><strong><a href=\"http:\/\/ebay.to\/2CSuuLW\" target=\"_blank\" rel=\"noopener nofollow noreferrer\">Available Worldwide &#8211; eBay.com<\/a><\/strong><\/li>\n<li><a href=\"http:\/\/amzn.to\/2oIYpBd\" target=\"_blank\" rel=\"noopener nofollow noreferrer\">United Kingdom &#8211; Amazon.co.uk<\/a>*<\/li>\n<li><a href=\"http:\/\/amzn.to\/2GTqnl5\" target=\"_blank\" rel=\"noopener nofollow noreferrer\">Germany\u00a0&#8211; Amazon.de<\/a>*<\/li>\n<\/ul>\n<p><em>* We are a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for us to earn fees by linking to Amazon.com and affiliated sites.<\/em><\/p>\n<h2>433 MHz RF Wall Panel Switch<\/h2>\n<p>The 433 MHz RF wall panel switch is a great way to remotely control devices. It can be easily attached to a wall with adhesive tap, without the need to make holes on the walls. Additionally, it is wireless, so you don&#8217;t need to worry about wiring and then hiding cables.<\/p>\n<p>In this project we&#8217;re using two wall panel switches. Instead, you can use a panel switch with two buttons &#8211; there are also another version with three switches.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-53415\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/wall-panel-switch-esp32.jpg?resize=750%2C421&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"750\" height=\"421\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/wall-panel-switch-esp32.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/wall-panel-switch-esp32.jpg?resize=300%2C168&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/p>\n<p>This wall panel switch\u00a0has a push button in its circuit, as shown in the figure below, that when pressed emits a 433 MHz signal. You can use that signal to control whatever you want. This wall panel switch uses a 27A 12V type battery (not included in the package). So, you may want to buy one, when you get your wall panel switch.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-53417\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/wall-panel-switch-open.jpg?resize=750%2C453&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"750\" height=\"453\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/wall-panel-switch-open.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/wall-panel-switch-open.jpg?resize=300%2C181&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/p>\n<h2>Decode the Wall Panel Switch 433 MHz RF Signals<\/h2>\n<p>When you press the 433 MHz wall panel switch, it sends a 433 MHz signal. You need to decode that signal using a 433 MHz receiver. To learn how to decode the 433 MHz signal read the following post:\u00a0<a href=\"https:\/\/randomnerdtutorials.com\/decode-and-send-433-mhz-rf-signals-with-arduino\/\">Decode and Send 433 MHz RF Signals with Arduino<\/a>\u00a0&#8211; read the &#8220;Decoder Sketch&#8221; part. The sketch works with Arduino, ESP32, and ESP8266.<\/p>\n<p>Take note of the decimal (24Bit) code for each of your switches, because you&#8217;ll need them later.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-53418\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/rf-signal-433.png?resize=750%2C279&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"750\" height=\"279\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/rf-signal-433.png?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/rf-signal-433.png?resize=300%2C112&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/p>\n<p>In my case:<\/p>\n<ul>\n<li>switch 1: <strong>6819768<\/strong><\/li>\n<li>switch 2:\u00a0<strong>9463928<\/strong><\/li>\n<\/ul>\n<p>You should get different values. You&#8217;ll then use these signals in your ESP8266 or ESP32 sketch. When you press the switch, it sends a 433 MHz signal. This signal is detected by the receiver that is connected to the ESP. This way, the ESP knows the switch was pressed and it inverts the lamp&#8217;s current state.<img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-53348\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/433-esp32-lamp.jpg?resize=750%2C156&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"750\" height=\"156\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/433-esp32-lamp.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/433-esp32-lamp.jpg?resize=300%2C62&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/p>\n<h2>The FauxmoESP<\/h2>\n<p>To control your ESP8266 or ESP32 with Amazon Echo, you need to install the FauxmoESP library. This library emulates a Belkin Wemo device, allowing you to control your ESP32 or ESP8266 using this protocol.\u00a0This way, the Echo or Echo Dot instantly recognizes the device, after uploading the code, without any extra skills or third party services. You can read more about <a href=\"https:\/\/bitbucket.org\/xoseperez\/fauxmoesp\" target=\"_blank\" rel=\"noopener noreferrer\">FauxmoESP here<\/a>.<\/p>\n<p><strong>Installing the FauxmoESP Library<\/strong><\/p>\n<ol>\n<li><a href=\"https:\/\/bitbucket.org\/xoseperez\/fauxmoesp\/get\/master.zip\" target=\"_blank\" rel=\"noopener noreferrer\">Click here to download the FauxmoESP library<\/a>. You should have a .zip folder in your Downloads<\/li>\n<li>Unzip the\u00a0<em>.zip<\/em>\u00a0folder and you should get <strong>xoseperez-fauxmoesp-50cbcf3087fd\u00a0<\/strong>folder<\/li>\n<li>Rename your folder from\u00a0<del><strong>xoseperez-fauxmoesp-50cbcf3087fd<\/strong><\/del>\u00a0to <strong>xoseperez_fauxmoesp<\/strong><\/li>\n<li>Move the xoseperez_fauxmoesp folder to your Arduino IDE installation\u00a0<strong>libraries\u00a0<\/strong>folder<\/li>\n<li>Finally, re-open your Arduino IDE<\/li>\n<\/ol>\n<h2>Alexa &#8211; Echo Dot with ESP8266<\/h2>\n<p>Follow these next instructions if you&#8217;re using an ESP8266.<\/p>\n<p><strong>Installing the ESP8266 Board in Arduino IDE<\/strong><\/p>\n<p>In order to upload code to your ESP8266 using Arduino IDE, you should install an add-on for the Arduino IDE that allows you to program the ESP8266 using the Arduino IDE and its programming language. If you haven&#8217;t installed the ESP8266 add-on for the Arduino IDE, follow the next tutorial:<\/p>\n<ul>\n<li><a href=\"https:\/\/randomnerdtutorials.com\/how-to-install-esp8266-board-arduino-ide\/\">How to Install the ESP8266 Board in Arduino IDE<\/a>.<\/li>\n<\/ul>\n<p><strong>Installing the ESPAsyncTCP Library<\/strong><\/p>\n<p>You also need to install the\u00a0ESPAsyncTCP Library library. Follow the next instructions to install it:<\/p>\n<ol>\n<li><a href=\"https:\/\/github.com\/me-no-dev\/ESPAsyncTCP\/archive\/master.zip\" target=\"_blank\" rel=\"noopener noreferrer\">Click here to download the ESPAsyncTCP library<\/a>. You should have a .zip folder in your Downloads<\/li>\n<li>Unzip the\u00a0<em>.zip<\/em>\u00a0folder and you should get\u00a0<strong>ESPAsyncTCP-master\u00a0<\/strong>folder<\/li>\n<li>Rename your folder from\u00a0<del><strong>E<\/strong><\/del><del><strong>SPAsyncTCP-master<\/strong><\/del>\u00a0to <strong>ESPAsyncTCP<\/strong><\/li>\n<li>Move the ESPAsyncTCP folder to your Arduino IDE installation\u00a0<strong>libraries\u00a0<\/strong>folder<\/li>\n<li>Finally, re-open your Arduino IDE<\/li>\n<\/ol>\n<h3>Schematic<\/h3>\n<p>If you&#8217;re using an ESP8266 board, assemble your circuit by following the next schematic diagram &#8211; you can click the image to zoom.<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/Alexa_ESP8266_schematic.png?quality=100&#038;strip=all&#038;ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-53320\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/Alexa_ESP8266_schematic.png?resize=1200%2C832&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"1200\" height=\"832\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/Alexa_ESP8266_schematic.png?w=1263&amp;quality=100&amp;strip=all&amp;ssl=1 1263w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/Alexa_ESP8266_schematic.png?resize=300%2C208&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/Alexa_ESP8266_schematic.png?resize=768%2C533&amp;quality=100&amp;strip=all&amp;ssl=1 768w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/Alexa_ESP8266_schematic.png?resize=1024%2C710&amp;quality=100&amp;strip=all&amp;ssl=1 1024w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/a><\/p>\n<p>If you&#8217;re having trouble following the circuit diagram, you can use the following table as a reference:<\/p>\n<table>\n<tbody>\n<tr>\n<td><b>ESP8266<\/b><\/td>\n<td><b>Connect to<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">GPIO 5<\/span><\/td>\n<td><span style=\"font-weight: 400;\">433 MHz receiver data pin<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">GPIO 4<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Relay IN1 pin<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">GPIO 14<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Relay IN2 pin<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span style=\"color: #ff0000;\"><b>IMPORTANT NOTE<\/b><\/span>: before applying power, make sure you set your step-down buck converter output voltage to 5V! Otherwise, you may damage your ESP.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-53419\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/buck-converter-5V.jpg?resize=750%2C395&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"750\" height=\"395\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/buck-converter-5V.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/buck-converter-5V.jpg?resize=300%2C158&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/p>\n<h2>Alexa &#8211; Echo Dot with ESP32<\/h2>\n<p>Follow these next instructions if you&#8217;re using an ESP32.<\/p>\n<p><strong>Installing the ESP32 Board in Arduino IDE<\/strong><\/p>\n<p>In order to upload code to your ESP32 using Arduino IDE, you should install an add-on for the Arduino IDE that allows you to program the ESP32 using the Arduino IDE and its programming language. If you haven&#8217;t installed the ESP32 add-on for the Arduino IDE, follow the next tutorial:<\/p>\n<ul>\n<li><a href=\"https:\/\/randomnerdtutorials.com\/installing-the-esp32-board-in-arduino-ide-windows-instructions\/\"><strong>Windows instructions<\/strong>\u00a0\u2013 Installing the ESP32 Board in Arduino IDE<\/a><\/li>\n<li><a href=\"https:\/\/randomnerdtutorials.com\/installing-the-esp32-board-in-arduino-ide-mac-and-linux-instructions\/\"><strong>Mac and Linux instructions<\/strong>\u00a0\u2013\u00a0Installing the ESP32 Board in Arduino IDE<\/a><\/li>\n<\/ul>\n<p><strong>Installing the AsyncTCP Library<\/strong><\/p>\n<p>You also need to install the AsyncTCP Library. Follow the next instructions to install it:<\/p>\n<ol>\n<li><a href=\"https:\/\/github.com\/me-no-dev\/AsyncTCP\/archive\/master.zip\" target=\"_blank\" rel=\"noopener noreferrer\">Click here to download the AsyncTCP library<\/a>. You should have a .zip folder in your Downloads<\/li>\n<li>Unzip the\u00a0<em>.zip<\/em>\u00a0folder and you should get\u00a0<strong>AsyncTCP-master\u00a0<\/strong>folder<\/li>\n<li>Rename your folder from\u00a0<del><strong>AsyncTCP-master<\/strong><\/del>\u00a0to\u00a0<strong>AsyncTCP<\/strong><\/li>\n<li>Move the AsyncTCP folder to your Arduino IDE installation\u00a0<strong>libraries\u00a0<\/strong>folder<\/li>\n<li>Finally, re-open your Arduino IDE<\/li>\n<\/ol>\n<h3>Schematic<\/h3>\n<p>If you&#8217;re using an ESP32 board, assemble your circuit by following the next schematic diagram &#8211; you can click the image to zoom.<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/Alexa_ESP32_schematic.png?quality=100&#038;strip=all&#038;ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-53319\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/Alexa_ESP32_schematic.png?resize=1200%2C850&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"1200\" height=\"850\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/Alexa_ESP32_schematic.png?w=1231&amp;quality=100&amp;strip=all&amp;ssl=1 1231w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/Alexa_ESP32_schematic.png?resize=300%2C213&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/Alexa_ESP32_schematic.png?resize=768%2C544&amp;quality=100&amp;strip=all&amp;ssl=1 768w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/Alexa_ESP32_schematic.png?resize=1024%2C725&amp;quality=100&amp;strip=all&amp;ssl=1 1024w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/a><\/p>\n<p>If you&#8217;re having trouble following the circuit diagram, you can use the following table as a reference:<\/p>\n<table>\n<tbody>\n<tr>\n<td><b>ESP32<\/b><\/td>\n<td><b>Connect to<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">GPIO 13<\/span><\/td>\n<td><span style=\"font-weight: 400;\">433 MHz receiver data pin<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">GPIO 14<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Relay IN1 pin<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">GPIO 12<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Relay IN2 pin<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span style=\"color: #ff0000;\"><b>IMPORTANT NOTE<\/b><\/span>: before applying power, make sure you set your step-down buck converter output voltage to 5V! Otherwise, you may damage your ESP.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-53419\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/buck-converter-5V.jpg?resize=750%2C395&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"750\" height=\"395\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/buck-converter-5V.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/buck-converter-5V.jpg?resize=300%2C158&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/p>\n<h2>Code<\/h2>\n<p>Copy the following code to your Arduino IDE, but don&#8217;t upload it yet! You need to make some changes to make it work for you.<\/p>\n<pre style=\"max-height: 40em; margin-bottom: 20px;\"><code class=\"language-c\">\/*\n * Rui Santos \n * Complete Project Details http:\/\/randomnerdtutorials.com\n*\/\n\n#include &lt;Arduino.h&gt;\n#ifdef ESP32\n  #include &lt;WiFi.h&gt;\n  #define RF_RECEIVER 13\n  #define RELAY_PIN_1 12\n  #define RELAY_PIN_2 14\n#else\n  #include &lt;ESP8266WiFi.h&gt;\n  #define RF_RECEIVER 5\n  #define RELAY_PIN_1 4\n  #define RELAY_PIN_2 14\n#endif\n#include &quot;fauxmoESP.h&quot;\n\n#include &lt;RCSwitch.h&gt;\n\n#define SERIAL_BAUDRATE 115200\n\n#define WIFI_SSID &quot;REPLACE_WITH_YOUR_SSID&quot;\n#define WIFI_PASS &quot;REPLACE_WITH_YOUR_PASSWORD&quot;\n\n#define LAMP_1 &quot;lamp one&quot;\n#define LAMP_2 &quot;lamp two&quot;\n\nfauxmoESP fauxmo;\n\nRCSwitch mySwitch = RCSwitch();\n\n\/\/ Wi-Fi Connection\nvoid wifiSetup() {\n  \/\/ Set WIFI module to STA mode\n  WiFi.mode(WIFI_STA);\n\n  \/\/ Connect\n  Serial.printf(&quot;[WIFI] Connecting to %s &quot;, WIFI_SSID);\n  WiFi.begin(WIFI_SSID, WIFI_PASS);\n\n  \/\/ Wait\n  while (WiFi.status() != WL_CONNECTED) {\n    Serial.print(&quot;.&quot;);\n    delay(100);\n  }\n  Serial.println();\n\n  \/\/ Connected!\n  Serial.printf(&quot;[WIFI] STATION Mode, SSID: %s, IP address: %s\\n&quot;, WiFi.SSID().c_str(), WiFi.localIP().toString().c_str());\n}\n\nvoid setup() {\n  \/\/ Init serial port and clean garbage\n  Serial.begin(SERIAL_BAUDRATE);\n  Serial.println();\n\n  \/\/ Wi-Fi connection\n  wifiSetup();\n\n  \/\/ LED\n  pinMode(RELAY_PIN_1, OUTPUT);\n  digitalWrite(RELAY_PIN_1, HIGH);\n\n  pinMode(RELAY_PIN_2, OUTPUT);\n  digitalWrite(RELAY_PIN_2, HIGH);\n  \n  mySwitch.enableReceive(RF_RECEIVER);  \/\/ Receiver on interrupt 0 =&gt; that is pin #2\n\n  \/\/ By default, fauxmoESP creates it's own webserver on the defined port\n  \/\/ The TCP port must be 80 for gen3 devices (default is 1901)\n  \/\/ This has to be done before the call to enable()\n  fauxmo.createServer(true); \/\/ not needed, this is the default value\n  fauxmo.setPort(80); \/\/ This is required for gen3 devices\n\n  \/\/ You have to call enable(true) once you have a WiFi connection\n  \/\/ You can enable or disable the library at any moment\n  \/\/ Disabling it will prevent the devices from being discovered and switched\n  fauxmo.enable(true);\n  \/\/ You can use different ways to invoke alexa to modify the devices state:\n  \/\/ &quot;Alexa, turn lamp two on&quot;\n\n  \/\/ Add virtual devices\n  fauxmo.addDevice(LAMP_1);\n  fauxmo.addDevice(LAMP_2);\n\n  fauxmo.onSetState([](unsigned char device_id, const char * device_name, bool state, unsigned char value) {\n    \/\/ Callback when a command from Alexa is received. \n    \/\/ You can use device_id or device_name to choose the element to perform an action onto (relay, LED,...)\n    \/\/ State is a boolean (ON\/OFF) and value a number from 0 to 255 (if you say &quot;set kitchen light to 50%&quot; you will receive a 128 here).\n    \/\/ Just remember not to delay too much here, this is a callback, exit as soon as possible.\n    \/\/ If you have to do something more involved here set a flag and process it in your main loop.\n        \n    Serial.printf(&quot;[MAIN] Device #%d (%s) state: %s value: %d\\n&quot;, device_id, device_name, state ? &quot;ON&quot; : &quot;OFF&quot;, value);\n    if ( (strcmp(device_name, LAMP_1) == 0) ) {\n      \/\/ this just sets a variable that the main loop() does something about\n      Serial.println(&quot;RELAY 1 switched by Alexa&quot;);\n      \/\/digitalWrite(RELAY_PIN_1, !digitalRead(RELAY_PIN_1));\n      if (state) {\n        digitalWrite(RELAY_PIN_1, LOW);\n      } else {\n        digitalWrite(RELAY_PIN_1, HIGH);\n      }\n    }\n    if ( (strcmp(device_name, LAMP_2) == 0) ) {\n      \/\/ this just sets a variable that the main loop() does something about\n      Serial.println(&quot;RELAY 2 switched by Alexa&quot;);\n      if (state) {\n        digitalWrite(RELAY_PIN_2, LOW);\n      } else {\n        digitalWrite(RELAY_PIN_2, HIGH);\n      }\n    }\n  });\n\n}\n\nvoid loop() {\n  \/\/ fauxmoESP uses an async TCP server but a sync UDP server\n  \/\/ Therefore, we have to manually poll for UDP packets\n  fauxmo.handle();\n\n  static unsigned long last = millis();\n  if (millis() - last &gt; 5000) {\n    last = millis();\n    Serial.printf(&quot;[MAIN] Free heap: %d bytes\\n&quot;, ESP.getFreeHeap());\n  }\n    \n  if (mySwitch.available()) {    \n  \/*Serial.print(&quot;Received &quot;);\n    Serial.print( mySwitch.getReceivedValue() );\n    Serial.print(&quot; \/ &quot;);\n    Serial.print( mySwitch.getReceivedBitlength() );\n    Serial.print(&quot;bit &quot;);\n    Serial.print(&quot;Protocol: &quot;);\n    Serial.println( mySwitch.getReceivedProtocol() );*\/\n    if (mySwitch.getReceivedValue()==6819768) {\n      digitalWrite(RELAY_PIN_1, !digitalRead(RELAY_PIN_1));\n    }\n    if (mySwitch.getReceivedValue()==9463928) {\n      digitalWrite(RELAY_PIN_2, !digitalRead(RELAY_PIN_2));     \n    }\n    delay(600);\n    mySwitch.resetAvailable();\n  }\n}\n<\/code><\/pre>\n\t<p style=\"text-align:center\"><a class=\"rntwhite\" href=\"https:\/\/github.com\/RuiSantosdotme\/Random-Nerd-Tutorials\/raw\/master\/Projects\/Alexa\/ESP32_ESP8266_2_Devices.ino\" target=\"_blank\">View raw code<\/a><\/p>\n<h3>Selecting the right board<\/h3>\n<p>This code works both with ESP32 and ESP8266. To make it work for your board, you need to select the board you&#8217;re using in <strong>Tools\u00a0<\/strong>&gt; <strong>Board<\/strong>. Select your ESP8266 or ESP32 model.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-53423\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/arduino-ide-select-esp8266.png?resize=600%2C427&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"600\" height=\"427\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/arduino-ide-select-esp8266.png?w=600&amp;quality=100&amp;strip=all&amp;ssl=1 600w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/arduino-ide-select-esp8266.png?resize=300%2C214&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 600px) 100vw, 600px\" \/><\/p>\n<h3>Add your network credentials<\/h3>\n<p>You need to modify the following lines to include your network credentials.<\/p>\n<pre>#define WIFI_SSID \"<strong>REPLACE_WITH_YOUR_SSID<\/strong>\"\n#define WIFI_PASS \"<strong>REPLACE_WITH_YOUR_PASSWORD<\/strong>\"<\/pre>\n<h3>Add your 433 MHz signal codes<\/h3>\n<p>You also need to include the signals you&#8217;ve decoded previously for your wall panel switches.<\/p>\n<p>Replace the value highlighted in red with the value you&#8217;ve gotten for the switch that controls lamp 1:<\/p>\n<pre>if (mySwitch.getReceivedValue()==<span style=\"color: #ff0000;\"><strong>6819768<\/strong><\/span>) {\n\u00a0 digitalWrite(RELAY_PIN_1, !digitalRead(RELAY_PIN_1));\n}<\/pre>\n<p>And the value for lamp 2 in the following:<\/p>\n<pre>if (mySwitch.getReceivedValue()==<strong><span style=\"color: #ff0000;\">9463928<\/span>)<\/strong> {\n\u00a0 digitalWrite(RELAY_PIN_2, !digitalRead(RELAY_PIN_2));\n}<\/pre>\n<h3>Uploading the code<\/h3>\n<p>After making all the necessary changes, you can upload code to your ESP. Make sure you have the right COM port selected, in <strong>Tools<\/strong> &gt; <strong>Port<\/strong>. For demonstration purposes, you can open your Serial Monitor at a baud rate of 115200, while you prepare your Echo Dot.<\/p>\n<h2>Alexa, Discover Devices<\/h2>\n<p>With the circuit ready, and the code uploaded to your ESP8266 or ESP32, you need to ask alexa to discover devices.<\/p>\n<p>Say: &#8220;Alexa, discover devices&#8221;. It should answer as shown in the figure below.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-53353\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/alexa-esp8266-esp32-discover-devices.jpg?resize=750%2C282&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"750\" height=\"282\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/alexa-esp8266-esp32-discover-devices.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/alexa-esp8266-esp32-discover-devices.jpg?resize=300%2C113&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/p>\n<p>Alternatively, you can also discover devices using the Amazon Alexa app, by following the steps shown in the figure below.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-53426\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/alexa-app-discover-devices.jpg?resize=750%2C318&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"750\" height=\"318\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/alexa-app-discover-devices.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/alexa-app-discover-devices.jpg?resize=300%2C127&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/p>\n<p>Then, ask Alexa to turn on\/off the lamps. You&#8217;ll also get information about the lamps state on the Serial Monitor.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-53424\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/serial-monitor.png?resize=796%2C550&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"796\" height=\"550\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/serial-monitor.png?w=796&amp;quality=100&amp;strip=all&amp;ssl=1 796w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/serial-monitor.png?resize=300%2C207&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/serial-monitor.png?resize=768%2C531&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 796px) 100vw, 796px\" \/><\/p>\n<p>After making sure everything is working properly, you can turn your circuit into a permanent solution.<\/p>\n<h2>Demonstration<\/h2>\n<p>For demonstration purposes, we&#8217;ve built our circuit in a prototyping stripboard, and attached everything in a wooden board, as shown in the figure below:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-53421\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/esp8266-esp32-alexa-circuit.jpg?resize=750%2C421&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"750\" height=\"421\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/esp8266-esp32-alexa-circuit.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/esp8266-esp32-alexa-circuit.jpg?resize=300%2C168&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/p>\n<p>Now you can ask Alexa to control your lamps with the following voice commands:<\/p>\n<ul>\n<li><em>&#8220;Alexa, turn on lamp 1&#8221;<\/em><\/li>\n<li><em>&#8220;Alexa, turn off lamp 1&#8221;<\/em><\/li>\n<li><em>&#8220;Alexa, turn on lamp 2&#8221;<\/em><\/li>\n<li><em>&#8220;Alexa, turn on lamp 2&#8221;<\/em><\/li>\n<\/ul>\n<p>You can also control both lamps at the same time by creating a group in the Amazon Alexa app. We called it &#8220;lamps&#8221;.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-53427\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/alea-create-group.jpg?resize=750%2C433&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"750\" height=\"433\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/alea-create-group.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/alea-create-group.jpg?resize=300%2C173&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/p>\n<p>Now, you can control both lamps at the same time, using the following voice commands.<\/p>\n<ul>\n<li><em>&#8220;Alexa, turn on lamps&#8221;<\/em><\/li>\n<li><em>&#8220;Alexa, turn off lamps&#8221;<\/em><\/li>\n<\/ul>\n<p>You can also physically control your lamps using the 433 MHz wall panel switches.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-53425\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/wall-panel-switch-test.jpg?resize=750%2C421&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"750\" height=\"421\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/wall-panel-switch-test.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/wall-panel-switch-test.jpg?resize=300%2C168&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/p>\n<h2>Wrapping Up<\/h2>\n<p>In this project we&#8217;ve shown how to control your ESP8266 and your ESP32 with voice commands using Amazon Echo. As an example, we&#8217;ve controlled two 12V lamps using a relay. Instead of 12V lamps, you can control any other electronics appliances. We&#8217;ve also shown you how you can remotely control your lamps using a 433 MHz wall panel switch.<\/p>\n<p>We hope you&#8217;ve found this project useful. If you liked this post, you may also like:<\/p>\n<ul>\n<li><a href=\"https:\/\/randomnerdtutorials.com\/build-a-home-automation-system-for-100\/\" target=\"_blank\" rel=\"noopener noreferrer\">Build a Home Automation System<\/a><\/li>\n<li><a href=\"https:\/\/randomnerdtutorials.com\/home-automation-using-esp8266\/\">Home Automation using ESP8266<\/a><\/li>\n<li><a href=\"https:\/\/randomnerdtutorials.com\/build-an-all-in-one-esp32-weather-station-shield\/\">Build an All-in-One ESP32 Weather Station Shield<\/a><\/li>\n<li><a href=\"https:\/\/randomnerdtutorials.com\/esp8266-wi-fi-button-diy-amazon-dash-button-clone\/\">ESP8266 Wi-Fi Button \u2013 DIY Amazon Dash Button Clone<\/a><\/li>\n<li><a href=\"https:\/\/randomnerdtutorials.com\/esp8266-daily-task-publish-temperature-readings-to-thingspeak\/\" target=\"_blank\" rel=\"noopener noreferrer\">ESP8266 Daily Task \u2013 Publish Temperature Readings to ThingSpeak<\/a><\/li>\n<\/ul>\n<p>Thanks for reading.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this project, you&#8217;re going to learn how to control the ESP8266 or the ESP32 with voice commands using Alexa (Amazon Echo Dot). As an example, we&#8217;ll control two 12V &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"Alexa (Echo) with ESP32 and ESP8266 &#8211; Voice Controlled Relay\" class=\"read-more button\" href=\"https:\/\/randomnerdtutorials.com\/alexa-echo-with-esp32-and-esp8266\/#more-53313\" aria-label=\"Read more about Alexa (Echo) with ESP32 and ESP8266 &#8211; Voice Controlled Relay\">CONTINUE READING \u00bb<\/a><\/p>\n","protected":false},"author":1,"featured_media":53614,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[296,281,276,299,265,264],"tags":[],"class_list":["post-53313","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-alexa","category-esp32-project","category-esp32","category-0-esp32","category-esp8266-project","category-project"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/03\/ESP8266-ESP32-Alexa-Thumbnail.jpg?fit=1280%2C720&quality=100&strip=all&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/53313","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/comments?post=53313"}],"version-history":[{"count":0,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/53313\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media\/53614"}],"wp:attachment":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media?parent=53313"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/categories?post=53313"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/tags?post=53313"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}