Project tutorial
An Alternate RFID Key for Bike Security

An Alternate RFID Key for Bike Security © CC BY-NC-SA

For bike security, There is only ignition lock switch. And it can be easily hacked by the thief. Here I come with a DIY solution for that.

  • 7 respects

Components and supplies

Necessary tools and machines

Apps and online services

About this project

When it’s come to bike security, generally there is only ignition lock switch. And it can be easily hacked by the thief. In this tutorial, I am going to show you how to make an alternate RFID key for bike security at home. Let’s make it…..

To make this project we need the following components.

1. Arduino Nano x1

2. RFID module x1

3. 12V relay x1

4. BC547 transistor x1

5. LM7805 x1

6. 1k resistor x1

7. Diode 1N4007 x1

8. Capacitor 470uF/16v x1

Make a circuit board as per the circuit diagram. You can use the doted PCB or can order a prototype PCB for it. I designed a circuit board for it. and order my PCBs from you will get the link for PCB Gerber file here.

Place all components in their respective places and solder them carefully. After soldering, the assembled board looks nice.

Insert Arduino nano in its place. connect RFID module to the board. and it ready to program.

Programming is not that straight forward in this project. Here you need two programs to work with. First, we have to register an RFID tag as a valid key, For that, we need to find out the UID of that card, which we are going to use as the key.

To find out UID, open the code by name, "Read RFID Card", select COM port, and board type and upload it to the Arduino nano, now open serial monitor. As you open it, you will see the status of the module, whether it is connected or not. Now simply put your card on the reader module, you will see some information print on the serial monitor. Just copy the UID from this information. After copying UID, close the serial monitor.

Now open another code by name "RFID Key For Bike" and pest here that UID, copied from the serial monitor. Like this way.

And now upload this program to the Arduino nano. Download source code & circuit diagram from here.

I used some hot glue and insulating foam to stick the RFID module on the Arduino nano. Soldered red wire for positive 12-volt power supply and black wire for negative supply.

Connected a pair of wires in the output terminals of the relay. These two wires are going to connect in series with the ignition switch of the bike.

I used an old plastic box to secure this whole circuit assembly. Put all things in a proper way so that it can be easily fit inside of the encloser box and closed it.

This key unit can work with any vehicle, I tried this with my Hero Honda CD Delux. By Unscrewing two screws with the help of a screwdriver and the third one by the spanner I Open the headlight cover of my bike, and find out a two-wire harness, which comes out from the bottom of the ignition key.

I removed it & cut one wire from this, removed insulation on both ends of the wires, and connect them with the yellow wires, coming out from the modified key unit. And secure this joint with the heat-shrinkable tube. In this way, I connected key unit in series with ignition lock switch.

for the demonstration, I fixed this box on fuel meter by using some foam tape. You can put it in a more secure place. Layed supply wire to the battery box of the bike, in such a way, so that they will not create any hurdle in regular use of bike. And connected the red wire to the positive terminal of battery and black to the negative terminal of it.

Put back covers, on their places……… and all set.

Hope you find this useful. if yes, like it, share it, comment your doubt. For more such projects, follow me! Support my channel on YouTube.

Thank you!


Alternet rfid keyArduino
This is the Main code. but you need one more code, follow the code from the download link
program by Shubham Shinganapure on 29-08-2019

for RFID Key For bike 

#include <SPI.h>
#include <MFRC522.h>
#define RST_PIN         9          // Configurable, see typical pin layout above
#define SS_1_PIN        10         // Configurable, take a unused pin, only HIGH/LOW required, must be diffrent to SS 2
#define SS_2_PIN        8          // Configurable, take a unused pin, only HIGH/LOW required, must be diffrent to SS 1

#define NR_OF_READERS   2

byte ssPins[] = {SS_1_PIN, SS_2_PIN};

MFRC522 mfrc522[NR_OF_READERS];   // Create MFRC522 instance.
int ledRed = A1;
int rly = 6;

