New! https://ralphbacon.blog

So you might want to control some mains electrical (or lower voltage) item using your phone, perhaps? This single ESP8266 plug-in controls a relay that is built into the module.

An Android app (.apk) allows you to configure the relay to switch on and off (toggle) or have a momentary action. All well and good then. Well, **not really**. Watch the video to find out what they did wrong and how a small Arduino (eg Nano or even an ATTiney85) comes to the rescue!

The Arduino sketch is right here in the Github repository (simple would be too complex a word to describe it!).
https://github.com/RalphBacon/ESP8266-WiFi-Relay

Where I bought my device (Banggood)
https://www.aliexpress.com/item/ESP8266-5V-WiFi-relay-module-Things-smart-home-remote-control-switch-phone-APP/32812243370.html

Manufacturer’s Webpages
http://www.chinalctech.com/index.php?_m=mod_product&_a=view&p_id=1253 (this 5v relay)
http://www.chinalctech.com/index.php?_m=mod_product&_a=prdlist&cap_id=181 (all their WiFI relays)

Hackster.io page that walks you through the steps to configure it (thanks Graham Wise)
https://www.hackster.io/makerrelay/esp8266-wifi-5v-1-channel-relay-delay-module-iot-smart-home-e8a437

Excellent wepages on ESP8266 and AT commands
https://medium.com/@andrewlr/getting-started-with-esp8266-875fb54441d6
http://room-15.github.io/blog/2015/03/26/esp8266-at-command-reference
https://medium.com/@andrewlr/getting-started-with-esp8266-875fb54441d6 (incl. replacement for the baud rate command)

Link to the ORIGINAL AT command firmware (from Espressif) with instructions
http://www.electrodragon.com/w/ESP8266_AT-Command_firmware

If you like this video please give it a thumbs up, share it and if you’re not already subscribed please consider doing so ๐Ÿ™‚

My channel and blog are here:
——————————————————————
https://www.youtube.com/RalphBacon
https://ralphbacon.blog
——————————————————————

, https://i.ytimg.com/vi/NbQN7sOpbLU/hqdefault.jpg

source

