Working on a Custom Gate/Garage remote build into the car

Hello!

I'm trying to build a small radio module which I'll mount inside of my car + connect to one of the "dead" buttons. End goal: instead of using 2 separate remotes, I'll just have an integrated button which will open both the gate as well as garage doors for me.

I managed to copy the codes from the remotes - one has a short, fixed code (12 bits) but the second one is more complex. It uses a long, rolling code.

Fortunately for me, I copied one of the codes using a cheap AliExpress remote and it continues to work + does not mess up my original button. So even though the gate uses rolling codes - I can repeat each one as many times as I want.

I'm now building+coding a prototype, but I figured it would be best if I prepare both the transmitter as well as a separate receiver project, so I can verify I'm sending it all correctly. I don't want to run 4 floors back and forth or sit in the garage with my laptop.

And here starts my problem:
I can send the shortcode without issues, but when I try to send the long one it doesn't work. Same transmitter and same receiver - one code gets received, and the second one is not.

I suspect the issue might lie in the length of the code, but I'm not sure + don't know how to check it...

Hardware:

The transmitter code:

/*
  The library I use -> https://github.com/sui77/rc-switch/
*/

#include <RCSwitch.h>

#define PIN_433TX 12
#define PIN_BTN_K1 14

RCSwitch mySwitch = RCSwitch();

String codes[2] = {
  "111111110110",
  "111111111111001011110100111001110111001001011000101111001100000000001010010011",
};

void setup() {
  Serial.begin(9600);
  mySwitch.enableTransmit(PIN_433TX);
  mySwitch.setProtocol(11);
  pinMode(PIN_BTN_K1, INPUT_PULLUP);
}

void loop() {

  if (digitalRead(PIN_BTN_K1) == LOW) {
    Serial.println("Sending signals...");
    delay(300);
    Serial.println("[1] SEND ==> " + codes[0]);
    mySwitch.send(codes[0].c_str());
    delay(1000);
    Serial.println("[2] SEND ==> " + codes[1]);
    mySwitch.send(codes[1].c_str());
    delay(1000);
    Serial.println("Done 👍\n");
    delay(500);
  }
}

The receiver:

/*
  Libreries used:
  
  https://github.com/sui77/rc-switch/
  https://github.com/LSatan/SmartRC-CC1101-Driver-Lib
  ----------------------------------------------------------
  Mod by Little Satan. 
  ----------------------------------------------------------
*/
#include <ELECHOUSE_CC1101_SRC_DRV.h>
#include <RCSwitch.h>

RCSwitch mySwitch = RCSwitch();

void setup() {
  Serial.begin(9600);

  if (ELECHOUSE_cc1101.getCC1101()) {
    Serial.println("Connection OK");
  } else {
    Serial.println("Connection Error");
  }

  ELECHOUSE_cc1101.Init();
  ELECHOUSE_cc1101.setMHZ(433.92);
  mySwitch.enableReceive(4);
  ELECHOUSE_cc1101.SetRx();
}
void loop() {

  if (mySwitch.available()) {

    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();
  }
}

Note: the receiver is unable to read the code I send with my code as well as from the original button. I had to use the RTL-SDR device to intercept the transmission (that's how I figured out the cheap clone remote keeps transmitting the same signal but still works).
The log ->

time      : 2024-04-08 22:44:29
model     : Microchip-HCS200                       id        : 50033D1
Battery   : 0            Button    : 1             Learn mode: 0             Repeat    : 1             encrypted : A4EE72F4
[pulse_slicer_pwm] Microchip HCS200/HCS300 KeeLoq Hopping Encoder based remotes
codes     : {12}fff, {66}2f4e77258bcc00a4c           bits      : 
1111 1111 1111, 0010 1111 0100 1110 0111 0111 0010 0101 1000 1011 1100 1100 0000 0000 1010 0100 11

I'm stuck and I don't know how to proceed from here. I'd appreciate any suggestions!

Why String if you're just going to call c_str?

Biggest problem is the required codes to operate gates and a rolladoor are completely different.
I have yet to find any commercial " knock off" remotes that will work with the gates, only the originals.

What brand of gate controller? I have had "Mighty Mule" for over 15 years. The remote works fine after I cleaned the receiver circuit board twice with IPA and a tooth brush. My controller has provisions for push button control, as well. I have a push button on each side of the gate for people. The deer don't understand the push buttons.

A separate Arduino/receiver at the controller could easily push a button for me and perhaps you as well.

I did that with ESP8266 (ESP-Now).

Specifically these but many others have the same drama......manufacterers do it firstly to avoid any "break ins" and secondly to sell you a $40 remote instead of a $5 one. and not necessarily in that order either.

https://www.ebay.com.au/itm/363598686537

2 reasons: 1) some other code morphed into this and 2) I'm a programmer with 10y exp but none in C/C++, so I didn't even spot this... It's my first Arduino/ESP project. But I'll refactor and clean up the code once I have a full working solution, before I close it in the box and mount in my car :+1:

Not a problem in my case. The gate is poorly configured and accepts the previously used codes. Sloppy, but good for me in this case. And yeah, I asked my housing association about the additional remote and the price was outrageous compared to the cheap one I got.

Unfortunately, I can't mess with the gate controller in any way. It's not just my garage (those doors I figured out) but a gate to the premises with a bunch of garages in its territories. If they catch me trying to disassemble the controller module or if I would break it... I would need to pay the equivalent of 50 overpriced remotes as a result & possibly face legal consequences.

I see. So you are already skating on thin ice, legally.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.