const int ledBlue =  A5;
int ledState = LOW;   

unsigned long previousMillis = 0;  
const long interval = 2000; 
const long interval2 = 70; 
int flg=0;

void setup() {
  SPI.begin();        // Init SPI bus
  for (uint8_t reader = 0; reader < NR_OF_READERS; reader++) {
    mfrc522[reader].PCD_Init(ssPins[reader], RST_PIN); // Init each MFRC522 card
    //Serial.print(F("Reader "));
   // Serial.print(reader);
    //Serial.print(F(": "));

 * Main loop.
 int i =0 ;
 char arry2[5] = {0x06,0xF8,0x51,0x1B,0}; // put your cards ID here. for example my card ID is 06,F8,51,1B so write it by this way{0x06,0xF8,0x51,0x1B,0} 
  char arry[5] = {0};

void loop() {
              if(strncmp(arry2,arry,4) == 0)
                 // digitalWrite(ledBlue,HIGH);
                  //arry[5] = {0};
                 // memset(arry,0,5);
            if( flg==1 &&(strncmp(arry2,arry,4) != 0)) 

void readTag()
  for (uint8_t reader = 0; reader < NR_OF_READERS; reader++) {
    // Look for new cards

    if (mfrc522[reader].PICC_IsNewCardPresent() && mfrc522[reader].PICC_ReadCardSerial()) {
     // Serial.print(F("Reader "));
     // Serial.print(reader);
      // Show some details of the PICC (that is: the tag/card)
      //Serial.print(F(": Card UID:"));
      dump_byte_array(mfrc522[reader].uid.uidByte, mfrc522[reader].uid.size);
      for(i = 0;i < 4;i++)
       arry[i] =  mfrc522[reader].uid.uidByte[i];

      for(i = 0;i < 4;i++)

              // Serial.println();

      //Serial.print(F("PICC type: "));
      MFRC522::PICC_Type piccType = mfrc522[reader].PICC_GetType(mfrc522[reader].uid.sak);

      // Halt PICC
      // Stop encryption on PCD
    } //if (mfrc522[reader].PICC_IsNewC
  } //for(uint8_t reader

 * Helper routine to dump a byte array as hex values to Serial.
void dump_byte_array(byte *buffer, byte bufferSize) {
  for (byte i = 0; i < bufferSize; i++) {
    //Serial.print(buffer[i] < 0x10 ? " 0" : " ");
    //Serial.print(buffer[i], HEX);

void Blink() {
  unsigned long currentMillis = millis();

  if (currentMillis - previousMillis >= interval) {
    previousMillis = currentMillis;
    if (ledState == LOW) {
      ledState = HIGH;
    } else {
      ledState = LOW;
    digitalWrite(ledBlue, ledState);
void Blink2() {
  unsigned long currentMillis = millis();

  if (currentMillis - previousMillis >= interval2) {
    previousMillis = currentMillis;
    if (ledState == LOW) {
      ledState = HIGH;
    } else {
      ledState = LOW;
    digitalWrite(ledBlue, ledState);


Alternate RFID Key
Uploads2ftmp2f731f4996 f83a 4f67 bafc 5c8f2f9a8cef2frfidkeyforbikefnl mzmrhasdrb


Similar projects you might like

Security Access Using RFID Reader

by Aritro Mukherjee

  • 364 respects

Security System And Access Control With Arduino And RFID

Project tutorial by Sarath P

  • 1 comment
  • 22 respects

Arduino Bike Blink Lights

Project showcase by Sam

  • 15 respects

Leduindo - Smart Led Bike Lightning

Project tutorial by Marius Dima

  • 1 comment
  • 20 respects

Arduino Bluetooth RC Car

Project tutorial by ardumotive

  • 13 respects

Electric Bike

Project tutorial by ifeghali

  • 13 respects
Add projectSign up / Login