You are on page 1of 21

XBee and RFID

XBee in 30 minutes
Xbees are small radio modules that
communicate with each other over radio
using the Zigbee protocol (built on top of
the 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 collect
and/or respond to the information that the radios
communicated.

What Hardware Do You Have?


Arduino

XBee
Module

Arduino
Xbee Shield

XBee USB
Explorer

Loading Firmware
You Need:
-Xbee Module
-Xbee USB Explorer
-X-CTU software
Digis X-CTU software is a program that lets you
load firmware onto your XBee module, configure
settings, and test the radios functionality.
It is only available for Windows but can be run
in 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

Programming
a Router
In Windows XP or from
inside your emulator:
1. Insert the Xbee module
into the USB explorer,
connect with the USB
cable to
your computer
2. Double click on X-CTU,
and you will see ==>

Programming
a Router
There should be a com port
(probably the last)
labeled USB Serial Port.
Click on it.
Click on Test / Query.

Programming
a Router
You should see this ==>
Click OK, then
click on the
Modem Configuration
tab.

Programming
a Router
You should see
something 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 should
show 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 module
The module broadcasts that data
over radio
to any other radios that are listening
When my coordinator receives data
broadcast from any of your radios
The coordinator echoes that data
over the serial port
to my computer
MUCH MORE is possible, but we dont have time.

RFID in 15 minutes
RFID (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 Hardware
Do You Have?
Arduino

RFID
reader
RFID
antenna

Connecting the Reader


Ground

45

+5V

Ground
+5V

Upload your Code


Load 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 communicate
with 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 to
the Arduino--the serial number if it sees a tag, and a 2 if no tags
are present.
The Arduino then sends the tags serial number over the serial port,
which you are monitoring on your computer.

15 Minutes Left
The Xbee communicates with Arduino over
the serial port.
The RFID reader communicates with Arduino
using I2C and analog pins 4 and 5.
Can we combine these?

Putting it All Together


Ground

45

+5V

Some Resources
Xbee (beware of Series 1 vs Series 2 documentation)
http://www.arduino.cc/playground/Main/InterfacingWithHardware
http://www.humboldt.edu/~cm19/XBee%20setup.pdf
http://hcgilje.wordpress.com/resources/xbee_arduino_code/
http://www.faludi.com/projects/zigbee/
RFID
http://www.tinker.it/en/Teaching/RFID
http://www.tigoe.net/pcomp/code/?s=RFID&searchsubmit=Find

You might also like