Introduction: How to Make a Swarmbot

Picture of How to Make a Swarmbot

Over the course of the class Principles of Engineering a team composed of Myself, Adela Wee, Evan Simpson, and Dara Behjat from Olin college and Babson College set out to create the cheapest robots we possible could. Nearing the end of the project we realized that the amount of documentation that we had was shockingly small. As such we set out in our final hours to make an in depth explanation of how one would go about constructing the physical portion of one of these robots.

You'll need the following materials (per robot):

50-60 sq. in. 0.093 in. thick Acryllic COST: $2.50
Optical Mouse (the really old kind that you can get for 3 bucks on amazon. You'll need one for each robot) COST: $3
Two motors (we used compact Sparkfun motors with attached gearboxes. We used a direct drive so motors with an appropriate speed are a must) COST: ~$3 each
One 9V battery COST: ~$1
About 4 in. of 1 in. wide balsa wood. COST: negligible
2 small (~1 in.) L-brackets  COST: negligible
Arduino COST: $3 for chip, $25 for full board
an nRF24 radio chip COST: $3
an H-Bridge COST: $1

Total cost (approx.) = $16.50 + Arduino

Electrical Tape
Hot-glue gun
Laser Cutter/Bandsaw/Hacksaw (in theory you only need one, but doing the whole thing with a hacksaw would be awful)
Exacto Knife
Solder/Soldering iron
An assortment of wires
Super Glue
Some small (#2 - #4) screws, washers, and lock-washers

Optional:
Grip Tape
Teflon pads
Heat shrink tubing
Protoboards
Accelerant for the glue
Duct Tape

Below is the frightening visage of a completed swarmbot in all its operational glory.

Step 1: Getting Your Acrylic Parts

Picture of Getting Your Acrylic Parts

So, the first step in making a swarm bot is to cut the basic required pieces for the swarm bot's assembly. There are any number of ways you could go about doing this, but the general parts we decided to cut were as follow:

We made three panels for the top, left and right sides that were joined at box joints. We then added structural pieces similar to a raspberry pi's case between the left and right sides. (first picture)

Additionally, we chose to cut our wheels out of acrylic, and included a number of spacers to ensure that the body of the swarm bot wouldn't interfere with the motion of the wheels. If you decide to cut your wheels this way as opposed to using wheels from a kit, be sure that you've thought about how you want to connect these wheels to your motor shafts. Keeping in mind the tolerances of the laser cutter this might not be the best way to go. Alternatively adding some hot glue to the junction between the wheel and motor shaft should be a decent temporary fix.

For this step we chose to use a laser cutter with appropriate tolerances on all pieces. I've attached some images of the cut acryllic below and for reference, each swarm bot is about 3x4 in.

After getting all of the pieces cut, the assembly of the basic frame is pretty straightforward, just use super glue and accelerant to make sure the joints are nice and tight (Super glue is really what you want to use here, it'll make a real chemical bond between the plastic and stay strong for far longer than any other glue would.)

Step 2: Prepare the Mice

Picture of Prepare the Mice

As our goal was to make the cheapest possible robot, motor encoders were right out the window. Luckily, the cheapest way to get motor encoders is actually to take them from old mice. Depending on the mouse there'll be either a break beam sensor and a precisely machined mouse wheel, or a 360 degree potentiometer acting as an encoder for mouse wheel position. These are both great and cheap sensors, but our robot was compact enough that adding in a direct sensor for the motor turning wasn't totally feasible.

Lucky for us, another fantastic piece of technology buried away in mice is the optical encoder that tracks the mouse's actual position. The digital handshake to communication with the mouse is pretty convoluted, but there's a good explanation of how to interface with the mice, as well as all of the reasons why mice are the best cheap sensor packs around here: http://playground.arduino.cc/componentLib/Ps2mouse

For our purpose we want to take the bottom portion of the mouse, use a bandsaw, or other cutting implement to cut away the sides. Then, to make sure that the camera chip is properly optically isolated we want to cover the top in electrical tape. Make sure that the area between the lens and the LED isn't obscured because then your measurements will lose all accuracy.

Additionally, if you have them, now is the time to attach the teflon pad to the bottom of the mouse to ensure smooth travel.

Step 3: Optional: Clean Up the Mouse Connection

Picture of Optional: Clean Up the Mouse Connection

So, one bad thing about mice is that the wire they come with is extremely flimsy. Mine were something like 28 gauge stranded wire, which means breaking, and difficulties plugging anything into an arduino. Luckily, over the course of this project we came up with an awesome solution for this.

Firstly you want to expose the end of the wire and twist the strands together. You then want to run a bead of solder along the stranded core to tin the wire. Once that's done you want to take a piece of solid core wire and solder it in line with the tinned stranded core ends of the mouse cord.

Once the solid core wire is soldered on to the cord wrap the connection up with some heat shrink tubing to make sure it stays like that. Pictures below show a typical PS2 connector, but the wires are exactly the same for a USB mouse.

Note: Important, depending on where you get your mouse the color coding may change. Even worse, most mice use the same four colors (green, blue, white, and orange) though they use them with different conventions. Remember to feel your mouse's chip when you plug it in to make sure nothing is getting hot.

Step 4: Mounting the Motors and Wheels

Picture of Mounting the Motors and Wheels

If you used a laser cutter earlier this part should be pretty trivial. Depending on your exact motor there will be different sizes of screws that are ideal for the proper mounting of your motors. We found that #3 metric screws, and #2.5 standard screws worked pretty ideally, but the subtle differences in your exact motors and personal preferences will no doubt influence this.

You should solder leads onto your motors at this point. Since you are starting to close off parts of the swarm bot it will be extremely difficult to solder these leads on later.

Since the motor is only mounted on one side we decided to use a combination of a washer and a lock washer to make sure that the motor would be mounted securely. We later discovered that the lock washer wasn't even needed, and the mounting of the motor was fairly secure without it.

If you a directly mounting the wheel onto the shafts as we did here think very carefully about the diameter and thickness of your spacers. If the diameter is too small the wheel will wobble pretty extremely. While the shafts are not extremely long, consider the length of the particular screws you're using to mount the wheel. You can add smaller spacers to the outside of your wheel to make sure that the screws go an appropriate distance into the shaft without damaging the motor.

Step 5: Mount the Mouse to the Underside of the Robot

Picture of Mount the Mouse to the Underside of the Robot

This part of our process was a little hacked together, but it's something that's very difficult to do in a precise way unless you use some type of CNC device to carve your mice out to the precise shape you'd like. The general idea here is that we'd like the swarm bots to use the mouse as their bottom plate.

It might seem strange to design a robot that has such a large surface directly contacting the ground, but the mouse encoders have to be a very particular distance from the ground or else their accuracy falls dramatically. Placing a teflon pad on the front of the mouse away from the actual encoder is a reasonable alteration, but it's near the limit of what the encoders can robustly take.

There are a few important points here. Firstly the distance between the motors should be just about the width of a 9V battery. This makes an extremely convenient placement location for what would otherwise be a very difficult to place component. Secondly try to keep the vertical overhead of your joints as minimal as possible. You would like to be able to fit your circuitry components within the robot, so maintaining as much clearance as possible is a must.

If you want to be able to accurately detect turning you should place the lens of the encoder as far away from the pivot point of the wheels as possible. You might want to consider actually putting the mouse in backwards, though the swapping of coordinate directions is confusing enough to make that non-ideal.

We used two L-brackets for the back joint sealed with hot glue which worked extremely well. We then made more minimal balsa wood and cardstock brackets in the front, making sure to seal the break of the balsa wood. These braces were all attached using hot glue, though there is probably a better way of attaching them, precision is hard when you didn't design the parts. 

Step 6: Optional: Adding Treads

Picture of Optional: Adding Treads

So, the wheels will work as is, but the mouse encoder isn't exactly the most precise thing in the world, and we certainly don't want to make that problem any worse by having our wheels slip. There are a ton of ways to deal with this problem, and they will all work pretty well. We ended up trying a couple different methods, including buying some grip tape, and running a bead of hot glue around the edge of the wheels has been shown to produce good results.

We used a spongy kind of grip tape this time around that worked absolutely fantastically. We added some hot glue around the edges to make sure that the treads would stay on. Important to make sure there isn't too much slack around the edges or else your path will be way off. 

Step 7: Plugging Everything

Picture of Plugging Everything

So, this instructable is definitely heavily leaning over towards the mechanical side, which is completely intentional. One of my major learning goals for POE was to get away from the software that I had been so entrenched in up until this point and I think this instructable is a nice cherry on top of that. That said, it's not really an explanation of how to build a swarm bot unless we also explain the circuitry.

Below you should see a fritzing diagram of how exactly to connect up all the components. The chip with seven leads coming out of it is the nRF24 chip, and the chip with only three leads is the mouse encoder. The mouse encoder will vary from mouse to mouse so the only way to get that one figured out is by guess and check. The mouse should turn on, the led should then get dim, when you move the mouse it should get bright again, and the camera chip shouldn't get hot. Also something should come out over Serial. If all of those criteria are fulfilled your mouse is hooked up correctly.

As far as software goes, both on the electrical side and on the twitter to master computer side there are a few great resources that should be able to help you out:
http://playground.arduino.cc/componentLib/Ps2mouse (for the mouse, same as before)
http://maniacbug.wordpress.com/2011/11/02/getting-started-rf24/ (use to hook it up, but maniac bug's library is extremely spotty)
http://playground.arduino.cc/InterfacingWithHardware/Nrf24L01 (the radio library we switched to that solved our problems)
https://github.com/WestfW/OptiLoader (For efficiently bootloading your own chips, if they're 328's and not 328P's)

https://github.com/SwarmBots?source=c (All the code that was actually used for the project, though the documentation could be better)

Step 8: Mass Produce and Celebrate

Picture of Mass Produce and Celebrate

In theory, if you've gotten this far is should be pretty easy to replicate the process, build a bunch of little robots! In theory the nRF chips should be able to simultaneously command several dozen of these little guys, and as you build more you will definitely learn a thing or two about improving your process.

Also, don't forget to celebrate, because when those guys move for the first time it's really exciting.

Comments

RamyaV (author)2015-07-09

im interested in the bot.can u send the program and algorithm to ramyar2208@gmail.com

hemendraB (author)2013-10-05

can I get ur contact details on fb.?

hemendraB (author)2013-10-05

can u post the working of ur project? a video or anything.

hemendraB (author)2013-08-12

which arduino board you used? also are there any other options available for arduino board which offers great functionality at cheaper rate for swarm robotics

In the picture above to cut down on debugging I used the Arduino Uno, but in actually making a number of these I would suggest cutting out the whole board, since it's kind of overkill.

If you want something similar to an Arduino board for swarm robotics I would suggest going with the ATMEGA328P-PU. You can get those for about $3.

starwing123 (author)2013-07-15

Looks great! Do you have a number of how much each robot costs?

With the Arduino not included these were $17 a piece. That said, we overpayed for the plastic, so I imagine it's possible to do somewhere around $15. If you want to use an ATMEGA328P-PU by itself it would be another $3 for the microcontroller, if you used a full Arduino it would probably be $20-$25 for the Arduino.