This demo uses the RFIDuino shield, a Geekduino (or other Arduino Board)and the RFIDuino library to scan for a tag. Once a tag is read, the ID of the tag is stored as an array of 5 byte-sized numbers. This array of numbers represents the ID. After a successful read, these 5 numbers will be sent over the Arduino's Serial Port to your computer.
The RFIDuino Shield is designed to be used with 125khz EM4100 family tags. This includes any of the EM4102 tags sold by Trossen Robotics/ RobotGeek. The RFIDuino shield may not work with tags outside the EM4100 familyAdidas
If you haven't already, make sure to go through the RFIDuino Getting Started Guide to get your libraries and hardware setup.
Connect your RFIDuino as shown. (Click here for the v1.1 Connection Diagram)
RFIDuino_helloworldonto your board. You can find this sketch under
- 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.2v1.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.1Both lines of code are available in the
RFIDuino_helloworldsketch, 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_helloworld3 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.
Tools -> Serial MonitorThe 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. 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. NOTE: You will need the ID for at least one tag for the next tutorial.
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. You can see this page for more information.
This example uses the
scanForTag() function to continuously scan for a tag. The
scanForTag() actually needs to run a least twice to be successful. This is because the library needs to read a tag twice to verify the data and prevent 'phantom reads'. The reading process happens very fast, so you won't even notice that the tag is being read multiple times.
scanForTag() has run at least twice and returned the same data, it will return a 'true' value and place the ID numbers it has read into the array
tagData. This array is then written to the serial port for you to see over the serial monitor.
RFIDuino Functions used in this example
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