-->
Page 5 of 29

Re: Trouble with ESP-01 + 1Ch 5V relay from LC Technology

PostPosted: Thu May 04, 2017 11:54 pm
by viper_lasser
@Mgazza
Can You share your program ?
Should I setup some pins for serial communication ?

Re: Trouble with ESP-01 + 1Ch 5V relay from LC Technology

PostPosted: Tue May 16, 2017 12:45 am
by jackwan1
Hi,
I am new here, but I have the same problem with this device.
I wrote to the mfg chinalctech@163.com
They sent me a link
http://pan.baidu.com/s/1skIhfWh

To down load documentation for this device. Since it is written in Chinese English, it is very difficult to follow. But I have manage to link the ESP-01 to my router by flashing it with ESPeasy. Can some one help me to have the Espeasy to send a "serial command" to the unit to turn on or off the relay? This command suppose to be in HEX and( A00101A2 to turn on and A00101A1 to turn off) per documentation.
This is the part that I have a problem. Since I flash the unit with Espeasy, the original firmware is no longer there and I do not have an Android phone to use their software. I need to know if it is a Arduino IDE sketch, can some one post it? And let me know how to send commend to the unit after that.

or if some one can help me on the Espeasy. I am planning to work it using Domoticz and espeasy,

Re: Trouble with ESP-01 + 1Ch 5V relay from LC Technology

PostPosted: Thu May 25, 2017 5:24 pm
by JanAage
Hello.
I have also been troubling with this ESP8266 with relay module.
I have searched the web for possible solutions to this puzzle,
and this thread was actually closest to a solution I could find.

Now that it seems I have figured out how to operate the relay
with the ESP, I thought I should share the working code for
future reference to anybody who's struggling with this module.

The code is just modified "Blink" scetch to turn on and off
the relay every 2 seconds. Hope some find it useful.

Code: Select all/********************************************************************************************
  "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;
    }   
  }
}

Re: Trouble with ESP-01 + 1Ch 5V relay from LC Technology

PostPosted: Mon May 29, 2017 1:51 pm
by maciunio2
Hi, on chinese Baidu site, I've found schematics of this module and some description (translated to english with google translator - forgive me the quality it is as is). You can find more here - https://goo.gl/5O0bEF and attached. Maybe it would help to operate it or modify something to make it easier to use.