Head office, Rana Pratap Bagh, Delhi011 2721 1512+91 97116 99511

Science project idea

RFID door latch that pulls a 12 V solenoid for tagged cards only

An RC522 reader reads the unique ID of a 13.56 MHz card or key fob. If the ID is in a list stored in the sketch, the Arduino fires a relay for three seconds that pulls a 12 V solenoid bolt open, and an LCD greets the user by name.

What it shows

An RC522 reader reads the unique ID of a 13.56 MHz card or key fob. If the ID is in a list stored in the sketch, the Arduino fires a relay for three seconds that pulls a 12 V solenoid bolt open, and an LCD greets the user by name.

The science

The reader coil makes a weak 13.56 MHz field that powers the chip inside the card. The card replies with its 4-byte UID by loading the field in a pattern. The RC522 talks to the Arduino over SPI (pins 10 to 13). The sketch compares the UID bytes with the stored list. A solenoid is an electromagnet with a spring-loaded iron plunger; current pulls the plunger in and releases the bolt. When the relay opens, the coil's collapsing field produces a reverse voltage spike that the diode safely shorts.

Materials

Cost: under Rs 1,500. Many items come from home or from waste; spare parts such as LEDs, motors and wire are in the store.

  • An Arduino Uno clone and USB cable
  • An RC522 RFID reader with two cards or fobs
  • A 12 V solenoid lock or a 12 V mini solenoid
  • A 5 V relay module and a 1N4007 diode
  • A 12 V adapter
  • A 16x2 I2C LCD, a green and a red LED
  • A cardboard door with a frame

Safety

For this project: The solenoid takes 12 V DC only; the diode across its coil protects the relay. An adult must check the adapter wiring. The RC522 runs on 3.3 V; connecting it to 5 V damages it.

Never use mains electricity: power models with cells, batteries or a low-voltage adapter. Sharp and hot tools, flames and lab chemicals need an adult or your teacher beside you. Keep magnets, button cells and small parts away from young children, and wash your hands after making.

All the safety rules

Step by step

9 steps. Do them in order, and test each part before you go on to the next. Write what you notice in a notebook as you go.

  1. Install the MFRC522 library and wire the reader: 3.3V, GND, SDA to 10, SCK to 13, MOSI to 11, MISO to 12, RST to 9.

  2. Run the DumpInfo example and hold each card on the reader; copy the UID printed for each.

  3. Wire the relay IN to pin 7. Wire the solenoid through COM and NO to the 12 V adapter and solder the diode across the solenoid, stripe towards positive.

  4. Wire the LCD to A4 and A5, the green LED to pin 5 and the red LED to pin 6, each with a 220 Ω resistor.

  5. Write a sketch with an array of allowed UIDs and a name for each; on a read, compare byte by byte.

  6. If matched, show Welcome and the name, light green, and pulse the relay for three seconds; otherwise show Access denied and light red for two seconds.

  7. Mount the solenoid on the door frame so its plunger drops into a hole in the door edge.

  8. Test with an allowed card and a stranger card and count how many times each is correctly handled.

  9. Add a log line to the serial monitor with the time since start for each attempt.

What you should see

Allowed cards open the latch for three seconds and are greeted by name; unknown cards are refused with a red light. The serial log lists every attempt.

Viva questions

A teacher or a judge will ask how it works. Try to answer each question before you open it, then compare.

1How does the card work without a battery?

The reader field induces a current in the card coil, enough to run its chip for the reply.

2Why the diode across the solenoid?

To absorb the back EMF when current stops, protecting the relay contacts and nearby electronics.

3Could someone copy a card?

Basic UIDs can be cloned, so real systems also use encrypted data sectors or a PIN.

4What is SPI?

A fast four-wire serial bus with a clock, data in, data out and a select line for each device.

Free ebook: Viva Questions for Science Projects

Take it further

Store the allowed UIDs in EEPROM and add a master card that teaches new cards without reprogramming.

Change one thing, measure what happens, and add a table or chart of your readings: that is what turns a model into your own investigation.

Free ebooks for this project

Find out more about electronics and robotics

Free, well-known places to explore the subject further. Ask a grown-up before you sign up for anything or type your name anywhere.

WhatsApp us