RFIDuino Demo 3 - Multiple Key Tags

mt_ignore
Standalone
mt_ignore
PC Control (Setup Only)

Now we will extend upon Demo 1 and 2. This demo will respond to multiple 'key' tags, so that you can have multiple keys for a system. This code will activate LEDS, the buzzer, and pin 9 just like in Demo 2. The rest of this demo assumes that you are using a solenoid / relay like in demo 2, but you can also use the code for generic purposes like in Demo 1

If you haven't already, make sure to go through the RFIDuino Getting Started Guide to get your libraries and hardware setup.

Hardware Required

Instructions

  1. Connect your components as shown here. b_500_500_16777215_00__images_tutorials_rfiduino_rfiduino-lock-box_bb.png
  2. Open RFIDuino_demo3_lockbox_multi onto your board. You can find this sketch under
    File>Examples>RFIDuino>RFIDuino_demo3_lockbox_multi
  3. 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_demo3_lockbox_multi sketch, simply uncomment the one you don't need. If you are still unsure about what hardware you are using, see this page
  4. Modify the code for the number of cards you want by editing line 58. For example, if you have three cards, use the code
    #define   NUMBER_OF_CARDS 3     //total numer of key cards that the system will respond to.  		
  5. You will also need to modify the sketch to include the IDs of the tags that you want to include. These IDs can be found using the Hello World sketch. Find the block of code starting at line 62 - it looks like this.
    byte keyTag[NUMBER_OF_CARDS][5] ={
    {0,0,0,0,0},  //Tag 1 //commenting each tag with a description can help you keep track of them
    {0,0,0,0,0},  //Tag 2
    {0,0,0,0,0}, //Tag 3
    {0,0,0,0,0},//Tag 4
    }; 		
    Now insert the IDs for your tags. If we had three key tags, our code might look something like
    byte keyTag[NUMBER_OF_CARDS][5] ={
    {77,0,44,22,242},  //Tag 1 //commenting each tag with a description can help you keep track of them
    {200,1,4,98,236},  //Tag 2
    {23,64,4,25,1}, //Tag 3
    }; 		
  6. Connect a micro USB cable from your computer to your Geekduino
  7. Load RFIDuino_demo3_lockbox_multi onto your board using the upload button int the Arduino IDE.
  8. Once loaded, you disconnect the USB cable from your computer..
  9. Swipe any of the 'key' tags across the RFIDuino antenna. The green light will light up and your buzzer play three different notes. Additionally, the solenoid will fire.
  10. 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.

Code Overview

This code is a modified version of RFIDuino_demo2. This code stores the key tags in a 2-dimensional array (think of it as an array of arrays). When a key is scanned, it is compared to every ID in the 2-dimensional array. If the tag is present, the system unlocks - if not, the system stays locked.

RFIDuino Functions used in this example

Power Options


The diagram shows connections using a single power supply and a wire nut for a connection. There are a couple of other options to wire everything up.

  • You can use the barrel jack to terminal converter found in the Power Converter Pack and wire up your devices as shown here.
  • You can cut off the barrel jack, then re-soldering it on, and also soldering two extra lines out, like this.
  • You can use two 12v power supplies, like this.

Next: Wireless Communication

×

PC Control These demos and projects allow the robot to be controlled via a computer.

ArbotiX Commander Control - These demos and projects control the Robot using the ArbotiX Commander, the handheld Arduino based remote control.

Direct Control - These demos and projects control the Robot directly from sensors connected directly to the Robot's control board.

Pose Control - These demos and projects allow you to create and playback a sequence of poses.

Serial Control - These demos and projects control the robot using a serial packet protocol.

Standalone - These demos and projects are deisgned to let your robot function without a computer or additional microcontroller.

Wireless Control - These demos and projects allow you to control the robot wirelessly - usually by replacing the Serial Connection with XBee modules.

Reference - These articles have technical details regarding the control and operation of the robot.

×

More info here

Feedback Form


Search