44 Comments

  1. Hi, after connecting the relay, the blue LED on the relay flashes, in USER TCP232 TEST after opening the serial port, the monitor shows only 0000000. What should I do, any ideas?

  2. Did you ever get the start up to work with just the Nano using a sketch to set it up? Good luck with your move. Cheers!

  3. Hello, So i have the same module and i have setup everything like in the video with all the drivers installed for the usb to ttl. But when i try to send AT commands to the module there is no response back even when the app prints out that the AT command is sent successfully. I am not sure if i am doing something wrong. I think i have it all setup correctly, I even checked all the connections and they were all correct and continuous.The esp8266 seems to be working since it creates an open wifi hotspot when powered.

  4. Hello! I bought an ESP 8266 -01 wifi relay whit a preloaded software. I built up my own flashing programmer and pressing the rest button I got the info that I have wrote down using Putty.

    AI-THINKER & VOWSTAR, 2014

    SDK version:0.9.2

    mode : sta(18:fe:34:0c:73:54) + softAP(1a:fe:34:0c:73:54)

    add if0

    add if1

    dhcp server start:(ip:192.168.4.1,mask:255.255.255.0,gw:192.168.4.1)

    bcn 100

    Now I am wonderingโ€ฆ what is next?

    Do I need to re-flash the firmware again or just load an โ€ ON OFF โ€ sketch?

    I presume the AT communication is not working as the firmware was erased.

    I have red about VOWSTAR and softAP but my option is to follow Arduino sketch application like ON OFF switch.

    As I am new in this microchips and programing word I need some advice, please!

    Reply

  5. I have tried to download the 31.6 M zip file but I can not set up an account as I my area phone is not in that list. Can somebody help me sending to me that zipfile?… at christimro@gmail.com

  6. f all of that. just use a dev board 8266 and a regular relay. would cost alot less than 2 different controllers. I am glad i saw this as i was thinking of going full bore with this esp01 until I saw this. That really blows yo cant load those commands into static memory.

  7. Hi Ralph,thanks for your vids.I wander could you tell me if its possible to connect a lcd keyboard shield to a wemos d1 and if so what pins should i use.

  8. Hi Ralph does it ring home to China as you are providing your network ID and password I think I will stick to my Sonoff switch as it can remember and does the job without all that faffing about as you say too much Faffing

  9. Hi. Good video. Do you know the url I should send to activate or deactivate the relay. I want develop my own app and I can't find the. Command I must send

  10. Thanks for your explanation. For a better understanding of your video, could I ask you some questions?
    1. ESP relay can operate alone after I deliver AT command to ESP relay via USB-TTL. Am I right?

    2. AT command also can deliver to ESP relay via Arduino Mini(Nano). Am I right?

  11. you didn't explain anything ..
    just explain how to connect to the phone, it's complicated what you're saying

  12. Is the code for the Android App, EasyTCP_20.apk, available? I have a Samsung tablet and my application needs about 25 controllable devices (each with it's own ESP01 and relay), so I would like to use a tablet for more graphic space and icons that relate to my application, namely a garden railroad that has that many turnouts. Also, bringing back the status of a pair of contacts to the tablet App for display is a need. How many spare GPIO pins are left? (If not enough, a second ESP01 at each station would work as well). I do have many decades of Fortran, C and assembly language experience, with Visual Basic added recently. Appreciations in advanced.

  13. Excellent, comprehensive guide to this project. Iโ€™ve not seen any of the pitfalls of this setup mentioned on any other videos anywhere. Thanks for the heads up!

  14. Ralph, thank you for the great video. I set up my module to be an access point using the AT commands. I want to switch and use STA now but That program wonโ€™t let me make the serial connect to send more AT commands. It says that the comport is in use or doesnโ€™t exist. Any ideas on what the problem might be? Thank you in advance.

  15. I know this is more than a year old already, but that should mean you now know worlds more about the esp01. I seem to remember in one of your videos you were putting values into register memory on the eprom, so when the power was restored the values could be read from memory to set up everything to run right. Would that work in this case, or am I off my rocker?

  16. I have a :

    AT+GMR

    AT version:1.2.0.0(Jul 1 2016 20:04:45)

    SDK version:1.5.4.1(39cb9a32)

    Ai-Thinker Technology Co. Ltd.

    Dec 2 2016 14:21:16

    OK

    It does not allow me to connect, it worked once but no longer. I am not able to connect anymore.
    The AP is visable, I can connect the port is just not up.

  17. AT commands are certainly from the 70''s / 80"s but are still very valid today. All GSM modules work this way even implementing GPS and BT actions …. ๐Ÿ™‚

  18. Could i put a question to you? I am struggling to drive a simple 5v relay from a esp2866 nodemcu. i can set it up and run the gpio web control sketch and control an led but it will not trigger the relay the relay is active low or high so i can trigger it using 5v or 3.3 or ground to the in pin but the esp will not trigger it. i suspect its due to the voltage coming out of the nodemcu. how can i boost the signal coming out of the gpio pin to trigger the relay?

  19. Is there anyway I can flash this module and make it work with Amazon Alexa using MQTT? Without using any AT commands.

  20. Ralph !!! It's mean people didnt like after all that work. THis bring us back to how many engineers does it take to turn on a lightbulb. I watched to end to see if ya bashed it.

  21. Can you use a setup like this to reverse polarity e.g. to give a motor the ability to go forward, reverse and off?

  22. Thank you very much, but I'm unable to download the archive from chinese website. Can you upload and share, please?

  23. Taking back my last comment as I noticed this is posted on the GitHub link. Thanks all for this leg work for us and cheers!

  24. Link to documentation at "https://pan.baidu.com/s/1mhDfjTm" to download is locked down to those who are now subscribers of "Baidu". Not wanting to sign up to another site, is there another way to get this downloaded (LC WIFI Relay(5).zip?

  25. Hi Great video.very well explained.. I've folowed your procedure but still not getting the relay to trigger. I can see the ESP is getting the command (blue let blinks) but the relay doesn't trigger. I am using the A0 01 01 A2 as the message. I can see in the USR program that its receiving data ( 0D 0A 2B 49 50 44 2C 30 2C 34 3A A0 01 01 A2) Suggestions??

    Regards

    Meir

  26. Great tutorial. I am also annoyed by the fact that the ESP8266 forgets some settings. It should be a plug & play solution but it's not! So, I wrote an initialization program to an ATTINY and soldered it on the board that sends those missing setting to the ESP8266.

    I like this your channel a lot so I'll give you the code for anyone to use.

    /* DESCRIPTION:
    Initialisation add-on microcontroller for the ESP-8266 Relay module made by LC Technology

    Microcontroller = ATTINY 45 or 85 with an external 8MHz resonator or Xtal
    NOTE: The internal oscillator is not stable enough for reliable serial operation.

    AUTHOR: Andrea Campagnolo a.k.a. =PE4CE=
    DATE: 29-12-2017
    */

    #include <SoftwareSerial.h>
    SoftwareSerial mySerial(2, 1); // Define the RX, TX pins we want to use.
    // For this purpose we will use only the TX pin, just to keep things simple.

    void setup()
    {
    // put your setup code here, to run once:
    const byte LED = 0; // Connect a status led on PB0 Active HIGH
    pinMode(LED, OUTPUT); //
    digitalWrite(LED, LOW); // Turn OFF the status led
    mySerial.begin(9600); // Initialise the serial port and set baud rate
    delay(1000); // Wait one second for ESP8266 to boot
    mySerial.println("AT+CIPMUX=1"); // Set the MUX mode to multiple
    delay(100); // Wait some time just to be on the safe side ๐Ÿ˜‰
    mySerial.println("AT+CIPSERVER=1,8080");
    delay(100); // Again, we wait a bit
    digitalWrite(LED, HIGH); // All set! Turn ON the status Led to signal READY.
    }

    void loop()
    {
    // HAVE FUN! 73 de PE4CE
    }

  27. I'm at the point with my Arduino development where I need my UNO/Mega project to be internet connected. Mindful there there's been wifi shields for years now I went looking for them only to find that a lot of them are no longer made. Then I stumble upon the ESP8266 and ESP32… which apparently are not just wifi shields but Arduinos in thier own right.. very powerful ones too. So I'm not sure which way to turn now. A lot of my sensor logic for my project is 5v… the ESPs are 3.3v… so if I just use the ESP then I have a problem there. If I use the UNO for my sensors and the ESP just for wifi it feels like one hell of a waste….

  28. 21:52 you used a "gabidy gook" or how would you spell that? :). Also, if i need to connect lets say 3 devices to be controlled with Nano, how the things would work? Each esp8266 has different IP, but probably the same port. Do I need to open them all and just manage the packets send and requested thru the commands?

  29. Just checked out the doco, and the diagram shows that GPIO2 drives the relay – has anyone tried MQTT and drive the GPIO2 directly rather than the inbuilt web interface?

  30. Very good video Ralph. Some Russian guy made some very good modification of this relay board. He removed uC STC15F104 and some resistors and he has connected relay directly to GPI0. In this case you do not need Arduino NANO anymore cas you can program ESP8266 to boot up correctly after power up. In this case this relay board with ESP8266 is in stand alone mode without any need to resend AT commands at power up.

    https://www.youtube.com/watch?v=f8kW5INQMPU

    This tweak intended for change control of relay from serial to GPIO.
    For tweak you need:
    1. Unsolder 15F104
    2. Unsolder R4
    3. 7th pin from 15F104(or R2) connect with any free GPIO pins
    4. GPIO and 3.3v pins connect with 10kOhm resistor.

  31. As a 71 year old retired programmer that decided to get back into programming, you do a great job in quick starting anyone trying to do a restart in this field. Thank you and thank you again for your generous donation of time and sharing what you know. Respectfully, Steve โ€“ N1QDT.

  32. Hi.
    Do you know where can i find the firmware so i can flash it again?.
    i think ive bricked it ๐Ÿ™

    THanks.
    Marc.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.