ESP01/01S RELAY MODULE TUTORIAL

by mybotic in Circuits > Wireless

219590 Views, 120 Favorites, 0 Comments

ESP01/01S RELAY MODULE TUTORIAL

cf796b49fa628c1d5b22c216dd7c03ea1536138541-sm.jpg

Description

This WiFi relay based on AI-Thinker ESP-01/ 01S WiFi module, we use the GPIO0 of ESP-01/ 01S to control the relay by low level. It’s easy to DIY your smart switch to any device by your phone anywhere with this smart relay.

Specifications

  • Working voltage: DC 5V-12V
  • Working current: ≥250mA
  • Communication: ESP01 or ESP 01S
  • WiFi module Transmission distance: the maximum transmission distance is 400m (open environment, mobile phone equipped with WiFi module)
  • Load: 10A/ 250VAC, 10A/ 30VDC, 10A/ 30VDC, 10A/ 28VDC
  • Size: 37 x 25mm

Material Preparation

f2aa00cad96357b533a90a2d5fa386101435637476-sm.jpg
2aa8e1a36111bfe0c3611c5c363c185e1432786272-sm.jpg

In this tutorial, we only used the following materials:

  1. USB to UART FTDI Converter
  2. ESP8266 WiFi Serial Transceiver Module

and last but not least, ESP01/01S Relay Module.

We connect ESP8266 WiFi Serial Transceiver Module to ESP01/01S Relay Module so that we can control the relay via WiFi. To program ESP8266, FTDI Converter is required to be connected with ESP8266.

Hardware Installation

ESP8266-Flasher.png
download.png

As for the connection between ESP8266 and FTDI Converter, it is shown as diagram above or listed as below:

  1. RX -> TX
  2. TX -> RX
  3. VCC -> VCC
  4. CH_EN -> VCC
  5. GPIO-0 -> GND
  6. GND -> GND

The pins for ESP8266 is also labeled as diagram 2.

After done uploading the code to ESP8266, simply connect it to ESP01/01S Relay Module.

Uploading the Code

For coding part, change the SSID and PASSWORD to your WiFi SSID and Password respectively. In the code, it is mentioned that serial begin is 115200, so make sure that the serial monitor is 115200 otherwise it will not display anything. We set the URL to https://192.168.0.178/ and it will be used later on.

Results

Untitled.png
40950795_610467179350257_7582085894262226944_n.jpg

When we access the URL, it will show as diagram 1 above. Make sure that you have been activated the ESP8266 along with ESP01/01S Relay Module with a range of 5V to 12V so that you can access the URL. The results for the module is shown as diagram 2 which LED lighted up indicated that the relay is ON.

Once we pressed the OFF in URL, the relay will be turned OFF simultaneously and vice versa for ON option.