Building a Robot


A RoboRuckus robot can really be built to any design you want, provided it fits on the board and can properly communicate with the server and execute move orders. This page documents how to build the simplest, least expensive robot we could come up with for the game (though others smarter than us may have better ideas).

Materials

This should be a complete list of everything you need to build your robot (excepting tools like a soldering iron, flush cutters, etc…):

Prepping the Materials

The first step is to solder pins to the magnetometer and 9-DOF board; details on how to solder won’t be covered here, as there are already excellent tutorials out there. This assembly guide for the magnetometer provides an example of how to do this, the important thing to do is make sure the long side of the pins are pointing out the back (the side without the chip on it).

Pins should also be soldered around the entire perimeter of the Teensy in the same fashion. It’s also recommended that you cut the trace in between the 5V pads in preparation for using a battery power supply, like in this guide (Option #1). For the Teensy LC, the pads to cut between are the small ones next to the VUSB label.

PCB Assembly

Once all the items are organized and the pins soldered on, it’s time to attach things to the PCB. All the components should be soldered to the PCB following the silkscreen on the board. While the order you do this in doesn’t really matter, I do recommend starting with the large components like the Teensy, LED display, Wi-Fi module, and LED driver DIP socket (make sure the notch in the socket matches the notch on the silkscreen, in the “up” orientation).

You’ll need to add four sets of 0.1″ headers, two sets of three for the servos, and two sets of four for the sensors. These should be soldered in from the front, so that the long part of the header is facing up on the same side with the Teensy and other components.

If you don’t see where to solder the 0.1uF capacitors, look for two holes with a | in between them and with 0.1uF below them; the orientation of these doesn’t matter. For the 100uF capacitor, the orientation does matter, so be sure the negative lead is in the hole with the - symbol.

Soldering the voltage regulator in place can be tricky. It can stand upright, or it can be bent backwards. It won’t, and shouldn’t, lay flat, so you should solder it in place without pushing it all the way in if you want to lay it down. That way it can be bent backwards a bit but still have some space between its back and the PCB to allow for airflow and cooling. It’s probably best to bend the voltage regulator in place before soldering it.

Once the soldering is done, you can insert the LED driver into the socket, matching the notches for the orientation.

Setting Up

Following the instructions on the Teensy website, set up the Teensyduino software. During the software setup when you are asked to install libraries, check the box for i2c_t3. If that library is unavailable, you can manually download and install it from GitHub (see these instructions for installing libraries).

Next, following the same library installing instructions as above, install the Adafruit Unified Sensor Library, and then download and install the modified Adafruit_HMC5883 and Adafruit_LSM9DS1 libraries from the RoboRuckus GitHub repository.

Finally, you can download the bot code (BotCode.ino and movement.ino; these files should be kept in the same directory) from the repository. Once you open BotCode.ino in the Arduino software, you should be able to upload it to your Teensy (you’ll need to power the Teensy from the battery pack while uploading software via USB if you cut the power trace a described above).

Testing the Motors

Once the board is assembled, the motors need to be tested and set up. Plug one motor into either of the motor headers. The orange signal wire should be on the bottom, plugged into the pin labeled “sig”. Power up the board and then, holding the motor in your left hand with the back facing towards the right and the wire running out the back towards your body, insert a tiny Phillips screwdriver in the hole on the rear. The screwdriver should catch on a small potentiometer in the rear of the motor.

buildingBot-2

Holding the motor for tuning.

Slowly rotate the screwdriver clockwise (away from you) until the motor starts to spin, if the motor is already spinning, do this anyway to see if the motor slows down and, if it does, keep turning until it stops and then speeds up again, if it doesn’t slow down, stop turning. Once the motor is turning, slowly turn the screwdriver back the other way just until the motor stops turning, then turn it an additional quarter turn.

Repeat this process with the other motor. Now your system is ready for assembly, testing, and tuning!

Testing the Robot

To test your system you must first hook up the sensors. Following the labels on the back of the PCB silkscreen, use the F/F jumpers to connect the magnetometer to the front sensor pins, and the 9-DOF board to the rear sensor pins. VCC should be connected to the VIN pin on the sensor, GND to GND, SDA to SDA, and SCL to SCL.

Now power on your board. The decimal point on the LED display should light up, followed in a little bit by the letter E. This indicates that the system powered up successfully, but was unable to contact the game server, which is good since presumably there isn’t one currently running.

If you don’t see the letter E after a minute, power things off and double-check that the senors are hooked up correctly, also check all your solder joints for errors or shorts. If you still have problems, plug your Teensy into your computer via USB and power on your board. Open the Arduino software and serial monitor (make sure to select the correct COM port) then power cycle the board. Hopefully, the output from the Teensy should provide helpful debug information (it may be necessary to quickly close and reopen the serial monitor as the board is powering up to see output).

Robot Assembly

Hot glue makes a quick and easy way to stick the robot together and allows for easy rearrangement if necessary, though it does tend to require semi-regular repairs. For permanent sticking, you can use epoxy, E6000, or your favorite adhesive.

To clarify some terminology, the front of the robot is the end of the PCB with the LED display, and the rear is the end with the Teensy. Up is in the same direction as the top of the robot and down is facing the ground.

First, remove the screw from the battery case, as you likely won’t be able to access it once things are together. Next, glue the PCB to the battery case. You want to make sure the switch on the case is facing down (on the opposite side from which the PCB is glued to), and the case should open sideways—i.e. perpendicular to the front-rear axis—to allow access to the batteries.

Next, glue the front and rear sensors in place on the bottom of the battery case. The chips should face downwards and be aligned roughly in the center of the front-rear axis with the pins and wires facing towards the outside. It may be helpful to offset the rear sensor vertically by gluing a few spacers, like pennies or a scrap of wood, between the sensor and the battery case.

A fully assembled robot as seen from the bottom. The left-right axis appears reversed because the robot is upside-down.

Next, press the wheels onto the motors and screw the wheels in place. Glue the wheels/motors onto the bottom of the battery case. The center of the motor case should be centered on the left-right axis with the wires running out towards the back. Doing this places the wheels themselves slightly back from center, which helps prevent the tipping over when moving, and also allows the robot to rotate easily around its center.

Then assemble and glue the caster in place. It should be near the front and, if using a plastic caster, it can even be glued on top of the front sensor. To increase stability, two front casters can be used as in the example, with one on each side of the front of the case.

Finally, you’ll need to add some weight to the front of the robot to keep it from tipping over. A stack or two of pennies is a cheap and effective way to go, but any weights or washers would work.

buildingBot-4

A fully assembled robot.

Once your posse of robots is assembled, you can decorate them to get them ruckus ready!

Robot lineup, front.

Robot lineup, back.

Robot lineup, top.

When each robot is finished it should be given a name and tuned following these instructions. It’s important to setup each robot individually as having more than one robot with the default parameters and name connected to the game server at the same time can cause problems.

Further Debugging

There are two lines in the code that relate to debugging the robot’s communication with the game server:

Uncommenting the line with debug will make the robot more verbose in outputting information through the Arduino serial monitor (or really, any serial monitor), especially while moving or communicating with the game server. By enabling this and keeping the robot connected via USB to a computer running the serial monitor while testing the robot, you can get a lot more information that will hopefully be helpful in tracking down any strange bugs in the robots movement or behavior.

Uncommenting debug2 will disable most of the robot’s behavior. Instead, by communicating over the Arduino serial monitor (with the robot plugged in to the computer via USB), you can send commands directly to the Wi-Fi module, and see the Wi-Fi module’s responses. This is useful if you’re having trouble getting the robot to communicate with the server and want to track down the problem.