The RFID Lock Box combines Arduino, RFID and a Solenoid to make your very own personal safe! The Lock Box will only open to Key Cards that you've programmed into the system, locking everyone else out!
This guide will show you how setup the electronics for and assemble your RFIDuino Lock Box. You will start of by setting up and programming the Geekduino microcontroller. You will then be able to test your electronics, and then move onto assembling your Lock Box Kit.
Step 1: Project Parts ListAll the parts necessary are available in the RobotGeek RFID Lock Box Kit, or you can assemble it with the following parts:
- A box, such as the Treasure Box, or any box with a hinged lid
- 1 x Geekduino
- 1 x RFIDuino Shield
- 1 x Relay
- 1 x Solenoid (a small solenoid will work for most cases)
- 1 x Power Squid
- 1 x 6V2A Power Supply (or higher if you have a larger solenoid. Check your solenoid specs before selecting a power supply.)
- 2 x Wire Nuts / Solder
- Screws, nuts, bolts, hardware (as needed)
If you are new to RFID, we recommend sticking with the RFIDuino Shield as your RFID reader so that the sample code provided runs without a hitch, and you can refer to our documentation if you run into any issues.
Step 2: Familiarize yourself with the RFIDuinoRFID stands for Radio Frequency IDentification. The RFID system consists of two components, an RFID reader and an RFID tag. The reader interacts wirelessly with a tag to retrieve a unique identification number. The system can be used for many things from opening doors to tracking inventory.
The RFIDuino Shield for Arduino adds RFID capabilities to your Geekduino/Arduino. The shield fits on top of your arduino, making solid connections to the RFIDuino's circuitry. The built in buzzer and LEDs allow you to get stared right away by making visual and audio cues depending on the data that is on a given tag. The shield also allows you to add components to expand your system. You can use this to make your own door locks, inventory systems and more!
Step 3: Install the RFIDuino ShieldTo Install the RFIDuino Shield, line the pins up with the bottom of the shield and the top of the Geekduino/Arduino. The male pins on the Shield should slide into the female pins on the Geekduino/Arduino. Once the Shield is installed, you can use the included 2-pin cable to connect the Shield to the Antenna.
You can program the Geekduino/Arduino with the shield plugged in. However, you cannot program the shield if you have an XBee module plugged in. You will have to remove the module or the shield to program the Arduino.
Step 4: Get your RFID Tag IDIn order to use our RFID tag, we're going to need to know its ID to program into the board. Connect your RFIDuino into the computer as shown above.
You're going to need the RobotGeek Tools and Libraries ZIP file for a sketch that will allow you to read your card data to the serial monitor. The RobotGeek Tools and Libraries Download offers a variety of sketches and libraries for working with RobotGeek Robot Kits. The libraries folder contains libraries that will add functionality to your Arduino, while the RobotGeek Sketches folder contains behavioral code for robots, as well as tools for testing. Install it by adding these two folders to your Arduino user folder.
Open the RFIDuino_helloworld sketch. This can be found under:
File>Examples>RFIDuino>RFIDuino_helloworld
You will need to make sure the code is adjusted for your RFIduino hardware. v1.2 shields (2 pin antenna, 'REV 1.2' printed on the board) will need the following code
RFIDuino myRFIDuino(1.2); //initialize an RFIDuino object for hardware version 1.2
v1.1 shields (4-pin antenna, no version number printed on the board) will need the following code
RFIDuino myRFIDuino(1.1); //initialize an RFIDuino object for hardware version 1.1
Both lines of code are available in the RFIDuino_helloworld sketch, simply uncomment the one you don't need. If you are still unsure about what hardware you are using, see this page
Connect a micro USB cable from your computer to your Geekduino
Load RFIDuino_helloworld onto your board using the upload button in the Arduino IDE.
Once loaded, you can leave your board connected to your computer - you will need this connection to power the board and to communicate with the computer
Open the Serial Monitor.
The serial monitor should be set to its default settings ('No Line ending', 9600 baud)
Swipe a tag across the RFIDuino antenna. The green light will light up and your buzzer will make a noise.
The Serial Monitor will display 5 numbers separated by commas. These numbers make up the ID of your tag.
Copy down these numbers for future use. It can be handy to write the ID on a sticky note and attach it to the tag.
Tags in the EM4102 protocol have 64 bits that they return to the RFID reader. 24 of these bits are used for communication / protocol information (9 header bits, 10 parity bits and a stop bit.) This leaves 40 bits, or 5 byte for the tag's ID. The RFIDuino library returns the tag's ID as an array that contains these 5 bytes. All of the RobotGeek tutorials will use this convention for dealing with the Tag's ID number, displaying the tag id as 5 numbers in decimal format. However here are many ways that you can represent this number.
Step 5: Wiring and AssemblyConnect your components as shown in the diagram. If you have the RFID Lock Box Kit, you can follow the directions in the Assembly Guide at this point.
If you're building your own, check out the images of the latching mechanism parts, and get an idea of how you'd like to make yours. Each piece in the locking mechanism can be re-positioned for height or depth. This is so the solenoid can be positioned in such a way to clear the latch when activated, but catch it when it's off. In the last picture, we are showing the position of the solenoid when inactive, resting on the edge of the latch. In this position, your solenoid plunger should clear the latch when activated. Adjusting the vertical position of the Latch may be necessary. If the latch is too low, the solenoid won't catch it. If the latch is too high, the box might not close, or it will close ineffectively, leaving a gap that allows you to see the latching mechanism even when the solenoid plunger rests in the latch.
Step 6: Program and Test Your Lock Box- Open
RFIDuino_demo2_lockbox
onto your board. You can find this sketch underFile>Examples>RFIDuino>RFIDuino_demo2_lockbox
- You will need to make sure the code is adjusted for your RFIduino hardware. v1.2 shields (2 pin antenna, 'REV 1.2' printed on the board) will need the following code
RFIDuino myRFIDuino(1.2); //initialize an RFIDuino object for hardware version 1.2
v1.1 shields (4-pin antenna, no version number printed on the board) will need the following codeRFIDuino myRFIDuino(1.1); //initialize an RFIDuino object for hardware version 1.1
Both lines of code are available in theRFIDuino_demo2_lockbox
sketch, simply uncomment the one you don't need. If you are still unsure about what hardware you are using, see this page
- You will also need to modify the sketch to include the ID of a tag that we found in Hello World . Find line 57 - it looks like this.
byte key_tag[5] ={0,0,0,0,0};
Now insert the ID numbers for your tag. For example, if our tags ID was '70 0 44 22 242' we would modify the code to look like thisbyte key_tag[5] ={77,0,44,22,242};
- Connect a micro USB cable from your computer to your Geekduino
- Load
RFIDuino_demo2_lockbox
onto your board using the upload button int the Arduino IDE.
- Once loaded, you disconnect the USB cable from your computer..
- Swipe the 'key' tag across the RFIDuino antenna. The green light will light up and your buzzer play three different notes. Additionally, the solenoid will fire.
- Swipe any tag that is not the 'key' tag across the RFIDuino antenna. The red light will light up and your buzzer play three monotone notes. The solenoid will not react.
At this point, you should have a fully functioning RFID enabled Lock Box. What are you going to store in it? You have a bunch of IO pins you can use on it, so how do you plan to upgrade it? Bigger box? Flashy lights? We'd love to see what you come up with!
Comments