Zigroller project, hardware

Since my Zigduino-based balance bot project, the Zigroller, got mentioned in the Make blog last week, I've written it up in a bit more detail here. I'm going to cover hardware first and then I'll cover the control software later.

Image courtesy Marc de Vinck/Make Magazine

I took a class on digital controls at the UW this summer, and the class included a project option. I'd wanted to build a balance bot for a while, so this was the perfect opportunity. Around the time I needed to pick my project, the Arduroller project turned up on Make and various other places around the web. Since the class was in control theory, it was perfectly acceptable for me to duplicate the mechanical and electrical part of the Arduroller design. I deliberately refrained from reading the code. Since the Zigduino needs more demo projects, I decided to make it remote control as well for a little additional flash.

 Getting Parts

I duplicated Shaun's Sparkfun order, modified for what was in stock and with a few goodies of my own added:

2x  PRT-00339 Polymer Lithium Ion Battery - 1000mAh
1x  ROB-08901 Wheel 32x7mm, 2 pack
2x  ROB-08913 Mini Metal Gearmotor 24:1
1x  SEN-09059 Gyro Breakout Board - ADXRS613 - 150 deg/s
1x  SEN-00849 Dual Axis Accelerometer Breakout Board - ADXL322
1x  DEV-09815 Ardumoto - Motor Driver Shield
2x  PRT-08084 Screw Terminals 3.5mm Pitch (2-Pin)
2x  PRT-09749 JST Right-Angle Connector - Through-Hole 2-Pin
1x  DEV-09760 Joystick Shield Kit


I also purchased a pair of 90mm wheels from Polulu (more on this in the software post) and a couple of boxes of 4-40 screws, nuts, and washers. The sensor boards I used are no longer stocked by Sparkfun... you'll have to redesign with ones that are available if you want to duplicate this project. This may required re-doing parts of the electronics, but since the ones that Sparkfun carries now use I2C rather than analog to transmit data to the host, the electronics will be simpler and more accurate.

Building the Remote Control

Unfortunately, both breakouts and the joystick shield put out 0-5V... and the Zigduino ADC only accepts 0-1.8V. In order to remedy this, I needed a whole lot of voltage dividers. The joystick shield was the simplest one. Since both axes of the joystick are potentiometers, all I need to do in order to drop the output voltage range is to put an appropriately sized resistor on the power supply rail. I hacked off the 5V supply pin and hooked a 3.9K resistor between the 3.3V supply pin and the top of the 5V pin. This puts the midpoint of both axes right about at 0.9V, which is perfect, as you can see in this picture. If you look closely, you can see the missing 5V pin and the magnet wire carrying 3.3V out to the end of the dropping resistor. The generous prototyping area available on the Sparkfun joystick shield was crucial to packaging this nicely.Detail of joystick shield, as modified

Adding a 9V battery and connector finishes the remote control. It really ought to be in a nice case or at least taped together, but this is good enough for now.

Zigroller controller

Building the Frame

I decided to build the frame out of clear acrylic, because I like the look. The acrylic I had access to was 3mm rather than the 2.6mm of the original bamboo, so I had to modify the original cut file to accomodate the thicker material at the motor mount joints. I also found that when I had Metrix Create Space cut Shaun's original file, there were a number of extra components, which I deleted.

Zigroller cut file

After my first cut and attempt to assemble the frame, I discovered two things. One, the original motor mounting holes didn't work in 3mm acrylic. Second, with the Zigduino + Ardumoto stack mounted on the cover plate in the same place as on the original design, I couldn't fit the antenna. I twiddled the motor mounts to have smaller nubs and raised the top arch in order to fix these problems. I also modified the holes to accomodate more readily available (to me) 4-40 hardware rather than the original metric. 

Since Shaun didn't provide any assembly drawings and the published pictures only showed one side of the bot, I had to guess at what the battery case should look like. The setup I ended up with only uses a pair of spacers and, when built of 3mm acrylic, the 1000 mAh batteries slip into it very neatly. It doesn't leave any room for mounting screws, however, so I deleted them and replaced them with foam tape.

Adding the Sensors

I followed Shaun's lead in putting the sensors down at the axis of the wheels. It makes the control math somewhat easier and the bot frame was designed with that in mind from the first, so it was a no-brainer. I used some ribbon cable and the connectors from one of my shift register daisy chain to connect them up to the Zigduino through the Ardumoto shield (again, prototyping area for the win!). I added a couple of JST connectors wire in series for the batteries... and then I remembered I needed some voltage dividers to divide down the signals from the sensors.Ardumoto shield, as modified and mounted.

Since I'd left it until late in the process, I ended up making the ugly (but functional!) mess of the voltage dividers you can see in the picture. The little wires soldered on are there so I can hook on an oscilloscope to crucial signals for debugging.

Mounting the Electronics and Motors

Once I'd assembled the connectors on to the Ardumoto shield and mated it with Zigduino, I used the double-sided tape to mount the resulting stack to the frame. I also used some double sided tape for mounting the sensors. I love double-sided tape for this sort of thing, because it's easy, reasonably durable, and easy enough to undo is required. I taped the sensor cable up the back of the battery compartment, which created a nice, neat package. 

I mounted the motors more or less as Shaun did. However, I didn't have any Shapelock or a local source of it here in Seattle. I wandered into TAP Plastics looking for it and got a pair of tubs of something called Magic Sculpt. It's a two-part putty of some kind that's water soluble before it cures. This makes shaping and cleanup really easy. It cure rock-hard and gave me solid motor mounts. I completed the wiring by ziptying the motor leads to the sensor cable up to the bottom of the electronics package. A 0.1uF ceramic cap soldered across the terminals of each motor completed the initial wiring harness. The pictures here include 1uF caps across the shield terminals for each motor -- that was a later addition to suppress noise, and will be covered in the software section.

You can read about the software part of this project here.