accelerometer data as requested.
THE PC COMMAND
At this stage, we have conceptually (and physically) tied our PC through
Zigbee to our Robot via a command
protocol structure and a board to
generate PWM signals at the robot
end. This leaves the creation of the
Command Console (shown in Figure
4) at the PC end to manage all of this.
The Command Console’s function is
to provide a graphical interface for
controlling the Robot and to receive
and display any incoming data. To do
so, it must talk to the locally connected Zigbee board via RS232.
There are several sets of functionality available through the Command
Console. Most notable are the two
areas to control the robot — the On/
Off control area and the Proportional
control area — and an area to display
the received accelerometer data.
We included the On/Off control
area in case simple motor devices
such as Continuous Rotation Servos
were attached. This control set will
allow for the starting, stopping, and
turning of the robot using these, by
simply pressing the buttons.
The Proportional area is much
more capable and allows for the continuous control of both motors through
a range from full forward to stop to full
reverse. This is done by moving either
the speed slider or the steering slider in
the appropriate direction.
There are two small windows at the
bottom of these areas which show the
actual Left and Right PWM values that
are currently being transmitted to the
robot. I should note that a transmission only occurs when a button is
pushed or a slider position is changed.
The PWM channels on the Cypress
processor hold the last known PWM
value, so there is no need for refresh. If
that were not the case with the PWM
output device in use, then the code
would need to be modified accordingly.
Finally, there is the area which
requests and displays the accelerome-
■ FIGURE 5. All the components of
the ‘bot laid out in a row.
ter data. Clicking the check box starts a
timer that sends to the robot, 10 times
a second, a request for data. When
received by the console, this data is
displayed in the appropriate windows.
The Command Console as it stands
works as expected and is a reasonable
base for developing further and more
complex remote control Zigbee applications: it has the serial communication
to the Zigbee board, the command
structure for sending and receiving
data, and some basic control functions.
TESTING THE SETUP
Hmmmm ... Well how did it all
work? Good question! After some
debugging here and there, everything
worked pretty much as we had hoped.
As shown in Figure 5, the PWM board
was connected to the Zigbee board
and to that were connected two
continuous rotation servos.
Using this configuration, we were
able to start and stop the servos,
reverse them, and cause them to
rotate in opposite directions, much as
The next thing we did was connect the PWM outputs to a scope to
see how the fully proportional aspects
of the console worked. Sure enough,
as we moved the sliders, the PWM
square wave grew and shrank between
1-2 ms the way we had planned. I
must admit, I was a little concerned
that the Zigbee communication might
fail if I quickly moved the speed slider
up and down several times a second,
causing many command packets (255
top to bottom) to be sent, but as far
as we could see (eyeball), the proportional PWM continued to work quite
■ You can purchase the SARD board
directly from Zigbee at this link:
■ You can download the free Code
Warrior development tool at this link:
■ You can get online help on
Freescale Zigbee at the following
forum link: www.freegeeks.net/
smoothly. Not too shabby at all.
WHAT WILL IT COST?
So, can the reader do all this
themselves and how much will it
cost? Another great question! Well,
except for the cost of the Zigbee
boards, the compiler to modify and
write additional code for the Zigbee
boards is downloadable for free,
though I believe in that form, it will
only compile up to 16 KB of code.
That is probably more than enough
for hobbyists, especially if they are
using it in a fashion similar to the way
we did. In addition, the demonstration applications are free and may be
modified and/or pieces of them
included into your own programs.
Also, before the end of this three-part series (and possibly sooner), I will
place on the Nuts & Volts website all the
code we developed and used along with
any circuit diagrams etc., which should
hopefully give you a head start in devel-
May 2006 81