Deciding on a robot design started with one main problem: How would the robots navigate the game board? Optical line following is the simplest and most popular method of navigation, but that requires having high contrast lines all over the board. Not only would that make the board look ugly (especially with a relatively small board), but would limit the colors and design of the board to maintain the high contrast needed for the sensors to work reliably.
The solution we eventually came up with was to use magnetic line following. My first thought was to use magnetic mounting tape and Hall-effect sensors to mimic the photosensors used in optical line following. With that settled, it was time to determine the design of the rest of the robot. With my two primary principals of simplicity and inexpensiveness in mind, I decided to go with a AA battery case for the body and continuous rotation servos for movement. A seven-segment LED display and a piezo buzzer would provide user feedback, and the robot would connect to the control server via Wi-Fi. Controlling it all would be an Arduino Pro Mini. With that decided, it was time to assemble the first prototype.
Laying out the components on the protoboard.
Soldering the large components on the board.
The Wi-Fi module was tested to make sure it was wired up correctly.
All components soldered and wired up.
Testing the LEDs to ensure everything was wired up correctly.
Hooking up and testing the servos.
The wheels, fitted and epoxied to the servos (not the best solution).
Prototype assembled and ready to go!
The above gallery shows the first prototype bot construction process, and some videos of the testing are embedded below (with apologies for the terrible sound):
While the robots worked surprisingly well (with the occasional tendency to drive into a wall), the Hall-effect sensors proved too insensitive to follow the magnetic tape lines on the other side of a piece of cardboard. I determined that, at best, the sensors would need to be no more than a centimeter away from the magnetic tape to trigger even semi-reliably, which wasn’t feasible.
After much thought about how to detect a fairly weak magnetic field, the obvious solution of a digital compass struck me. The compass proved to work extremely well for following the magnetic tape, however I determined I needed two of them, one in front and one in back, in order for the bot to be able to drive forward and backup.
That presented another problem since the compasses used I2C and had a fixed address. In order to use two compasses I would need two I2C buses (or an I2C multiplexer, but that seemed overly complicated and pricey), which the Arduino Pro Mini I’d been using didn’t have. Fortunately, I found the Teensy LC, which was almost the same price, compatible with the robot code I’d already written, and had all the buses I could need; success! Time to assemble version two of the robot prototype:
The Teensy worked a treat, and soon the bot was easily driving forward and backwards in a mostly straight line (see the Designing the Board section for drive testing). Turning, however, proved to be a pain. Trying to track the changing magnetic field of the tape while turning proved to be too complicated to get working reliably; I suspect the compass was getting interference from the Earth’s magnetic field. Fortunately, I found a great 9-DOF board that combined the same digital compass with a digital gyroscope that could easily track turning.
Now that the design was settled, it was time to consider mass production. This meant creating a custom PCB to speed up the manufacture process, and to make it look better. Using some schematics I whipped up in Eagle (available in the GitHub repository) I was able to order a PCB from the excellent OSH Park.
Rendered PCB front.
Rendered PCB back.
With that, it was time to create an army of robots!
The robot factory in action!
Diligent workers at their stations.
Soldering the PCB.
Delicate soldering work.
So much soldering.
Assembling the bots with their wheels.
Liberal use of hot glue is a must.
Tuning the robot servos.
Fredbot reporting for duty!