xbee and rfid
DESCRIPTION
Part of Tinker.it!'s Internet of Things master class from dconstruct 09, covering XBee radios and RFID readers.TRANSCRIPT
XBee and RFID
XBee in 30 minutesXbees are small radio modules thatcommunicate with each other over radiousing the Zigbee protocol (built on top ofthe IEEE 802.15.4 standard, if you care).
They allow for drop-in, drop-out mesh networking.New devices can be automatically detected,and existing devices can be removed without disrupting the entire system. Each radio can broadcast or can address specific other modules.
Today we will set up a very basic XBee network.
What Does an Xbee Network Need?
One coordinator to manage the overall network.
Multiple endpoints/routers to receive and pass on information.
External sensors or other modules to collectand/or respond to the information that the radios communicated.
What Hardware Do You Have?
Arduino
XBeeModule
XBee USBExplorer
ArduinoXbee Shield
Loading Firmware
You Need:-Xbee Module-Xbee USB Explorer-X-CTU software
Digi’s X-CTU software is a program that lets youload firmware onto your XBee module, configuresettings, and test the radio’s functionality.It is only available for Windows but can be runin an emulator on an Intel Mac (load Arduino and the relevant drivers in Windows).
http://www.digi.com/support/productdetl.jsp?pid=3352&osvid=57&tp=5&s=316
Programminga RouterIn Windows XP or frominside your emulator:
1. Insert the Xbee moduleinto the USB explorer,connect with the USBcable toyour computer
2. Double click on X-CTU,and you will see ==>
Programminga RouterThere should be a com port (probably the last)labeled USB Serial Port.
Click on it.
Click on Test / Query.
Programminga Router
You should see this ==>
Click OK, thenclick on the Modem Configurationtab.
Programminga Router
You should seesomething like this ==>
You want these settings(highlighted):• Modem: XBEE: XB24-B• Function Set: ZNET 2.5
ROUTER/END DEVICE AT
• PAN ID: 234• Node Identifier (enter a
name for your radio)
Click on Write
Programming Arduino
Remember the button you wired earlier? Make that circuit again.
In the Arduino IDE, open “XBButton.pde”and load it onto your Arduino.
You can test that the code is functioning by starting the serial monitor in Arduino. Every time you press the button, the pane shouldshow “Hello world!”
(Change the “Hello world!” to say whatever you want.)
Programming Arduino
• Unplug your Arduino.• Unplug the wire connected to
pin 2 from your Arduino.• Bend the power and ground
wires so they are flat against the Arduino pin sockets.
• Place the XBee shield on the Arduino.
• Make sure the jumpers on the shield are on the XBEE (not USB) side.
• Place the XBee module on the XBee shield.
• Plug the wire back into pin 2.• Connect the Arduino to your
computer.
Press the button…
What is Happening?The radio is now set up so that:
When you send data• from the Arduino• over the serial port • to your Xbee moduleThe module broadcasts that data• over radio• to any other radios that are listening
When my coordinator receives data • broadcast from any of your radiosThe coordinator echoes that data • over the serial port• to my computer
MUCH MORE is possible, but we don’t have time.
RFID in 15 minutesRFID (radiofrequency identification) is a way of storing and communicating small amounts of data. RFID tags store data (usually a serial number and a few bytes of changeable information), and RFID readers can read, decode, and sometimes change that data.
RFID has historically been used in industrial logistics and tracking, but cheaper and more accessible technologies have recently opened it up for hacking and other creative uses.
Today we will set up an RFID reader to read the serial numbers of tags.
What HardwareDo You Have?
RFIDreader
RFIDantenna
Arduino
Connecting the Reader
4 5
5
+5V
Ground
4 5
+5V
Ground
Upload your CodeLoad “RFIDReader.pde” onto your Arduino board.
Activate the serial debugger pane in Arduino.
Touch an RFID card to the antenna.
What is Happening?The RFID reader communicates with Arduino using a communication protocol called I2C, which Arduino code manages using the Wiring library, and which uses analog pins 4 and 5.
This is one standard way that microcontrollers communicatewith more complicated external devices.
This Arduino code continually asks the RFID reader to look for the serial number of any tags near the reader.
The RFID reader does the heavy lifting and returns a number tothe Arduino--the serial number if it sees a tag, and a 2 if no tagsare present.
The Arduino then sends the tag’s serial number over the serial port, which you are monitoring on your computer.
The Xbee communicates with Arduino overthe serial port.
The RFID reader communicates with Arduinousing I2C and analog pins 4 and 5.
Can we combine these?
15 Minutes Left
Putting it All Together
4 5
5
+5V
Ground
Xbee (beware of Series 1 vs Series 2 documentation)http://www.arduino.cc/playground/Main/InterfacingWithHardwarehttp://www.humboldt.edu/~cm19/XBee%20setup.pdfhttp://hcgilje.wordpress.com/resources/xbee_arduino_code/http://www.faludi.com/projects/zigbee/
RFIDhttp://www.tinker.it/en/Teaching/RFIDhttp://www.tigoe.net/pcomp/code/?s=RFID&searchsubmit=Find
Some Resources