RFIDuino Demo 1 - Key Tag

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

Description

In Hello World we simply read a tag. Now we will read tags and differentiate between one special key tag and any other tag. For our 'key' tag, the RFIDuino will activate the green LED and sound 3 different notes to indicate the 'key' tag has been read. For all other tags, the red LED will activate and 3 monotone notes will play to indicate that the wrong tag has been used.

Instructions

  1. Connect your RFIDuino as shown. (Click here for the v1.1 Connection Diagram)
    b_0_409_16777215_00__images_tutorials_rfiduino_RFIDuino_basic.png
  2. Open RFIDuino_demo1 onto your board. You can find this sketch under
    File>Examples>RFIDuino>RFIDuino_demo1
  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_helloworld sketch, simply uncomment the one you don't need. If you are still unsure about what hardware you are using, see this page
  4. You will also need to modify the sketch to include the ID of a tag that we found in Hello World . Find line 45 - 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 this
    byte key_tag[5] ={77,0,44,22,242};
  5. Connect a micro USB cable from your computer to your Geekduino
  6. Load RFIDuino_demo1 onto your board using the upload button in the Arduino IDE.
  7. Once loaded, you can leave your board connected to your computer - you will need this connection to power the board.
  8. Swipe the 'key' tag across the RFIDuino antenna. The green light will light up and your buzzer play three different notes.
  9. 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.

Code Overview

This sketch builds on the code from RFIDuino_helloWorld. The main difference is that it calls the compareTagData() to check the most recent tag data against the key tag data we defined. Based on whether or not these tags are the same, we can call different instructions (which led to light up and which tones to play).
In the previous examples we have just activated the buzzer. In this example the code uses the functions successSound() and errorSound() to add tones to our buzzer.

RFIDuino Functions used in this example

Next: Demo 2 Unlocking a Solenoid

Feedback Form