Random Nerd Tutorials

ESP8266 Wi-Fi Button – DIY Amazon Dash Button Clone


In this project you’re going to build an ESP8266 Wi-Fi Button that can trigger any home automation event. This is like a remote control that you can take in your pocket or place anywhere that when pressed sends out an email. It can also be called a DIY Amazon Dash Button clone.

Watch the Video Version

This guide is available in video format (watch below) and in written format (continue reading this page).


Before proceeding with this tutorial we recommend taking a look at these resources:

If you like ESP8266 and you want to learn more about it. I recommend downloading my course: Home Automation using ESP8266.


The Wi-Fi button is not a new idea and this concept was popularized by Amazon that created the Dash button, which is a small button that instantly orders a product to your home.

Since the ESP boards are so inexpensive, we can make a similar project that works like the Dash button, but with our own twist.

Instead of ordering a product we can turn on a light, toggle a lamp, send a value, trigger an email notification and much more, as you’re going to see by the end of this project.


For this project we’re going to use a free service called IFTTT that stands for If This Than That.

This service is used to automate a wide variety of tasks online. In this case, we will send an email when the ESP pushbutton is pressed.

Type in your browser https://ifttt.com and click the “Get started” button in the middle of the page. Complete the form with your details and create your account.

Creating the Applet


Open the “My Applets” tab, press the create “New Applet” button.

Click the “This” word and search for the “Webhooks” service.

Receive a web request

You need to type in the event name button_pressed. With the Webhooks service you can trigger an action when you make an HTTP request to a specific URL.

Click the “Create trigger” button:

Now press the “That” word and search for the Gmail service.

Send email

If it’s the first time using the Gmail service with IFTTT, a new window opens and you’ll have to grant access, so IFTTT can send out emails through your account.

Choose the “Send email” option and enter the email address in the “To address” field where you want to receive your notification.

You can customize the subject and body of the email, but for demonstration purposes I’ll leave the default values. Finally press the “Create action” button.

You should have your Applet created after clicking “Finish”:

Testing the Applet

Open the “Search” tab, find the Webhooks service and open it.

Go to the “Documentation” tab.

Here you can find your unique API KEY that you must keep private. Type in the event name, button_pressed. Your final URL should appear in the bottom of the web page. Copy that URL.

Open a new tab in your browser and hit enter. You should see this message saying “Congratulations!”.

Open your email client and the new message should be there.

In case the email didn’t arrive after a few seconds, I recommend double-checking the URL and see if you’re using the correct event name, both in your Applet and in your URL.

Note: if it worked save your unique URL in a Notepad, because you’ll need it later in this project.

Uploading Code

Here’s the code that you need to upload to your ESP board. You need to change three variables: SSID, password and resource.

Here’s how the code works:

  1. It starts the serial communication at a baud rate of 115200;
  2. Runs the initWifi function that establishes a Wi-Fi connection between your ESP and your router;
  3. Then, it executes the makeIFTTTRequest function that will make a request to the IFTTT service and ultimately IFTTT will send out an email.

About the Deep Sleep Function

Finally, we’re using the Deep Sleep function, so that the ESP is always off and consumes very little power. The Deep Sleep function with ESP8266 was covered in greater detail in a previous guide that you can find here.

In summary, when you press the pushbutton the ESP wakes up, performs an action and it goes back to Deep Sleep mode to save battery power. It’s pretty simple how it works.

After adding your SSID, password and URL, upload the code to the ESP. You can click here to learn how to upload code to an ESP-01 using an FTDI programmer.

About the circuit

We want this device to be portable and easy to make, so we’re going to power the ESP with a Lithium battery.

Voltage Regulator

To power the ESP8266 safely with a Lithium battery you need to make a voltage regulator circuit. We’ve also covered that subject in a previous guide that you can read here.

Parts Required

After having the code running on the ESP-01, these are the components that you need for your circuit:

You can use the preceding links or go directly to MakerAdvisor.com/tools to find all the parts for your projects at the best price!


Here’s the schematics that you need to follow:

Here’s the breadboard version:

I recommend assembling the circuit first on a breadboard to test if it’s working properly.

Then, you can make a permanent circuit with a small strip board, a few wires and plastic box enclosure to store everything.

After assembling everything, here’s how the final product looks like:

It kinda looks like a remote control. Now you can take it or place it anywhere.

Let’s test it. When I press the pushbutton, I receive an email within a few seconds:

Note: even though the ESP is powered with a battery it can last weeks or even months, because it’s always in Deep Sleep mode.

Wrapping Up

I think it’s important that you keep in mind that the applications for this project are endless. For example, the event “button_pressed”, depending on where you place your ESP can have a different meaning.

If you place it as a doorbell button, you can use it to know if someone is at your home.

Also note that instead of using a 3rd party service like IFTTT, you could:

  • Turn on relay that is connected to another ESP8266;
  • Send a request to another device in your network;
  • Make an HTTP request to Node-RED to trigger an action;
  • Publish an MQTT message;
  • Connect to any other home automation software.

Taking It Further

You can also replace the pushbutton with other sensors or actuators. For instance if you replace the pushbutton with a PIR motion sensor, you can be notified when someone enters a room in your house. Or you can use it to detect smoke in a room:

Replacing the pushbutton with a magnetic reed switch allows you to detect if someone opened a door or window. You can even attach it to a mailbox to see when you receive actual letters in the mail or other packages.

That’s it for now. I hope this project was interesting and you can apply these concepts to your own home automation projects.

This is an excerpt from my Home Automation using ESP8266 eBook. If you like ESP8266 and you want to learn more about it. I recommend downloading my course: Home Automation using ESP8266.

I hope this guide was useful. Thanks for reading!

MicroPython Programming with ESP32/ESP8266 eBook

Learn how to program the ESP boards with MicroPython, including projects, tips, and tricks! The registrations are open for a limited time, so SIGN UP NOW »

Recommended Resources

Home Automation using ESP8266 »
Build IoT projects and home automation gadgets with the ESP8266 Wi-Fi module.

Build a Home Automation System »
Learn how to build a automation system using open-source hardware and software from scratch.

Arduino Step-by-Step Projects »
Build 25 cool Arduino projects with our course even with no prior experience!

Leave a Comment:

Add Your Reply

⏰ Registrations are open for "MicroPython Programming with ESP32 and ESP8266" eBook