ESP8266 and Relay Control Using Smartphone

Introduction: ESP8266 and Relay Control Using Smartphone

This instruction describes ESP8266 microcontroller start-up to control by smartphone a relay connected to the ESP. In a separate instruction I will try to present a similar case, but instead of the ESP8266 microcontroller we will use Raspberry PI version B+.

Here we go then

What will we need?

  1. A smartphone, Android (3.1.x Version or higher) or iPhone iOS 6.1 (or higher).
  2. An ESP8266 module version 512KB flash (or higher). This article will cover the ESP8266-12 version.
  3. A USB-Serial converter to program ESP. I have used the “FT232RL FTDI 3.3V 5.5V USB to TTL Serial Adapter”.
  4. PCB adapter for ESP.
  5. 3.3/5V powering unit. I have used the YwRobot module.
  6. A relay module. For this article I have used version I had close at hand i.e. YwRobot 4 relay.
  7. 12V charger.
  8. Two (2) LED diodes, one of which must be RGB.
  9. Two (2) micro-switches
  10. One (1) transistor. I have used BC547.
  11. Three (3) 100R resistors.
  12. Two (2) 10K resistors.
  13. One (1) breadboard.
  14. Connecting wiring.
  15. Piece of a thin wire.

Do not forget to connect the ESP module TXD pin to the USB-Serial converter RXD pin, and the ESP module RXD pin to the USB-Serial converter TXD pin. “IN1” must be connected to the relay module.

Let’s start…

Step 1: Solder

Solder the ESP8266-12 module to the PCB adapter

Step 2: Make Hookups

With a thin wire make hookups for easier module pin connections

Step 3: ​Mount the ESP Module

Mount the ESP module on the breadboard, make sure “GND” and “VCC” pins end up in the 25th row

Step 4: Mount All the Remaining Parts

Step 5: Connect All the Elements

Connect all the elements with connecting wiring according to the scheme.

NOTE! In this particular case, we skip the R1 resistor and 3.3V plug in as the PCB adapter already has both. Moreover, GND of the USB-Serial converter must be connected to the GND of the powering module.

Step 6: Software for the Microcontroller

Software for the microcontroller. Appropriate firmware is required in order to have the microcontroller working. In this case, we will use firmware to be downloaded from GITHUB:

NOTICE! Some versions of the ESP8266-12 have the 4th and 5th GPIO ports inverted. If this is the case, you need to use firmware which will be compatible. Such a solution is available at:

Firmware must be writted in the following flash memory area:



You must use appropriate software to have firmware loaded onto the microcontroller. I have used „NODEMCU FIRMWARE PROGRAMMER”

32bit Version:

64bit Version:

You must select proper serial port where the USB-Serial converter has been plugged in and enter the other settings which can be seen on the screenshots.

If the ESP module is connected via the USB-Serial converter to the computer, and all the above steps have been performed, we can upload the software.

- Provide 12V power supply. - Press and hold the micro-switch connected to the GPIO0 port (the nearest to the powering unit), and turn the power on – keep pressing the micro-switch the whole time. - Release the micro-switch when power is on.

The RGB diode should now gently flash three colors.

We can now load firmware. Using NODEMCU click „Flash” and wait until progress bar reaches 100% for each of the two files.

NOTICE! ESP8266 module is very interference-sensitive. When it is connected to breadboard temporarily, firmware load may not be successful at the first time. Therefore, sometimes the attempt must be made few times. If the firmware was loaded successfully, we can disconnect power supply and remove the USB-Serial converter and move to the next step.

NOTICE! ESP will not start, if the converter remains on the breadboard not connected to a powered-up computer.

Step 7: ESP Configuration

Before any steps are taken you need to subscribe to the OpenSource service project called SUPLA at .

You need to read location settings and password as well as server address after you log on

Now, we can start the proper ESP configuration.

  • Turn the power supply on.
  • RGB diode should flash in blue indicating the module is in configuration mode. If the diode flash in red, you need to press and hold for at least 5 sec. the second switch (the furthest to the powering unit). Such action should put the unit in the configuration mode manually, and the diode should start flashing blue automatically.
  • You need to connect to SUPLA-ESP8266 WiFi network from any computer with WiFi card.
  • Go to and enter access data of your home WiFi having Internet access, password and location identifier obtained from into the form.Click „Save”.
  • Turn the power off and on back again or press switch No. 2 (the furthest to the powering unit).

* Module does not display password, which does not mean they are not saved.

**Properly saved data will be confirmed with the “Data Saved” alert.

***LAST STATE: defines status of the most recent server connection. If the entered location data was incorrect, you can return to the configuration to read the last alert.

RDG diode will indicate module status, after restart:

  • Red light – No WiFi connection or IP address from DHCP has not been obtained
  • Blue light – steady burn: WiFi connection has been obtained. IP address has been obtained, but no connection to server ( has been set.
  • Green light – Server connection has been set. Unit is ready to work. It is worth pointing out that the relay can also be operated manually when pressing switch No. 2.

Step 8: ​Smartphone Configuration

First of all, you need to download the application on your phone from AppStore or Google Play. Application is free of charge.

Install and start the application. Right after you start it, a window will appear, where all the settings from must be entered. Save the settings and the relay connected to the ESP can be operated via your Smartphone.

Digital Life 101 Challenge

Participated in the
Digital Life 101 Challenge

Be the First to Share


    • Pocket-Sized Speed Challenge

      Pocket-Sized Speed Challenge
    • Super-Size Speed Challenge

      Super-Size Speed Challenge
    • Audio Challenge 2020

      Audio Challenge 2020

    8 Discussions


    2 years ago

    after I uploaded the firmware (the firmware was uploaded successfully ) I cant find the wifi SUPLA-ESP8266


    2 years ago

    do this app support from esp8266 station mode????


    2 years ago

    I'm use FTDI32 with esp8285mod neither does the nodemcu flash recognize the esp when I plug in the usb cable nor does the official esp download tool , any suggestions please?


    4 years ago

    How can i control all the four relays with this. Thanks.


    4 years ago

    I use NodeMCU ESP-12, but it seems the firmware does not work :-(


    4 years ago

    Using thin write is definitely the smartest way to get this breadboard friendly


    4 years ago

    Good tips! Thanks for sharing your instructions!