Introduction: BristleSwarm: Explorations Into Swarm Robotics

A growing branch of robotics research is the study of swarm organization, emergent behavior and artificial intelligence through the use of autonomous robotic agents. In this Instructable, I'm going to walk you through a one week project that I created as part of my Masters Architecture studies at the California College of Arts in collaboration with Prerna Auplish. The studio, run by Jason Kelly Johnson and Michael Shiloh, leveraged robotics and digital fabrication as a method to explore the relationship between architects and the tools they use. Our goal was to create a drawing machine with a swarm of robots in as little time as possible and with a fairly limited understanding of electronics and robotics. Oh, and also with not too much money! This project was the inspiration and jump off point for the Swarmscapers project, which has also been published as an Instructable.

In the course of that week long exploration we were able to barely scratch the surface of swarm behavior, and opened up a . In order to more fully explore the potential of these little guys, we're releasing them into the wild to see what other behaviors the Instructables community can discover!

This Instructable will teach you some basics about how to work with robotics, how to program and work with arduino and we'll also play around with the grasshopper plugin Firefly created by Jason Kelly Johnson and Andy Payne. So, click on through and we'll get started!

Step 1: Why Swarms?

But before we get too far ahead of ourselves, let's spend some time talking about swarms. What's so cool about a swarm that makes it worth studying? I'm glad you asked!

Swarms are all around us. You and I are both members of a swarm. We are constituted of an enormous swarm of brain synapses that never stop firing. Steven Johnson argues in his book Emergence, that cities can be understood as the resultant emergent behavior of a swarm. It might be easier to answer what isn't a swarm. Swarms are capable of making very smart decisions but are comprised of drones who aren't even aware that this high level thinking and computation is going on. How does this happen? When we talk about swarms, we usually imagine a flock of birds (or BOIDS) or maybe a swarm of bees. That's because the easiest swarm behavior to visualize is how a swarm moves together, sometimes called flocking. We're actually very good at understanding this particular type of swarm behavior. There are many mathematical models that accurately simulate this phenomenon, which is pretty cool! The highly coordinated behavior of a flock of birds can be described with a few very simple rules:

  1. Separation: Make sure you don't get to close to any of your friends.
  2. Alignment: Try to be going in the same direction as the guys next to you.
  3. Cohesion: Fly towards where you see everyone else is.

Outside of those few rules, there's no other type of coordination happening, so the individual agents are really quite simple, but together are capable of doing some cool stuff.

But the robot we're going to build isn't even going to be that smart... yet. We're going to build a bristle bot that will act as a Braitenburg vehicle and simulate the behavior of a BOID swarm with an attractor (ie a flashlight). So enough talk, let's get to work.

Step 2: The Shopping List

First up, we're going to have to pick up some supplies and get access to some tools. I'll walk you through the specific way I decided to put my robots together, but the basic principles are easily transferable to different designs. The core mechanism of a steerable bristlebot is to have two vibrating DC motors attached directly to two forward leaning bristles. Under compression, the bristles make the robot fall forward and then bounce straight back up, causing forward motion. The reason we originally decided on bristles as a platform is that they're mechanically simple and easy to assemble. If you're going to build a swarm of something, keeping things simple works in your favor.

With that in mind, here's the list of parts that I used to get my swarm rolling. I'm a fan of as a source for supplies due to their support and the wonderful tutorials that are linked to their products, but many of the items I'll be linking are available all over and probably for cheaper prices.


1. Soldering Iron

If you've read this much, you probably already have a soldering iron. If not, consider investing in one. They're fairly affordable and enable you to sculpt the path of electrons to suit your ends, which is literally what wizards do.

2. 3D Printer or Laser Cutter

If you've got access to a laser cutter, you can use the attached .dwg to cut out the chassis. If you've got access 3D printer, you can use the attached .stl to print out a body. If you don't have access to either of those, you can design your own, which may be the best option.


1. Vibrating DC Motors (2x each)

