I’ve recently moved to a new house in the countryside, and boy I never knew how dark it could get! Or how many weird, scary sounds you can hear without the city noise around.
To distract myself from remembering childhood ghost stories and feel a little safer to boot, I decided to try and equip my house with some basic automations such as RFID locks and lights with motion detectors.
Additionally the house is shared with my sister who has a separate entrance, but both pathways are relatively dark and spooky. I decided to make an RFID lock that lights up the pathway to either house, depending on who is accessing our security gate. To complete the effect, I decided to try and create my dream of automatic door locks that unlock for me without a password or even touching the handle - Not only does it look super cool, it’s great for when you have your hands full!
To make the smart RFID lock, here’s what you’ll need on hand:
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Trust Me, I’m a Maker!
The most difficult part of this project is also the first: putting the Arduino board together with the RFID module and the Relay Shield.
The relay board only uses 4 pins on the Arduino board, but it doesn’t allow for an expansion using the other pins on the Arduino. To work around the design, you have to solder 4 cables between the Arduino and the relay board. Check out the image below for reference. Solder 3 cables on the pins 3,4, and 5V, and connect them to the RFID module. On top of the Arduino board, mount the relay board and make a connection from the relay shield’s GROUND to the RFID module’s GROUND.
That was the tricky part! - Using the 3rd image attached as a reference, connect the RFID module to the Arduino board. You are now ready to test your circuit!
Step 2: Look Ma, No Hands
Having the circuit completed, it’s time to code the Arduino board to read the RFID tags and authorize guests.
I wanted to use something supported by my favorite Arduino IDE codebender (referral link), which saves me from worrying about configuration. I chose a Wiegand RFID Reader, which is supported by the Wiegand Library. Additionally, the library’s example is the sketch I am going to use for scanning and storing the values of my RFID cards.
Below I have embedded my sketch from codebender so that you can try it yourself. Just click the “Run on Arduino” option to see the code in action (you will need to install the codebender plugin first).
Here’s a more thorough explanation to walk you through:
This is a declaration of a WIEGAND class named wg.
Now I initialize the wiegand class
This function returns a bool TRUE value when a RFID card is scanned.
This function returns the number of the card in a decimal number.
Run the sketch on your Arduino, open the Serial Monitor and scan your RFID cards. Store the “DEMICAL” numbers in a temporary text file. In my case I have only two access cards so I am going to use 2 variables for storing the card’s numbers in the sketch. The idea is to compare the “DEMICAL” numbers from the scanned card with the values that are already stored.
Here’s an example where the scanned card is compared to 2 cards (claire’s and david’s) and the name of the owner is printed in the serial monitor.
Step 3: Open Sesame!
Now we’ve managed to create a simple validation mechanism for the RFID that’ll keep anything creepy out! Now it’s time we use it to open a door so we’re not stuck outside (an easy way to make sure my sister puts the kibosh on any more projects!)
So here’s how: The relay shield is equipped with 4 relays that are controlled by the Arduino pins numbered 4,5,6 and 7. The first relay is controlled by the pin numbered 4, the second relay by the pin number 5 and so forth. Connect the circuit of the Electric Strike lock and the 12V power on the 3rd relay on the shield. The relay has two sockets, the always ON (NC) and the always OFF (NO) socket. It depends on your Electric Strike lock on how are you going to connect it on the relay. Mine is always locked unless it is powered by 12V DC. I am connecting the lock’s circuit on the COM - NO of the 3rd relay. Use the attached schematic as a reference for connecting your electric strike lock.
Initializing the 3rd relay.
“Closing” the circuit on the 3rd relay - ON
“Opening” the circuit on the 3rd relay - OFF
Before we see it in action, we power up the Relay shield with a 9V DC power line. I have found an old mobile phone power charger which has 9V DC Output and I mounted it on the shield. You can use the attached image as a reference on how I did it.
My example works and now is the time to replace the old non electric strike lock.
Step 4: Lights Please!
I changed out the Strike lock (had to hack the old one) and mounted the RFID antenna just outside the door (using a strong duck-tape) - making my fumble-proof entryway almost complete.
The last step is to connect those lights along our pathways allowing for easy visibility right up to our point of entry for intended guests only. The goal is to have the lighting system recognize our different card signatures, so my pathway will light up only when my card is used and the same for my sister - Great for saving energy and twisted ankles!
Each pathway is equipped with 3 simple 220V lamps. Their switches are located outside our respective houses, next to the panel where I have placed the Arduino board. We’re going to “hack” the switches and connect them on the Relay Shield’s sockets 1 and 2. You can use the attached image as a reference. With some additions from the previous sketch I am now able to turn on the lights of each pathway and unlocking my door simply by using my unique card!
I hope you’ve enjoyed this tutorial for creating a really cool entryway effect that does double duty of make you feel a little safer while showing off your impressive “maker” skills to anyone that comes by!
This is still a work on progress, and I have lots of ideas for improvement, so expect to see more Instructables. I’m looking forward to adding improvements such as:
- Adjusting the lights so they only turn on with card entry at night.
- Adding a keypad to the RFID lock that allows for indoor lights to be controlled upon entry.
I look forward to your comments and suggestions, and hope you enjoy creating an entryway that would make Bond proud!