The marvelous ESP smart button … now with feedback!

Who don’t need a connected button???

Immagine a button who automatically send a message via WiFi to your server and start your heating, or trigger the start of your favorite film on your TV. It’s time to build one!

Materials needed:

  • the button enclosure plus a switch and battery holder — I found out a low-cost push light in an elegant white enclosure perfect for realizing this button (and big enough to not lose in a messy environment)
  • the WiFi board — I chose a very simple and low cost ESP8266
  • the light — I used an 8 element NeoPixel bar
  • connection wires


  • an MQTT broker for
  • optionally an IoT platform like Node-Red
  • Arduino IDE for compile and program the ESP8266

When the button is pressed the ESP turn on and try to connect to the WiFi, if the board cannot connect automatically switch toaccess point mode and ask to choose the WiFi and insert the password.

  • Once the WiFi is connected the board immediately connect to an MQTT server and the light become blue.
  • After the subscription to the confirmation message queue the board sends a message to the queue:
iot/T/esp8266/I/<chip id>/D/button/F/json
  • When the message is sent the board wait for an answer on the queue
iot/T/esp8266/I/<chip id>/C/button/F/json
  • If this message contains the string “OK” the light becomes green, otherwise red.

When you can see the feedback light (green or red) you can turn off the board clicking the button once again.