You've got two options here. You can buy cheap DC motors and make your own with some wire, a bit of epoxy and a small weight, or you can buy a pre-made weighted motor instead. The major downside to the cheap DC's are that the contact that you solder to are inevitably the cheapest part and will fail after very little fatigue. The nice part is that they're less than $2 a piece!

2. Microcontroller (1x each)

You can use basically any arduino you want to. I decided to go with Adafruit's 5V Trinket as my controller, because they're small, cheap and it has just enough pins for what I wanted to do.

3. Prototyping Boards (1x each)

One downside of making a robot that relies of vibration to run is that it means it's going to constantly trying to shake itself to death every time you turn it on. That means a solderless breadboard isn't going to do us any favors. I'm a big fan of Adafruit's perma-proto boards. These quarter sized ones are just big enough for what we're trying to do.

4. Electronics

PN2222 Transistors (2x each) - These will allow us to control the speed of our motors so we can steer

1N4001 Diode (2x each) - Needed to get the transistor circuits to work.

Resistors (5x each) - I used 560 Ohm resistors, but these 330's should work too.

CdS photoresistor (2x each) - These will be the sensor suite of our robots.

On/Off Switch (1x each) - Much easier than tearing the battery out.

Female Header Pins (1/2x each) - Used for mounting your trinket to the breadboard.

Solid & Stranded Core Wire - 22 AWG, make sure you've got a few colors to keep things straight.

LED's, Multiple Colors (1x different color each) These will be used for our vision tracking system.

5. Power Supply (1x each)

Okay, so you've got two options for your power supply. You can either use a 9V battery holder and matching barrel jack or you can get fancy and get yourself a lithium polymer battery and charger that you can integrate with your circuitry.

6. Bristles (2x each)

I found the bristles I used at the local Ace hardware here in San Francisco, but you can use any type of toothbrush or cleaning brush you find, as long as they're symmetrical. Important: the bristles have to lean in the direction of travel in order to operate as we need them to. You'll probably have to modify them to get the desired effect, so be prepared to experiment.

7. A Chassis

This can be as complicated or as simple as you'd like it to be. The first bots I made were just hot glued to a sheet of acrylic and it worked just fine. The later versions were laser cut acrylic from the attached cutfile. I've also got a 3D printable chassis that you can use if you like. The chassis can give your little swarm bots some character, so have fun on this one!

Step 3: Assembly

To assemble your robot, you'll have to solder all these parts onto a board and assemble the chassis, then stick it all together and you'll have yourself a functional BristleSwarm. So, ladies and gentlemen, start your soldering irons. I'm going to assume you have some basic knowledge of how to solder and lay out a board. If you don't, there's quite a few guides right here on Instructablesthat'll help you out.

1. Circuit:

Take a look at the attached schematic and the close up photo of the finished board for reference. To simplify , it's two transistors, each controlling a DC motor, two photocells, and an LED for tracking. Here's a great tutorial on Adafruit that explains the basics of using PN2222's to control a DC motor, and here's another one on photocells. I squeeze it all in on a trinket, but you can use whichever controller you like.

2. The Chassis:

For the chassis design, just make sure you've got your bristles separated and each motor is mounted pretty close to each bristle. Beyond that, you can get as fancy or as simple as you like. My first prototype was quite literally a piece of spare acrylic and some hot glue, which then got stripped down and cut up for the second prototype. Now I've got a 3D printable body that's simple to mass produce and works with all the components that I'm using now.

Lasercut Chassis: Take a look at the images above. I assembled this one with small zip ties and hot glue. I can't recommend the hot glue attachments, but they get the job done and are easily repairable. Whatever you use as a fixer, make sure it's durable. The locomotion method this platform uses is based off of nonstop shaking, so every joint will be constantly fatigued. That's why I designed the next chassis

3D Printed Chassis: Just print this guy out, shove the motors in the holes and assemble the circuit board mount on top. Zip tie the whole thing to the main body and you're ready to roll... or shake.

Step 4: Programming

