At the request of our marketing team we have taken our intelligent rover who avoids obstacles without any assistance from anyone and given him a remote control feature via ZigBee.
Personally, I find this to be a sad state of affairs when an intelligent robot with SONAR vision is asked to behave like an RC car. I’ve named this mode of operation “Slave Mode” to quietly voice my opinion on the matter. It’s something like a zombie version of the same rover and you can understand why R2-D2 was so interested in getting rid of that restraining bolt in the first Star Wars movie so he could run for the hills.
For the record, I wrote a command interpreter for the Rover so you can send him into Slave mode with a Wi-Fi device, ZigBee, or even from his own web server. Truly, he is not going to escape and run off to find Obi-Won Kenobi.
ZigBee and the Rover
Anyone working in the Embedded field by now has caught the wireless ZigBee buzz and RoverLORD is no exception. Digi has a pretty strong line of ZigBee products.
Adding ZigBee to the Rover… Scary Scary!
I admit that ZigBee is pretty intimidating but getting him up and running was less than a day with the Rabbit code.
The first thing you want to realize is that you can set up one of the ZigBee modems to fake out a serial port. Why is that important? It means my Rover doesn’t need to know “thing one” about ZigBee. He just writes or reads with his serial port and the modem does all the work. If there is no need to worry about the ZigBee software, I don’t increase my project’s code size and my CPU doesn’t have to carry the overhead either.
On the other end I have an RCM4510W acting as the ZigBee coordinator to the Rover’s ZigBee end device. He comes up using our ZigBee API, sends off a command to set the Rover’s modem as a transparent serial port and then sits there listening as my rover happily chatters away to his fake serial port. Little does he know that every log entry is being passed wirelessly to my other Rabbit where I can easily dump the data into a log file.
ZigBee at Play
In this video you can see our Rover happily face-planting into a cube wall while he reliably sends us a description of his many woes via the ZigBee connection back to my PC.
You will see an XBee Series 2 modem on the Rover in the video and in the image below.
We wanted to replace the slightly goofy looking brackets with something a little more polished so with a piece of stock aluminum, a few tools, and a bit of time I created a new SONAR mount for the rover.
An Anvil and Some Metal
My friend Tim Kwasny taught me some metalworking and I have an anvil ready in my garage when I need to hit something with a hammer… I mean hit it constructively of course.
When cold-working a metal like aluminum you want to use a soft mallet and take it slowly. The last thing you want is for the metal to tear or snap when you are bending it. (It is called “cold-working” because I’m not heating the metal with a forge or torch first.)

Use a soft mallet for aluminum.
If I was concerned about scratching the aluminum stock, I might place leather on the anvil so I can still use it for shaping but the steel anvil surface doesn’t scratch my piece.
Adding a Bend for the Bracket
For a basic L-bracket I need a 90 degree bend. My anvil has just the shaping surface I need. It may sound tricky, but really it is just holding the metal down with one hand and whacking it with the hammer until it begins to gently fold.
Once the fold starts you can strike both the top and side of the anvil to shape the metal.
One of my many vices…
The anvil wasn’t giving me a clean enough bend and I couldn’t apply enough grip to finish a sharp corner so I turned to my bench vice.
Some of this shaping was done with hammer strikes but a good bit was also just applying a bit of muscle to the end of the aluminum stock to lever it against the vice.
Cut it out…
Believe it or not, I used a normal jigsaw with a metal blade to cut the piece. I measured it out to 2 inches on either side of the bend, marked it with pencil, and then viced it into position. When cutting metal like this:
- Wear eye protection – You will be covered with metal spray. You also never know when that metal-rated jigsaw blade might snap.
- Cut slowly – A slower cut is a cleaner and really safer cut.
Cleaning up the Piece
Two tools that any metal worker should have in their shop.
- A dremel or rotary tool – This is pretty obvious. I use it for fine freehand shaping and also as a drill because it gives me really good control over the rotation speed. A slow speed lets me easily place the bit and once it bites, I can increase the speed to finish the hole. (If you have a drill press, use that instead.)
- A belt sander with a sanding wheel attachment – Use this to clean up cuts and drill holes, round corners, and generally shape the piece. I can’t overstate how useful this tool is.
I used the sanding wheel to tidy up and straighten out my cuts.
The sanding belt took the sharp corners off for a more professional rounded look on the bracket.
Using the Rover’s SONAR circuit board, I marked the mounting points by gently tapping a dent into the aluminum with a punch. Then with my vice, I used my dremel and a drill bit to add mounting holes.
A Fresh Coat of Paint and “Taah-Daaah!”
I pulled the turret off the rover and applied a coat of flat black spray paint to both the bracket and the turret. The flat black helps to cover any “anvil-bite” marks on the aluminum and it gives the whole thing a classy look.
Doesn’t he look fancy?
With his new bracket and freshly painted turret, the Rover looks terribly sophisticated.
Why would anyone do this?
At first it might seem silly to pull out an anvil when I can buy mounting brackets from any Robot part store. The point is that I got to choose exactly what material I wanted (light aluminum) and created exactly the part I needed. If I need another part, I can shape it just as easily as this one in 20 – 30 minutes.
Also we should remember that, engineering is a creative process and that applies to C code, H-bridge motor drivers, or metal work. There is something to be said for the challenge and pleasure you get in creating something yourself.
Collision Avoidance and More
The initial rover collision avoidance algorithm was created so that the rover would turn his SONAR turret back and forth and attempt to detect an obstacle within 3 feet in any direction. It worked well enough but was probably too aggressive. When the Rover got close to a wall he got very suspicious when he probably didn’t need to.
When the rover is operating near a wall, 3 feet of lateral clearance is too much. It prevents him from traveling in parallel to a wall or from passing through any hallway less than 6 feet wide.

As the Rover attempts to navigate this hallway, the 3 foot detection radius registers the hallway as a false obstacle.
3 feet of clearance on the left + 3 feet of clearance on the right
=
6 feet minimum lateral clearance
If you would believe my high school math teacher we might be able to find a use for math in the real world. In fact, there is a handy ratio function that lets us trim down the obstacle detection field.
If our obstacle detection is 3 feet and we want 10 inches of clearance on either side for the wheels, we can use the ratio to get there like this:
- y – axis (Forward Obstacle Detection) = 36 inches (3 feet)
- x – axis (Lateral Obstacle Detection) = 10 inches
- 36 inches – 10 inches = 26 inches
We just plug our numbers into this equation and out drops our new detection zone:
Obstacle distance at angle Theta = (RATIO x 26 inches) + (10 inches)
Crunching these numbers we get the following results:
- -90 degrees = (0.0 x 26″) + 10″ = 10″ – (Looking Left)
- -45 degrees = (0.5 x 26″) + 10″ = 23″ – (Looking Left & Forward)
- 0 degrees = (1.0 x 26″) + 10″ = 36″ – (Looking Forward)
- +45 degrees = (0.5 x 26″) + 10″ = 23″ – (Looking Right & Forward)
- +90 degrees = (0.0 x 26″) + 10″ = 10″ – (Looking Right)
That changes the shape of the obstacle detection field from a half-circle into this triangle:
With this little bit of math we can more easily travel through a narrow hallway. This modified detection algorithm is what we used in the successful obstacle avoidance test video. The best part is that while we travel parallel to a wall we won’t detect it as an obstacle but if we start to drift into it, the Rover will still detect it.
Collision Avoidance is Working
We have defeated Dread Conduit Pipe Bob and now face the grim Cube of No Return!!
Rover Test Video #31 – Getting Closer!!
Rover Test Video #32 – Success!!
As you can see, RoverLORD nailed it!















