├── README.md └── garage-keys.ino /README.md: -------------------------------------------------------------------------------- 1 | Example of cloning my garage keys with Arduino Digispark and FS1000A transmitter. 2 | The key sequences were recorded first using Universal Radio Hacker tool and relevant information about pulses and pauses within the radio signal copied to Arduino sketch. 3 | 4 | 5 | Components : 6 | - 1 x Digispark device 7 | - 1 x FS1000A module ( frequency 433,92MHz for EU/Asia or 315MHz for US/Canada) 8 | - 1 x RTL-SDR dongle for PC to use with URH (Universal Radio Hacker) tool 9 | - 1 x powerbank 5V to power clonned keyfob 10 | - 1 x PC ( Linux / Windows / Mac) for recording key transmission with URH ( https://github.com/jopohl/urh ) and RTL-SDR USB dongle 11 | 12 | Connections : 13 | Connect Digispark to FS1000A module 14 | - 5V Digispark <-> VCC FS1000A 15 | - P2 (PB2) Digispark <-> DATA FS1000A 16 | - GND Digispark <-> GND FS1000A 17 | - Connect some antenna 15cm to FS1000A antenna pin ! 18 | 19 | You need to install Arduino environment and Digispark packages/libraries : In ARDUINO IDE go to File/Preferences/Additional board manager URL and put this URL : https://raw.githubusercontent.com/ArminJo/DigistumpArduino/master/package_digistump_index.json , then go to Menu Tools/Board and select Digistump AVR Boards / Digispark default 16.5 MHZ 20 | 21 | See videos how to clone your key : https://www.youtube.com/watch?v=jziWQA8Wvp4 22 | 23 | -------------------------------------------------------------------------------- /garage-keys.ino: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | //0 is P0, 1 is P1, 2 is P2, etc. - unlike the analog inputs, for digital outputs the pin number matches. 8 | #define FS1000A_DATA_PIN 2 9 | 10 | void setup() { 11 | pinMode(FS1000A_DATA_PIN, OUTPUT); 12 | } 13 | 14 | 15 | 16 | // sending sequence of pulses that is described by single hexadecimal digit 17 | void sendhexdigit(char c , uint16_t pulse) 18 | { 19 | switch (c) { 20 | 21 | // hex = 0, send 4 low pulses 22 | case '0': 23 | digitalWrite(FS1000A_DATA_PIN, LOW); 24 | delayMicroseconds(pulse * 4); 25 | break; 26 | 27 | // hex = 1, send 3 low pulses and 1 high pulse 28 | case '1': 29 | digitalWrite(FS1000A_DATA_PIN, LOW); 30 | delayMicroseconds(pulse * 3); 31 | digitalWrite(FS1000A_DATA_PIN, HIGH); 32 | delayMicroseconds(pulse * 1); 33 | digitalWrite(FS1000A_DATA_PIN, LOW); 34 | break; 35 | 36 | // hex = 2, send 2 low pulses, 1 high pulse, 1 low pulse 37 | case '2': 38 | digitalWrite(FS1000A_DATA_PIN, LOW); 39 | delayMicroseconds(pulse * 2); 40 | digitalWrite(FS1000A_DATA_PIN, HIGH); 41 | delayMicroseconds(pulse * 1); 42 | digitalWrite(FS1000A_DATA_PIN, LOW); 43 | delayMicroseconds(pulse * 1); 44 | break; 45 | 46 | // hex = 3, send 2 low pulses, 2 high pulses 47 | case '3': 48 | digitalWrite(FS1000A_DATA_PIN, LOW); 49 | delayMicroseconds(pulse * 2); 50 | digitalWrite(FS1000A_DATA_PIN, HIGH); 51 | delayMicroseconds(pulse * 2); 52 | digitalWrite(FS1000A_DATA_PIN, LOW); 53 | break; 54 | 55 | // hex = 4, send 1 low pulses, 1 high pulse, 2 low pulse 56 | case '4': 57 | digitalWrite(FS1000A_DATA_PIN, LOW); 58 | delayMicroseconds(pulse * 1); 59 | digitalWrite(FS1000A_DATA_PIN, HIGH); 60 | delayMicroseconds(pulse * 1); 61 | digitalWrite(FS1000A_DATA_PIN, LOW); 62 | delayMicroseconds(pulse * 2); 63 | break; 64 | 65 | // hex = 5, send 1 low pulses, 1 high pulse, 2 low pulse 66 | case '5': 67 | digitalWrite(FS1000A_DATA_PIN, LOW); 68 | delayMicroseconds(pulse * 1); 69 | digitalWrite(FS1000A_DATA_PIN, HIGH); 70 | delayMicroseconds(pulse * 1); 71 | digitalWrite(FS1000A_DATA_PIN, LOW); 72 | delayMicroseconds(pulse * 1); 73 | digitalWrite(FS1000A_DATA_PIN, HIGH); 74 | delayMicroseconds(pulse * 1); 75 | digitalWrite(FS1000A_DATA_PIN, LOW); 76 | break; 77 | 78 | // hex = 6, send 1 low pulses, 2 high pulse, 1 low pulse 79 | case '6': 80 | digitalWrite(FS1000A_DATA_PIN, LOW); 81 | delayMicroseconds(pulse * 1); 82 | digitalWrite(FS1000A_DATA_PIN, HIGH); 83 | delayMicroseconds(pulse * 2); 84 | digitalWrite(FS1000A_DATA_PIN, LOW); 85 | delayMicroseconds(pulse * 1); 86 | break; 87 | 88 | // hex = 7, send 1 low pulse, 3 high pulse 89 | case '7': 90 | digitalWrite(FS1000A_DATA_PIN, LOW); 91 | delayMicroseconds(pulse * 1); 92 | digitalWrite(FS1000A_DATA_PIN, HIGH); 93 | delayMicroseconds(pulse * 3); 94 | digitalWrite(FS1000A_DATA_PIN, LOW); 95 | break; 96 | 97 | // hex = 8, send 1 high pulse, 3 low pulses 98 | case '8': 99 | digitalWrite(FS1000A_DATA_PIN, HIGH); 100 | delayMicroseconds(pulse * 1); 101 | digitalWrite(FS1000A_DATA_PIN, LOW); 102 | delayMicroseconds(pulse * 3); 103 | break; 104 | 105 | // hex = 9, send 1 high pulse, 2 low pulses, 1 high pulse 106 | case '9': 107 | digitalWrite(FS1000A_DATA_PIN, HIGH); 108 | delayMicroseconds(pulse * 1); 109 | digitalWrite(FS1000A_DATA_PIN, LOW); 110 | delayMicroseconds(pulse * 2); 111 | digitalWrite(FS1000A_DATA_PIN, HIGH); 112 | delayMicroseconds(pulse * 1); 113 | digitalWrite(FS1000A_DATA_PIN, LOW); 114 | break; 115 | 116 | // hex = a, send 1 high pulse, 1 low pulses, 1 high pulse, 1 low pulse 117 | case 'a': 118 | digitalWrite(FS1000A_DATA_PIN, HIGH); 119 | delayMicroseconds(pulse * 1); 120 | digitalWrite(FS1000A_DATA_PIN, LOW); 121 | delayMicroseconds(pulse * 1); 122 | digitalWrite(FS1000A_DATA_PIN, HIGH); 123 | delayMicroseconds(pulse * 1); 124 | digitalWrite(FS1000A_DATA_PIN, LOW); 125 | delayMicroseconds(pulse * 1); 126 | break; 127 | 128 | // hex = b, send 1 high pulse, 1 low pulses, 2 high pulses 129 | case 'b': 130 | digitalWrite(FS1000A_DATA_PIN, HIGH); 131 | delayMicroseconds(pulse * 1); 132 | digitalWrite(FS1000A_DATA_PIN, LOW); 133 | delayMicroseconds(pulse * 1); 134 | digitalWrite(FS1000A_DATA_PIN, HIGH); 135 | delayMicroseconds(pulse * 2); 136 | digitalWrite(FS1000A_DATA_PIN, LOW); 137 | break; 138 | 139 | // hex = c, send 2 high pulse, 2 low pulses 140 | case 'c': 141 | digitalWrite(FS1000A_DATA_PIN, HIGH); 142 | delayMicroseconds(pulse * 2); 143 | digitalWrite(FS1000A_DATA_PIN, LOW); 144 | delayMicroseconds(pulse * 2); 145 | break; 146 | 147 | // hex = d, send 2 high pulse, 1 low pulses, 1 high pulses 148 | case 'd': 149 | digitalWrite(FS1000A_DATA_PIN, HIGH); 150 | delayMicroseconds(pulse * 2); 151 | digitalWrite(FS1000A_DATA_PIN, LOW); 152 | delayMicroseconds(pulse * 1); 153 | digitalWrite(FS1000A_DATA_PIN, HIGH); 154 | delayMicroseconds(pulse * 1); 155 | digitalWrite(FS1000A_DATA_PIN, LOW); 156 | break; 157 | 158 | // hex = e, send 3 high pulses, 1 low pulses 159 | case 'e': 160 | digitalWrite(FS1000A_DATA_PIN, HIGH); 161 | delayMicroseconds(pulse * 3); 162 | digitalWrite(FS1000A_DATA_PIN, LOW); 163 | delayMicroseconds(pulse * 1); 164 | break; 165 | 166 | // hex = f, send 4 high pulses 167 | case 'f': 168 | digitalWrite(FS1000A_DATA_PIN, HIGH); 169 | delayMicroseconds(pulse * 4); 170 | digitalWrite(FS1000A_DATA_PIN, LOW); 171 | break; 172 | 173 | default: 174 | digitalWrite(FS1000A_DATA_PIN, LOW); 175 | break; 176 | 177 | }; // end of switch selection 178 | 179 | } // endo of sendhexdigit function 180 | 181 | 182 | 183 | 184 | 185 | void loop() { 186 | 187 | // now the decoded pulse definition taken from Universal Radio Hacker tool and your keys 188 | char sequence1[] = "XXXXXXX"; 189 | char sequence2[] = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; 190 | uint16_t pulse = 371; // pulse width is 372 microseconds in my case 191 | uint8_t i; 192 | 193 | // first sequence 194 | for (i = 0; i