Using ESP8266 and XD-FST module to emulate your gate remote

In this tutorial, I will show you how to emulate a gate remote. First using an ESP8266 together with a receiver (XD-RF-5V) to read the codes from your original gate remote and then using it together with a transmitter (XD-FST) to emulate the codes.

Parts Required

Read the codes from the original remote

There are different types of remotes (fixed code, rolling code), using different frequency ranges. In this tutorial, we use a 4-channel remote from the image below, that works with fixed codes at 433Mhz.

The circuit used to read the codes from the original remote is made by an ESP8266 connected to the XD-RF-5V.

After uploading the code below, open the serial port from ESP8266 and press the remote button you want to emulate. The output should be a row with similar information: “Received 360195 / 24bit Protocol: 1″. Take note of this information, you will need it in the next step!

#include < RCSwitch.h >
 RCSwitch mySwitch = RCSwitch();
 
 void setup() {
   Serial.begin(9600);
   mySwitch.enableReceive(0);  // Receiver on interrupt 0 => GPIO 0 (D3)
 }
 
 void loop() {
   if (mySwitch.available()) {
     
     int value = mySwitch.getReceivedValue();
     
     if (value == 0) {
       Serial.print("Unknown encoding");
     } else {
       Serial.print("Received ");
       Serial.print( mySwitch.getReceivedValue() );
       Serial.print(" / ");
       Serial.print( mySwitch.getReceivedBitlength() );
       Serial.print("bit ");
       Serial.print("Protocol: ");
       Serial.println( mySwitch.getReceivedProtocol() );
     }
 
     mySwitch.resetAvailable();
   }
 }

Emulate the original remote code

Now that you have the information about the code you want to emulate, connect the transmitter (XD-FST) to the ESP8266 using the following circuit.

Replace the decimal value with the one you take note of in the previous step and upload the following code to ESP8266. Using a pushbutton or simply using a wire to connect D2 to GND will trigger the code signal.

#include < RCSwitch.h >

RCSwitch mySwitch = RCSwitch();

void setup() {

  //Pushbutton pin is connected to D2
  pinMode(4, INPUT_PULLUP); //GPIO 4 (D2)
  //Transmitter data pin is connected to D3  
  mySwitch.enableTransmit(0);
}

void loop() {
  // read the state of the pushbutton value
  if(digitalRead(4) == LOW){
    //Using decimal code
    mySwitch.send(360195, 24);
    delay(1000);
  }
}

Leave a Reply

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