Now that our research platform is assembled, now we get to begin to decide how our swarm is going to behave. If you haven't already, take a look at this link on Braitenberg vehicles, or some of Braitenberg's writing on the subject. In short, a Braitenberg vehicle is a light sensitive robot that's behavior implies will. By being attracted or repelled by light and also attaching a light to the top of our robots, we can get our swarm to interact. But in order to do that we'll need to program some behaviors in arduino.

1. bristleTHINKER

This is a basic behavior that I use as the example in the vision tracking segment. In this definition, the robot will go right if it's bright out, and left if it's dark. After a second of this behavior, it then goes straight for two seconds. This behavior makes it look like they're always "thinking" about what to do next, hence the name "bristleTHINKER".

2. bristleSEEKER

This definition is actual braitenberg behavior. It requires that your photocells be mounted on the outside of your robot, pointed left and right. Take a look at the file and the comments for a walkthrough of how it works.

Step 5: Vision Tracking - Rhino/Grasshopper/Firefly

Now that we've got our robots assembled and coded, we've got to figure out how to record the data we get from our swarm. Attached above is a PDF of the output that I recorded from my early experiments and a copy of the script I used to record the data. There's two different routes you can take in order to capture this information, the digital way (with rhino/grasshopper/firefly and a kinect) , and the analog way (with a camera and some lights).

1. Firefly

First you'll need to get yourself a copy of Rhino 5 from McNeel. Then you'll need two plugins, Grasshopper and Firefly. Once you've got all that running, plug in your kinect, or really any webcam that you can target with firefly, and point it down at all your drones while running the script. Hit the record button on the script, and begin recording data. The attached pdf is data I recorded from the first few rounds of experiments.

2. Photographic

If you don't have a copy of Rhino and don't feel like jumping through all those digital hoops, we've got another method you can use. Our robots each have an individual color coding, which allows them to be differentiated by the grasshopper script. We can also just capture this information directly with a camera and a dark room. Just get a tripod, a camera with a long exposure, setup the robots and turn the lights off!

Step 6: Final Output

If you've made it this far, you're now ready to step back and take a look at your results. In what way can the code on your drones be changed to discover emergent behaviors? Try experimenting with different Braitenberg behaviors and readjusting the position of sensors, of the LEDs and different lighting inputs to tease out new behaviors. Thanks for joining me through this Instructable, and happy making!


RamyaV (author)2015-07-11

Hi claytonM4,can u please send the program of this bot to my looking forward to do one

jsawyer13 (author)2015-07-09

Thanks for the update!

RamyaV (author)2015-07-09

im interested in the bot.can u send the program and algorithm to

ClaytonM4 (author)RamyaV2015-07-09

Hi RamyaV. You'll find the code for these little guys on page four of this instructable. Just let me know if you can't find it of if the link isn't working.

RamyaV (author)ClaytonM42015-07-09

I cant open it.Can u send it to my mail id

RamyaV (author)RamyaV2015-07-09

jsawyer13 (author)2015-02-21

I'd love to see video of this. Im an engineering student working with a senior design team. Our software devs are working on ai interaction between several robots were developing. We're trying to understand whether a master/slave setup is better or having each bot order its own tasks to work toward a common goal. Swarm bots are so amazing in the possibilities as our understanding of the dynamics and ability to digitally replicate them evolve.

ClaytonM4 (author)jsawyer132015-07-09

Yeah the potential within swarm robotics is pretty insane. I've just finished a new improved version of these robots and I'm working on documenting them right now. I'll let you know when I've got a video up!

kbossthegreat (author)jsawyer132015-04-08

Instead of a master/slave or individualized set, Why not work on s "hierarchy" for the robots? My friends and I are making something like it, though it is very tedious. Each robot (20 of them) was assigned specific tasks, though there were "classes", such as Lv1, Lv2, you get the idea. Anyway, lower classes would trace out paths, higher classes would draw with varying patterns and colors, and the highest class "alpha" would skim the path to verify completion, though all Lv2 classes have Lv1 task capability, Lv4 have Lv1-4 ca[ability, etc. just a thought, though a long one.

About This Instructable




More by cmuhleman:Concrete 3D Printer "Glider" Balance BikeBristleSwarm: Explorations into Swarm Robotics
Add instructable to: