TURN ON LIGHTS WITH RFID CARD

12,243

45

8

Introduction: TURN ON LIGHTS WITH RFID CARD

Hi guys! Today we are going make Rfid Card controlled light switch.

When we show first card to reader lights will turn on. When we show second card lights will turn off.

Also you will learn what is the EEPROM.

Let's start..

Watch the video. If you have a problem, you can add a comment..:)
If you like my project please subscribe my YouTube Channel SUBSCRIBE NOW!

Please follow me on Instructables for more useful projects!.:)

Step 1: What Will We Use?

  • Arduino
  • RFID Module
  • Relay Module
  • Breadboard

Step 2: Connections;

RC522 to Arduino;

3.3v to 3.3v

RST to D9

GND TO GND

IRQ TO (NONE)

MISO TO D12

MOSI TO D11

SCK TO D13

SDA TO D10

Relay To Arduino;

Gnd to Gnd

Vcc to 5v

Signal to D7

Step 3: EEPROM Using;

You will see 2 different code in data. What should you do?

  1. Firstly you should upload the ''rfid_setup'' code,
  2. Open the serial monitor
  3. You have to show 2 different idcards in 2 different times
  4. If you done this work, you can upload the second code to your Arduino
  5. Finally you can use your device.

Step 4: Code Download Link:

You can download the arduino code from this link;

>>> Download Now! <<<

If you didn't read the last step please read!

Step 5: Test;

Please watch the video.

If you like my project please subscribe my YouTube ChannelSUBSCRIBE NOW!

Please follow me on Instructables for more useful projects!.:)

Invention Challenge 2017

Participated in the
Invention Challenge 2017

Power Supply Contest

Participated in the
Power Supply Contest

Be the First to Share

    Recommendations

    • Made with Math Contest

      Made with Math Contest
    • Laser Challenge

      Laser Challenge
    • Reclaimed Materials Contest

      Reclaimed Materials Contest

    8 Comments

    0
    AvishK3
    AvishK3

    3 years ago

    i tried everything but it is not working with my relay i have an

    5v Relay Module for Arduino ARM PIC AVR MCU 5V Indicator Light LED 1 Channel Relay Module please help
    0
    borsikmark
    borsikmark

    Reply 11 months ago

    the relay is not in the code

    0
    AlexR393
    AlexR393

    Question 3 years ago on Step 2

    Hello, I am Trying to use this code for my dissertation. I get the first code to notice my card and fob and I receive 2 ID numbers for these. But when it tells me to upload the working code it say's exit status 1

    'kart1' was not declared in this scope

    and shows an error

    Please could you help

    Screen Shot 2018-03-02 at 21.26.34.png
    0
    borsikmark
    borsikmark

    Answer 11 months ago

    here is the working code:


    /****************************************************************
    * THIS PROJECT BELONG TO ENSAR LEVENT.
    * YOU CAN GET OTHER PROJECTS FROM INSTRUCTABLES
    * https://www.instructables.com/member/ensarlevent/...
    Tested with SparkFun Arduino Nano
    ****************************************************************/
    #include
    #include
    #include
    const int buttonPin = 7;
    int buttonState = 0;
    #define RST_PIN 9
    #define SS_PIN 10
    MFRC522 mfrc522(SS_PIN, RST_PIN);
    String lastRfid = "";
    String card1 = "";
    String card2 = "";
    MFRC522::MIFARE_Key key;
    void setup()
    {
    pinMode(buttonPin, INPUT);
    buttonState = digitalRead(buttonPin);
    Serial.begin(9600);
    SPI.begin();
    mfrc522.PCD_Init();
    Serial.println("RFID Card Reader");
    Serial.println("--------------------------");
    Serial.println();
    readEEPROM();
    }
    void loop()
    {
    if ( ! mfrc522.PICC_IsNewCardPresent())
    {
    return;
    }
    if ( ! mfrc522.PICC_ReadCardSerial())
    {
    return;
    }
    String rfid = "";
    for (byte i = 0; i < mfrc522.uid.size; i++)
    {
    rfid += mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ";
    rfid += String(mfrc522.uid.uidByte[i], HEX);
    }
    rfid.trim();
    rfid.toUpperCase();
    if (rfid == lastRfid)
    return;
    lastRfid = rfid;
    Serial.print("Card 1: ");
    Serial.println(card1);
    Serial.print("Card 2: ");
    Serial.println(card2);
    Serial.print("Now: ");
    Serial.println(rfid);
    Serial.println();
    if (rfid == card1)
    {
    Serial.println("Turned On.");
    delay (2000);
    }
    if (rfid == card2)
    {
    Serial.println("Turned Off");
    delay (2000);
    }
    Serial.println();
    delay(200);
    }
    void readEEPROM()
    {
    for (int i = 0 ; i < 4 ; i++)
    {
    card1 += EEPROM.read(i) < 0x10 ? " 0" : " ";
    card1 += String(EEPROM.read(i), HEX);
    }
    for (int i = 4 ; i < 8 ; i++)
    {
    card2 += EEPROM.read(i) < 0x10 ? " 0" : " ";
    card2 += String(EEPROM.read(i), HEX);
    }
    card1.trim();
    card1.toUpperCase();
    card2.trim();
    card2.toUpperCase();
    }

    0
    Pagework
    Pagework

    Answer 3 years ago

    Where you find It has (kart1) and (kart2) just change the code .

    Change ...

    Serial.println(kart1);

    Serial.println(kart2);

    To ...

    Serial.println(card1);

    Serial.println(card2);

    0
    Jupipupi123
    Jupipupi123

    Question 2 years ago on Step 5

    How did you connected that led to the relay ?

    0
    Jupipupi123
    Jupipupi123

    Answer 2 years ago

    Please my relay is not turning on when i put the card on the receiver

    0
    AvishK3
    AvishK3

    Question 3 years ago

    it is not working with my relay please help