Garage Remote Cloner and Emulator

by GlowDuino in Circuits > Remote Control

1364 Views, 2 Favorites, 0 Comments

Garage Remote Cloner and Emulator

IMG_3511.JPG

Changing the code on your garage opener? Cloning a remote switch? Or maybe hacking a remote receiver? You can do that all with this simple circuit. In this short project, you can build a simple 433MHz transmitter-receiver pair that is able to copy a garage remote, modify the code it transmits, and emulate it wherever you wish it to.

Supplies

IMG_2707.JPG
IMG_3520.JPG

You only need a few things:

-A GlowDuino Uno board for the brains: 

https://www.glowduino.com/shop/p/uno

Or at:

https://www.tindie.com/products/glowduino/glowduino-uno-a-better-arduino/

-A pair of generic 433MHz radios:

https://amz.run/745q

Edit and Upload the Code

Screenshot 2023-09-05 162912.jpg

Because the radio modules are powered by the GPOI pins of the microcontroller, you first need to upload the program to prevent damage to them by reverse polarity.

Download the included sketch and open it in the Arduino IDE program. Select your board and port in the tools settings and upload the program.

You can change the pinout in the program if you need to, but there is no need for that if you follow the connections in the picture.

With the program uploaded, you are supposed to see only two lit-up LEDs on your GlowDuino boards. These are the two pins your radio modules will use for power.

Downloads

Connecting the Radio Modules

IMG_3511.JPG

Now that the program is uploaded, you can connect the radio modules. Use the "define" lines in the program to place your modules accordingly. The VCC pins of the modules should be plugged into the pins where the LED indicator is lit. As the modules consume so little power, it is indeed safe to power them directly from the IO pins without exceeding the maximum current rating of the chip of 40mA.

Reading Code From Your Remote

Screenshot 2023-09-05 175724.jpg
Screenshot 2023-09-05 170934.jpg

If you wish to read the code from your existing remote, type "receive" into the serial monitor and hit enter. The program will reply with the "Receiving" line, after which every time you press the button on your remote, the board will display the sync pulse length and the read code from your remote. You can save this code for other purposes or copy it to edit.

Editing and Changing the Code to Transmit

Screenshot 2023-09-05 172028.jpg

If you want to edit and change your existing code, you can just copy or write one in the serial monitor. The program will set it as active and will also save it into EEPROM, so it will stay in memory even after a reset or power off. If you only copy the code from your remote, it will be able to emulate your remote once powered on again.

Transmitting Custom Code

Screenshot 2023-09-05 173344.jpg

Once you edit or copy the desired code, just type "transmit" in the serial monitor and the program will start to transmit the saved code continuously. Set the board to transmit and the next time you power on the microcontroller, it will transmit by default with the code that was saved in EEPROM.

How It Works?

The main two functions of the code are to read and write the desired codes. For that, the circuit uses a pair of generic 433 radio modules. These modules are capable of transmitting binary signals on the same frequency as what the commercial remotes use. This frequency is not only used by garage remotes but also by certain types of smart plugs as well. So if you have a device that uses a hand-held remote then it is most likely that these radio modules can transmit and receive their signals. But for that to happen, we need a bit of program code to work.


First, we need power for the modules. Unlike in other cases, because of the low current consumption of these modules, we can power them directly from the IO pins. This is possible because the overall consumption of the modules does not exceed the microcontroller's maximum current of 40mA.


Setup

With that being said, the setup portion of the code will look something like this:

Using the "pinMode(pin, OUTPUT);" function one by one, we set all the VCC and GND pins to outputs, after which we can use the "digitalWrite(pin, HIGH);" and "digitalWrite(pin, LOW);" functions to power up the radio modules.

While we are doing the setup procedure, we also want to set the receiver's DATA pin to be an input of our microcontroller and the transmitter's DATA pin to be an output. For this, we can again use the pinMode() function.

With all these done, we now just have to plug the modules directly into the headers of the microcontroller and they are all ready to go.


The HT12 encoding

Now that we have power to our modules, let's see what radio code are we even trying to use!

Most of the simpler remotes use the HT12 encoding. In this encoding, the transmitted code is stationary and has a fixed timing. In every cycle, there are twelve bits to be transmitted where each data bit is divided into three parts:

High, Low, and Data. The first two sections are the same on each bit and only the last section changes based on the actual data bits. Each section is 310 microseconds long, making one bit 930 microseconds. After every 12 bits, there is a single stop pulse of 310 microseconds and a silence period of 12 milliseconds. The pattern repeats until transmission is turned off. With this encoding for example a single '1' bit would be a series of High-Low-High and a '0' bit would be a series of High-Low-Low.


Receiving

To get the data bits from your existing remote, the program needs to lock onto the signal first. The way it can achieve that is by listening to the silence before each cycle of bits. While in receiving mode, the program constantly checks the state of the receiver radio. While there is no remote signal present, the output of the radio module is just noise of ones and zeros. Once there is a signal coming from the remote, there will be a clear pattern detectable. Once there is a high pulse coming, the program checks the length of the previous low period and if it is sufficiently long, the program will begin its reading function. Firstly it measures the first third of the first bit to measure the length of the start pulse. As per the spec, it has to be 310us long, so if it deviates from that value too much (in this case 50us) then the program will declare it as a bad signal and halt reading. If everything is in spec, it will cycle twelve times reading the third third of each bit signal. Every time a bit has been read, the value is stored in memory to be displayed on the serial monitor.


Transmitting

In the case of transmitting signals, the steps are pretty much the same as with receiving but the other way around. Following the spec, the program will generate a 310us high and then a 310us low pulse before every data bit. This will form the High-Low-Data pulse series. after twelve cycles of data bits, there is a single 310us-long high pulse before the 12ms-long silence period. The transmission continues until the program has not received another command via the serial port.


Storing values

To enable the possibility to clone a remote, the microcontroller has to store the code in nonvolatile memory. The GlowDuino board used in this project has built-in EEPROM for such things and it will be able to store the set code for later use. To do this the EEPROM.h library has to be included, which will enable the use of the eeprom.read() and eeprom.write() functions. With this, every time there is a new code to be transmitted, the program will also save it into EEPROM so the next time the circuit is powered on, it will be able to load that at the setup phase.

Similarly to the code, it is also necessary to store the state of the cloner in EEPROM. This will enable the user to have the cloner set to a specific code and mode and still be able to use the circuit without a serial connection.


And with all these done, the result is the above-described HT12 cloner circuit.