Escape Room Object Placement Puzzle using Arduino/RFID
Table of Contents
Introduction
In this tutorial, you will learn how to create an engaging escape room puzzle using RFID sensors and an Arduino. This project involves placing four objects in the correct position to deactivate a magnetic lock. By the end of this guide, you will understand the wiring, coding, and mechanics behind the puzzle, allowing you to customize and implement it in your own escape room setup.
Step 1: Gather Required Hardware
Before starting the project, ensure you have the following components:
- Arduino UNO
- 4x RFID RC-522 Modules with Key Rings
- 12V Magnetic Lock (280Kg)
- Breadboard and jumper wires
- Power supply (12V for the mag lock)
You can find these components at various online retailers. Make sure to verify compatibility and quality.
Step 2: Set Up the Wiring
Follow these steps to wire your components correctly:
-
Connect RFID Sensors:
- Power the RFID sensors with 3.3V from the Arduino.
- Connect the ground line to the Arduino ground.
- Use the SPI interface for communication:
- Connect the Master Out Slave In (MOSI) to pin 11.
- Connect the Master In Slave Out (MISO) to pin 12.
- Connect the clock line to pin 13.
- Each sensor will require a unique Slave Select (SS) pin, which you will define later in your code.
-
Connect the Magnetic Lock:
- Use a 5V relay connected to a digital pin on the Arduino to control the magnetic lock.
- Ensure you connect the relay to the 12V power supply for the mag lock.
-
Optional Reset Line:
- If you wish to reset sensors individually, connect an additional pin for each sensor or use a common reset line as shown in the video.
Step 3: Install Required Software
To program the Arduino, you need to install the following libraries:
- Arduino RFID library: This is essential for communication with the RFID sensors. You can download it from GitHub.
Step 4: Write the Arduino Code
Here's a basic structure to get you started with your Arduino code:
#include <SPI.h>
#include <MFRC522.h>
#define RST_PIN 8 // Reset pin for RFID
#define SS_PIN_1 9 // SS pin for Sensor 1
#define SS_PIN_2 10 // SS pin for Sensor 2
#define SS_PIN_3 11 // SS pin for Sensor 3
#define SS_PIN_4 12 // SS pin for Sensor 4
#define LOCK_PIN 7 // Pin for mag lock relay
MFRC522 rfid1(SS_PIN_1, RST_PIN);
MFRC522 rfid2(SS_PIN_2, RST_PIN);
MFRC522 rfid3(SS_PIN_3, RST_PIN);
MFRC522 rfid4(SS_PIN_4, RST_PIN);
void setup() {
Serial.begin(9600);
pinMode(LOCK_PIN, OUTPUT);
digitalWrite(LOCK_PIN, HIGH); // Lock the mag lock initially
SPI.begin();
rfid1.PCD_Init();
rfid2.PCD_Init();
rfid3.PCD_Init();
rfid4.PCD_Init();
}
void loop() {
// Your code to read RFID tags and control the lock
}
- Customize the code by defining the correct unique IDs for each tag that corresponds to each sensor.
- Implement logic to check if the correct tags are placed and release the lock when the puzzle is solved.
Step 5: Test the Puzzle
- Power on the Arduino and ensure all components are connected correctly.
- Simulate the puzzle by placing the RFID tags in front of the respective sensors.
- Monitor the serial output for debugging. Make adjustments as necessary to ensure the correct IDs are recognized.
- Once the correct sequence is achieved, the magnetic lock should release.
Conclusion
You have now created an RFID-based escape room puzzle using Arduino. This project can be expanded or modified to fit various themes or levels of difficulty. Experiment with different objects, RFID tags, or even additional sensors to enhance the complexity of your puzzle. For further development, consider exploring additional features like LEDs or sound effects that activate when the puzzle is solved. Happy building!