Hardware Reference
In-Depth Information
When you've got the Arduino programmed, open a serial
connection to it using the Serial Monitor. You should see a
message like this in the Arduino Serial Monitor when the
Arduino obtains an IP address:
The first Hello! is from Processing itself. When you send
a broadcast message, it comes back to you as well!
The second line is from the Arduino. If you have several
Arduinos on your network all running this sketch, you'll get
a response from each one of them. In fact, this exercise is
most satisfying when you have multiple units responding.
192.168.1.20.
Next, run the Processing sketch and type any key. In the
Arduino Serial Monitor, you should see:
This is a handy routine to add to any Ethernet-based
project. You have to provide a separate UDP instance and
port to listen on, but the sendPacket() method can work
with other programs to get a response from your device
when you send broadcast queries.
X
message received from: 192.168.1.1. on port: 43770
Hello!
The address will be your computer's IP address. In the
Processing monitor pane, you should see:
Hello!
192.168.1.20.Hi there!
Querying for XBee Radios
Using 802.15.4 Broadcast
Messages
Once you've got the radios connected and working, open
a serial terminal connection to one of them and issue
the following command: +++ . Then, wait for the radio to
respond with OK . Then type (remember, \r means carriage
return, so press Enter or Return instead of \r ): ATND\r .
Just as you can query a subnet to discover devices using
UDP, you can also query an XBee personal area net. The
XBee radios have a command to query the air for any
available radios. This is referred to as node discovery .
When given the AT command ATND\r , the XBee radio sends
out a broadcast message requesting that all other radios
on the same personal area network (PAN) identify them-
selves. If a radio receives this message, it responds with its
source address, serial number, received signal strength,
and node identifier.
If there are other XBee radios on the same personal
area network in range, the radio will respond after a few
seconds with a string like this:
1234
13A200
400842A7
28
TIGOE1
NOTE: To do node discovery, your radios must have version 10A1
or later of the XBee firmware. See the sidebar "Upgrading the
Firmware on XBee Radios" for more details.
5678
13A200
400842A9
1E
TIGOE3
For the purposes of this exercise, you'll need at least two
XBee radios connected to serial ports on your computer.
The easiest way to do this is by using a USB-to-XBee Serial
adapter like the XBee Explorer.
 
Search WWH ::




Custom Search