Cloning an RF remote

Hello everybody,

I'm trying to copy a RF remote for garage doors. The remote is a rolling code one. I don't bother at this moment about the rolling code as i'm stuck with recording and transmitting the signal (ones i make progress on copying and retransmitting the signal, i will try to obtain the encryption key and registering the remote with the garage door). I'm able to capture the signal and record it, but i can't understand the way to send it. I'm using a couple of cheap receiver and transmitter bought from ebay for 4$. The frequency is 433mhz.

The code i receive is composed with short and long ones separated by zeros (Ex: 1110011111). From that code i found the following sequence:
Each short ones equal to a LOW and each long ones equal to a HIGH. Applying that logic to the code captured i obtained this:
000000000000110001001100101000100110111000101101001010011100111011111111101111
000000000000110001001100101000100110111000101101001010011100111011111111101110
000000000000110001001100101000100110111000101101001010011100111011111111101110

As you see, the signal is repeated three times with the second bit of last two repetitions turned zero.

By registering a couple more signals i found that the last 34 bits of every signal is the same. Below are three different captures:

000000000000110001001100101000100110111000101101001010011100111011111111101111
000000000000110001001100101000100110111000101101001010011100111011111111101110
000000000000110001001100101000100110111000101101001010011100111011111111101110

000000000000000011010010100011001000001100001101001010011100111011111111101111
000000000000000011010010100011001000001100001101001010011100111011111111101110
000000000000000011010010100011001000001100001101001010011100111011111111101110

000000000000101111100000000101110101111010101101001010011100111011111111101111
000000000000101111100000000101110101111010101101001010011100111011111111101110
000000000000101111100000000101110101111010101101001010011100111011111111101110

Now, when i transmit the signal i captured and registers it. I don't get the same sequence i registered from the remote. What am i doing wrong when transmitting it? Below is the code i wrote to capture and transmit the RF signal:

short rxPin = 2;
short txPin = 4;
short ledPin = 12;
short btnPin = 6;

bool receiving = false;
const long receiveThreshold = 50000;
const long endThreshold = 20000;
const long maxSignalLength = 100500;
long pulseWidth = 0;
const short maxSignalArraySize = 1500;
byte pulseType[maxSignalArraySize]; //0 = LOW, 1 = HIGH
//short pulseDuration[maxSignalArraySize]; //Stores the length of each pulse
short pulseIndex = 0;
unsigned long pulseStart = -1;
unsigned long lastPulseEnd = -1;
unsigned long signalStart = -1;
byte lastPulseType = 0;
bool receiveCompleted = false;
int buttonState = 0;

short signalCount = 0;
short lowCount = 4;
bool zeroStarted = false;
bool signalStarted = false;

void setup() {
  Serial.begin(9600);
  pinMode(rxPin, INPUT);
  pinMode(txPin, OUTPUT);
  pinMode(ledPin, OUTPUT);
}

void loop() {

  byte b = digitalRead(rxPin);
  delayMicroseconds(110);
  //Serial.print(b);
  //Check the beginning of the signal
  if (!receiving)
  {
    //Signal begins with a long HIGH pulse, detect the start of the HIGH pulse
    if (b == 1)
    {
      if (pulseStart == -1)
      {
        pulseStart = micros();
      }
    }
    else if (pulseStart != -1)
    {
      pulseWidth = (lastPulseEnd  - pulseStart);
      //If the first pulse of HIGH exceeds the receiveThreshold, then we're receiving a signal
      if (pulseWidth > receiveThreshold)
      {
        //Signal transmission has already started with the first HIGH pulse
        //setPulseValue(1, pulseWidth);
        /*pulseType[pulseIndex] = b;
          pulseIndex++;*/

        signalStart = pulseStart;
        pulseStart = micros();
        receiving = true;
        digitalWrite(ledPin, HIGH);
      }
      else
      {
        pulseStart = -1;
      }
    }
  }
  else
  {
    if (!receiveCompleted)
    {
      if (pulseIndex < 1500)
      {
        if (b == 1)
        {
          if (!signalStarted)
            signalStarted = true;

          signalCount++;

          if (zeroStarted)
            zeroStarted = false;
        }
        else if (!zeroStarted && signalStarted)
        {
          zeroStarted = true;

          if (signalCount < lowCount)
          {
            pulseType[pulseIndex] = 0;
            pulseIndex++;
          }
          else
          {
            pulseType[pulseIndex] = 1;
            pulseIndex++;
          }
          signalCount = 0;
        }
      }
      else
      {
        receiveCompleted = true;
        Serial.println();
        for (int i = 0; i < 1500; i++)
        {
          Serial.print(pulseType[i]);
        }
      }

      if (b != lastPulseType)
      {
        pulseWidth = lastPulseEnd - pulseStart;
        pulseStart = micros();
        lastPulseType = b;

        //If the pulse of LOW exceeds the endThreshold, the signal transmission is completed
        if (b == 1 && pulseWidth > endThreshold)
        {
          receiveCompleted = true;

          for (int i = 0; i < pulseIndex; i++)
          {
            Serial.print(pulseType[i]);
          }

          digitalWrite(ledPin, HIGH);
          delay(3000);
          digitalWrite(ledPin, LOW);
        }
      }
    }
    else
    {
      //If the user press the button, send the signal
      if (buttonState == 0 && digitalRead(btnPin) == 1)
      {
        buttonState = 1;
        digitalWrite(ledPin, HIGH);

        for (int i = 0; i < 1500; i++)
        {
          byte cBit = pulseType[i];
          digitalWrite(txPin, HIGH);

          if (cBit == 1)
            delayMicroseconds(100);
          else
            delayMicroseconds(80);

          digitalWrite(txPin, LOW);
          delayMicroseconds(100);
        }

        delay(3000);
        digitalWrite(ledPin, LOW);
      }
    }
  }

  lastPulseEnd  = micros();
}

Thanks for any help.

It will be very difficult to crack the rolling code, so why are you bothering with all this?

There is no point in trying to clone a remote on a rolling code system.
You will have better luck making a remote that the receiver can learn as a unique remote.
Or simpler yet, use your cheap RF set to activate the button inside the garage.

I'm just surprised you have a garage system running on 433. All the ones I've seen are 310, 315, and 390. Maybe you're trying to make sense of noise.

INTP:
I'm just surprised you have a garage system running on 433. All the ones I've seen are 310, 315, and 390. Maybe you're trying to make sense of noise.

I'm not surprised. RF 433MHz is a popular RF module in the arduino world. But cloning a RF control is really not easily. As my knowledge it need to decode the received signal. These seem to be quite hard.

You're not surprised secure commercial products are using 433MHz because it's popular in the Arduino world? Quite the non-sequitur there.