ESP8266 Relay Module working with Blynk

Hey guys! I’m a newbie in this world.
Some days ago i bought this, basically it’s a ESP8266 Relay Module, it contains a ESP-01 (Ai-Cloud inside) and a Relay, all in one single module. So i plugged 5V and GND to the Relay and connected the ESP, i connected the tx+rx , did a small configuration using AT commands with the serial but i didn’t want to use that firmware, so i thought to flash Blynk. Then i started thinking: how the relay and the ESP communicate?
I did a search and discovered the module uses another module to communicate (STM8S003), so it’s not using ESP GPIOs. I don’t know how can i control it with Blynk. Maybe you can help me!
Thank you

Yes, i’ve seen this topic before. The problem is that my relay isn’t turning on even with the DC5V from external power and having properly set everything. I’m hoping it’s a code problem. I’ll try with the above topic, hoping that will work. Thank you.

The photos don’t show the underside of the board, but there doesn’t seem to be much physical isolation between the mains side of the board and the low voltage side. The board doesn’t even seem to claim that it has any type of certification such as CE, so I’d be a bit careful with it if you’re switching any high current loads.

You should certainly avoid connecting your FTDI programmmer to the board with mains voltage applied.

Pete.

Wait… really?? Well if that is the case, just don’t bother with it for Blynk… get something more suitable for Blynk and save that module for whatever default code/app it came with.

Yes, this module is just useless. I think he will soon meet trash can. :joy:
btw thank you all anyway!

PS. I’ll leave the schematic of the module below, just in case someone want to see more: here.

I am using that same module with success.
Took me a while to figure out, but is easy once the hex codes are in place.
Have a look here:
http://www.esp8266.com/viewtopic.php?p=66327#p66327

With Blynk?

Yes I am.
Please dont ask for the code, as I dont have it at hand right now.
Basically you open and close the relay with hex codes sent by tx serial output.

/********************************************************************************************
          "Blink"
          Turns onboard Relay on for two seconds, then off for two seconds, repeatedly.

          Modified arduino native Blink scetch to test the 'ESP8266 5V Wifi Relay Module' by
          LC Technology (www.lctech-inc.com) bought from Ebay. http://www.ebay.com/itm/291971732400
          First tested with Arduino without the ESP8266, then programmed ESP8266 with this scetch
          for standalone operation.                                                     - janaaage
          
        *********************************************************************************************

        * Onboard ESP8266 WIFI module, AP mode 5 client can be connected at the same time;
        * Module has two work modes: 
          (1) cell phones carry on the WiFi moduledirectly;
          (2) cell phone andwifi modulecarryon the same router;
        * Transmission distance: 
          (1) the open environment, the mobile phone when carrying on the WIFI module maximum 
              transmission distance of 400m;
          (2) when the WiFI module and cell phone carrying on thesamerouter,the transmission distance 
              depend on the router’s signal intensity;
        * Onboard 5v, 10 A / 250 v AC 10 A / 30 v DC relay, absorb 100000 times continuously;
          Module with diode effusion protection, short response time;
        * Module baud rate: 9600,8,1,0,0.
        * Introduced the hardware and instructions
          Size: 45*28mm
        * The board function description:
          IN +,IN-: 5Vpower input;
          TX ,RX and GND:  serial port debug pins

        * If you want to use a computer to control relay, you can unplug the ESP8266 WiFi 
          module,and TX ,RX ,GND pin of USB to TTL module connect to TX ,RX ,GND pin 
          of ESP8266 relay module, IN+ and IN- connect to DC5V power,
          Send serial command(A00101A2 open relay; A00100A1 closed relay,command 
          format must be hex) with debugging software on the computer to control the relay.  

                              TX ON LC-RELAY GOES TO TX ON ARDUINO!!!
                              
        *********************************************************************************************/

        byte relON[] = {0xA0, 0x01, 0x01, 0xA2};  //Hex command to send to serial for open relay
        byte relOFF[] = {0xA0, 0x01, 0x00, 0xA1}; //Hex command to send to serial for close relay

        int ledState = false;
        unsigned long previousMillis = 0;
        const long interval = 2000; //  2 seconds

        // the setup function runs once when you press reset or power the board
        void setup() {
          // initialize serial:
          Serial.begin(9600);
        }

        // the loop function runs over and over again forever
        void loop()
        {
          unsigned long currentMillis = millis();
          if(currentMillis - previousMillis >= interval) {
            previousMillis = currentMillis;   
            if (ledState == true) {
              Serial.write(relON, sizeof(relON));     // turns the relay ON
              ledState = false;
            } else {
              Serial.write(relOFF, sizeof(relOFF));   // turns the relay OFF
              ledState = true;
            }    
          }
        }

Thank you… this will give all two other users who had the misfortune to acquire this thing… some hope of using it with Blynk :stuck_out_tongue:

1 Like

Thank you @Jan-Age, will try asap. I’ll get you updated! :slight_smile:
@Gunner sure, people have to know about this crap!

For those unfortunate to have bought ESP-01’s the relay looks pretty decent for $1.25.

Okay, do that works with the ESP or it only works without it?
I flashed that code into my ESP8266 thru my programmer, inserted the ESP into the module,made the connections (TXmodule > TXarduino ; RXmodule ; RXarduino, GNDmodule > GNDarduino) and the +5V external power and GND to the Relay, but nothing. I can see the built-in blue led from the module that is flashing continuosly, but the relay isn’t producing any sound
What am i doing wrong? :confused:
My connections:

The sketch goes in the arduino.
Remove the ESP.
Try swapping Tx/Rx.

Tried, also swapped tx/rx. Nothing appears here, and the blue led flashes continuosly, i’m getting mad! :open_mouth:

No blue LED if you remove the ESP-01 board entirely. Worked for me.

So strange. I removed all. Here you can see what’s appening.

Hey all, after many attemps i finally got my board working, i made some edits on the board, watch this (and the description too). Then i flashed my ESP with Blynk and worked!

I know sonoff is a bit more expensive comparing just bucks to bucks, but when we add a PSU and some case for that … module(?) And all that efforts to run this thing… Any way - always good, what ends well (good, but not the best :wink: )

the code is written for the blynk application for the esp8266 realy module

   #include <SoftwareSerial.h>
    #include <ESP8266WiFi.h>
    #include <BlynkSimpleEsp8266.h>
     
    char auth[] = "you_blink_pin";
    char ssid[] = "you_wifi_ssid";
    char pass[] = "you_wifi_password";
     
    BLYNK_WRITE(V0)
    {
      int pinValue = param.asInt();
      if (pinValue == 1) {
            const byte RelayON[] = {0xA0, 0x01, 0x01, 0xA2};
            Serial.write(RelayON, sizeof(RelayON));
         }else {
            const byte RelayOFF[] = {0xA0, 0x01, 0x00, 0xA1};
            Serial.write(RelayOFF, sizeof(RelayOFF));
        }
    }
     
    void setup()
    {
      Serial.begin(9600);
      Blynk.begin(auth, ssid, pass);
    }
     
    void loop()
    {
      Blynk.run();
    }
1 Like