Instructables
Picture of Arduino Nano based Microbot
docked.jpg
This instructable was created to be entered in the Robot Challenge. If I win, the parts will of course, go into robots like this one. Notes on how to include some of the very components in the prize packages are given in the last step. I am 28, so of course, I'm not going for the student prizes.

I created this as a simple project for those just starting out in robotics. It is relatively inexpensive, requires minimal tools and is easy to build. Once finished you have an expandable robotic platform that fits in the palm of your hand and can be easily programmed in the Arduino environment.

Here is is driving in a triangle, without any special add ons


In the instructions I'll walk you through how to:
  1. Modify the servos for continuous rotation
  2. Fit the track hubs on to the servos
  3. Make a custom battery pack
  4. Wire it with a few connections
  5. Assemble it
  6. Program it
  7. Customize
These and other additions can be mixed to make your own custom micro robot

For the basic platform the following supplies are needed:
an Arduino nano
a small rechargeable battery
a pair of 9 g servos, modified for continuous rotation
part of a Tamiya track set
a 40 pin dip socket
a rubber eraser
some zip ties
 
Remove these adsRemove these ads by Signing Up

Step 1: Construction: Modify the servos

Picture of Construction: Modify the servos
servo-placement.jpg
servo-resisitors.jpg
servo-potBreaking.jpg
servoCutout.jpg
Micro servos modified for continuous rotation are the heart of this design. They give you so much of the hardware; the motors, the gearbox, the driver and control circuitry, all in a tiny cheap package, and in this implementation they also act as the frame of the robot (seen in the next step). There are many instructables on modifying servos for continuous rotation. But here is how I did it for the micro 9g servos I am using.

Pictures:
  1. Remove the tiny screws and open the case
  2. Cut the potentiometer wires, these are where you will attach the resistors
  3. If you have surface mount resistors, place a 5k (1k to 10k should work) on the pad from each of the side pads to the middle pad, if you don't twist a pair of through hole resistors like this
  4. Break out the stop on the potentiometer with some small pliers, you need the pot for its use as a rotational bearing
  5. solder on the resistors, if you used the pair of through hole ones, I recommend bundling them in electrical tape like so. For the servo that will go on the front, cut a notch for the wire to exit through the side so it doesn't come from under the robot.
  6. (not shown) Before you close up, put a hole in the back part of the case opposite the spline to mount the idler (wheel with no teeth).
  7. Use some angle cutters or pliers to remove any mounting flanges from the cases and file or sand down the ridges they leave, these can get in the way later.

Step 2: Construction: Drill the hubs to size

Picture of Construction: Drill the hubs to size
hubsMounted.jpg
  1. Cut the stems on the hubs so that they just stick past the inner edge of the tracks when installed. This can be done with a hobby knife saw or a coping saw. Be careful you don't slash your hand! For safety I held the hub on a cutting board on its side with my fingers on the other side of the wheel from the stem, and then I rotated it against the cutting board dragging the knife along it, this way if you slip you just hack the board.
  2. Drill the hole for the bolt that will hold it on to the servo in the cap of the drive wheel (the wheels with teeth). You may be using the hub screw that came with the servo. Whatever screw you use that fits in the servo spline, drill the hole to fit.
  3. Since the small Tamiya hubs don't fit on the servo ends, you'll need to drill them to size. Since these are small and already have holes you don't need a drill press, but you will need something to clamp it down. Servos vary in spline size, so I can't give you an exact size to use. I would suggest you go a bit small, and step it up until the hub fits tightly, these will be transmitting the torque. You also must be careful with depth so the hubs don't rub against the servo body. Measure your servo spline and make the dept of the mounting hole just slightly less than this. I suggest the method of putting masking tape around your drill bit at the depth you want to stop. Then you can hold it next to the servo spline before you drill to confirm it is slightly less.
  4. To install the hubs, the idler should be attached using one of the screws from the Tamiya kit, or another screw of the right length, I got mine from my random hardware jar, and don't have a specific size. Tighten it just enough that it doesn't pinch the wheel down.
  5. On the other side, use one of the screws that comes with the servos through the hole in the driver wheel to snug it down.





Step 3: Construction: Make the battery pack

Any battery which fits on the chassis would work

I went with NiCd because I had some old cordless phone batteries with 1/3 AAA cells in them that I could make into the roughly 5 V packs I needed. Each cell is 1.2, so I used 4 to get 4.8 v. They also don't require special circuitry to charge.

If you can get a LiPoly and a charger, like the kind they sell on ebay for syma 107 helicopters I think that would work well too.

The photos explain how I did this better than words can:
  1. Picture of the battery as is, I had more than one of these
  2. Remove the shrink wrap
  3. Cut them apart where needed, so they can fold into shape.
  4. Put the 4th cell, taken from another pack in place
  5. Fold it in to shape
  6. Wrap it up in electrical tape
  7. Picture how it fits on the chassis
For this battery the easiest charging method is to connect gator clips to the outputs of a 1.5-9V NiCd charger, and to the leads of the battery. See the wiring diagram in step 4 for how this can be accomplished when assembled.

Step 4: Construction: Connect the wires to the socket

Picture of Construction: Connect the wires to the socket
08801-03-L.jpg
A socket is used to mount the Arduino Nano to the robot, besides making the Arduino removable so that it can be used for other projects, this simplifies attachment to the rest of the machine. Alternatively you could buy a small breadboard for $4 (as shown in the second picture below from sparkfun.com) and zip tie it to the top in a similar way for more modular design.

In my case I wired the servos into D11 and D10, but you could use any of the PWM outputs, as shown in the first picture below. I then wired the battery to a free pin on the socket in between pins that I wired to the power for the arduino (Vin) and the servos, so that I could switch them on and off with jumpers. I smashed the legs of the socket outward so they are easy to access for expansions. Notice that this  placement also makes the USB connection and reset buttons easily accessible, at the end of the robot.

To charge the battery, power can be applied by putting the jumpers in the off position (stored on the other side of the socket) and plugging charging leads into battery +, and ground. Again, for this battery the easiest charging method is to connect gator clips to the outputs of a 1.5-9V NiCd charger. If you are using a different type of battery charge accordingly.


Step 5: Construction: Assemble the microbot

Here is where the eraser comes in. If you have the assembled servo/wheel sets from step 2, you can put the belts on them with the servo that has a wire coming from the side upright and the other laying with its long end pointed toward the upright one, as shown in the fist picture. Pull them to light tension, so the belts are nearly flat but not taught, and measure the gap between the servos. Cut a section of eraser to wedge in this gap. This works like suspension, allowing the frame some flexibility while holding it in place under most forces it will encounter. It's the white part in the picture.

The battery fits in the crook between the upright and flat servos and the socket sits on top (second picture). Make sure the sockets legs are smashed outward for easy access. Then use one or two zip ties to strap the whole thing together, be sure the buckle is on the front or back, not underneath or above the socket, you don't want it to get in the way of ground clearance or plugging in the Arduino. If you are using the mini-breadboard variant, you may need to file the middle channel a bit deeper for the zip tie to set in.

Finally, plug in that Arduino (third picture), you can make the jumpers by simply bending some stripped wire with pliers.

Step 6: Programming: Basic operation

Picture of Programming: Basic operation
This is built with an Arduino so that you can program it to do whatever you like. Here are the basics. Further expansions are covered next. To test things out you can upload the code and move the jumpers both to the on position.

Really, the basic code to build on is just this:



//---------------------------Start Code

#include <Servo.h>//Loads commands to create Servo objects which generate PWM signals

Servo leftDrive;  // create servo object to control a servo
Servo rightDrive; //another servo object for the left side

void setup()
{
  leftDrive.attach(11);  // attaches the servo on pin 9 to the servo object
  rightDrive.attach(10);  // attaches the servo on pin 9 to the servo object
}

void loop()
{
  //here put commands which drive the servos 
  //use the commands
  //rightDrive.write(any number 0-180);
  //leftDrive.write(any number 0 to 180);
  //to set the servos turning 0 is full one way, 180 is full the other, 90 should be near stop
  //which way is forward depends on your servos
}

//end code -------------------------------------


So that gives you an idea how simple this can be.
Here is a basic code example for just driving around in a square. Note that the video was with the delays set to 600, which resulted in a triangle, 450 gives you more of a square. (code starts after this line):

//------------------------------------------------------------------------------------------

#include <Servo.h>//Loads commands to create Servo objects which generate PWM signals

Servo leftDrive;  // create servo object to control a servo
Servo rightDrive; //another servo object for the left side

int pos = 0;    // variable to store the servo position

void setup()
{
  leftDrive.attach(11);  // attaches the servo on pin 9 to the servo object
  rightDrive.attach(10);  // attaches the servo on pin 9 to the servo object
}

void loop()
{

//example routine, drives in a square
turnRight();
driveForward();
turnRight();
driveForward();
turnRight();
driveForward();
turnRight();
driveForward();

}


//the following functions are examples, you could easily make the robot
//move on curved paths or at varying speeds by changing these numbers
//0 is full forward, 90 is stop and 180 is full reverse. The case may be the
//opposite for your build

//turns right about 90 degrees
void turnRight()
{
  leftDrive.write(0);
  rightDrive.write(180);
  delay(450);
}

//turns left about 90 degrees
void turnLeft()
{
  leftDrive.write(180);
  rightDrive.write(0);
  delay(450);
}

//drives straight for 1 second
void driveForward()
{
  leftDrive.write(180);
  rightDrive.write(180);
  delay(1000);
}

//drives straight backward for 1 second
void driveBackward()
{
  leftDrive.write(0);
  rightDrive.write(0);
  delay(1000);
}

//end code---------------------------------------------


So, the point of this is to be a platform. Making a robot just drive about can be fun, but the most fun is always making your own things. Since this is an arduino there is example code to add all kinds of controls, devices and sensors to customize your bot.

Step 7: Customize it

Picture of Customize it
The idea I'm sharing here is how I made a compact simple to control robotic platform. I feel that showing you what to do with it exactly would not have much of a point, you can do whatever you like with it. 

That said, I'll make some suggestions of how you could expand this robot without reinventing the wheel. Other Instructables are suggested to get into the low level details of these features, and links are provided to buy them where available. I didn't make these Instructables, but they will integrate nicely, that's the great thing about an online community after all:

Gripper
The easiest way to add a gripper is with another micro servo, one that isn't modified for continuous rotation. You would add its control to code simply by attaching another servo, and giving it a position command, as seen in step 6.

Here is an example which would fit right on:
http://www.instructables.com/id/How-to-make-a-robot-gripper/

The same method could be used to add a scoop or other manipulator as well.

If you want to just buy one, something like this would work nicely:
Jameco 1.3 inch gripper

Radio Control

A fun thing to add to any robot, there are piles of tutorials on how to do this with an Arduino. 

You can do it with blue-tooth (easy but expensive)
http://www.instructables.com/id/how-to-Control-arduino-by-bluetooth-from-PC-pock/

Or you could use an XBee (easy, and less expensive)
Since the XBee is wider than the Arduino nano, and can't plug into it, I would actually suggest setting it over the nano and wiring it in around it.
Examples of the code needed are widely availible, heres an XBee library for arduino.
Of course, you could get an XBee/Arduino nano board, like this one from robotshop, and your robot would have a swanky tail.

You can do it with a bare transmitter receiver (cheapest, but requires knowing what you are doing):
http://www.robotshop.com/productinfo.aspx?pc=RB-Ons-02&lang=en-US

Detect movement (PIR)

This is actually remarkably easy, a PIR sensor compares the infrared map of its environment with one it has built over time. So it detects changes. They can be found for $10 at several stores including sparkfun and robotshop

These have everything integrated, and the output pin goes high for a few seconds when motion is detected. All you do is give it power from the battery and connect the output to an input pin on the Arduino. Then set an interrupt or check the state of the pin. As seen on the customization of the platform above. This lets your robot react when someone approaches.

Ultrasonic Range finding

Ultrasonic range finders are an inexpensive way detect the distance in one direction with decent reliability in the range of about 0.1 to 10  meters. They tick out ultrasonic pulses at about 10Hz and detect how long they take to return. Most pick up obstacles in a conical span, so they can be fooled by things that aren't really in the way. It's no LADAR or computer vision, but it costs 1/1000 as much.

This is also on the robot customization shown here. I used an HC-SR04 range finder and this library. I just got that from ebay for $6.

There is also support for the PING range finder: http://arduino.cc/en/Tutorial/Ping
And even if you use the cheaper one I used, this may help you understand how it works

GPS

If you want to give your robot a sense of its/his/her place in the world, there is example code to use a parallax GPS module on Arduino Playground here.

Future Steps

I'm planning a few fun projects with these. One will be to add wireless cameras, remote control, and little grippers, and then make tiny obstacle courses for them to explore in teams.

Another fun project would be to mount a Kinect on the roof and make a bunch of these with wireless act as a swarm in formation.

In general I'm going to use these as a basis for lots of projects, and I will be going into more detail about possible add-ons in that way. I would be very pleased to see this used in other Instructables and expanded. After all, sometimes you want to use a robot, but don't want to write about developing the basic stuff.
1-40 of 74Next »
AndyGadget2 years ago

Really, really neat!
It's hard to make a narrow robot when you're using continuous rotation servos because of the gearbox height, but you've overcome this with the tracks and the asymmetric mounting method.
Just to clarify, you've drilled a hole for the idler pinion in the servo bottom cover in line with the spindle?  Must have been pretty tight in there - the boards in those 9g servos don't leave a lot of room.
PaulMakesThings (author)  AndyGadget2 years ago
To mount the idler I did it just as you said, its screwed into a hole drilled on the back cover opposite the spindle. I had to be sure not to put the screw in too deep so it wouldn't hit the board, but in the ones I was using the board was slanted so it wasn't too near the back wall at that point. I've noticed with these cheap ones it isn't always the same slant, but on the ones where they installed it so that the near side is on the end I want to mount the wheel to I just tilt it the other way before I put it back in when I do the modification.
MaxXDyesterday

Can you do it with the raspberry pi?

Robobeard1 year ago
Hi, I tried making the robot but I'm trying to find out what's the battery is for. I'm new at this so some things are confusing.
PaulMakesThings (author)  Robobeard23 days ago

I didn't see this comment. It got buried. According to the arduino Nano datasheet it prefers 7 to 12 volts. So if you can't find the type of battery I used a 9V should do it, or an 11.1 lithium battery (which would need a special charger), or any other battery pack that will get you a voltage in that range.

It's my dream to learn this sort of stuff. Where did you learn programming language? What's this things top speed?
PaulMakesThings (author)  trans4mation23 days ago

That's it's top speed in the video. Maybe 1/2 m/s, I would guess. That depends on the servos and drive wheels you use.

That is one sleek-lookin' robot! Great job.

Thanks!

lkrewson5 months ago
is there a way to do this with arduino uno
PaulMakesThings (author)  lkrewson23 days ago

The robot could certainly carry one, and the servo library works on uno as well (it was actually on uno first) so if you wire the power and servo signals to an uno there is no reason it shouldn't work.

apinnette24 months ago
How much does this cost in total
PaulMakesThings (author)  apinnette227 days ago

If you get cheapo parts on ebay*. about $30

*I haven't used these particular parts, they may be crappy

$5.50 for the micro servos [for example ]

$5 for the nano [ebay]

$10 for the tracks [ebay] though I would reccomend making your own, since you don't need the whole kit, and I just had the small wheels left over. For example you could use plastic bottle caps and silicon bracelets.

I salvaged the battery, but if you can't find an old cell phone battery something like this would do: $2 [USB li-po charger] $6 [tiny single cell li-po battery] convieniently, this is already the right voltage to run the arduino nano. One could easily add jumpers to make it charge while hooked up to program.

Raphango4 months ago

Great! Congratulations!

samern8 months ago

Hi Paul,

I found myself with a lot of bits and pieces lying around and like you decided to make something out of them. It turns out I have an Arduino Nano, a Tank Gearbox from Tamiya (the sort that takes 2 ordinary motors to allow for tank type driving), a PING sensor and some tracks and wheels. So I cobbled together a bot using this gearbox and it actually looks great. My question is about controlling the motors using the Nano vs a pair of servos. As I understand it, I would need a NPN Transistor, a resistor and a diode for each motor (say one hooked up to D9 and one to D10 on the Nano as you have). Would you say that this is a viable approach (I'm more ME than EE so I have to ask)? I can then connect the PING to D11 or any other PWM pin and change the code to interrogate the sensor every few rotations.

Does that sound about right?

Thanks,

Samer

am7 samern6 months ago

use an H-bridge motor driver
it ll wrk fine

PaulMakesThings (author)  samern8 months ago

That approach would work, but you could only turn in one direction. If that is ok then yes. For a simpler approach, check out the L293D, it contains 2 H-bridges and can drive two motors both directions . It can be gotten for 1.25+$5 S&H at sites such as this (https://www.taydaelectronics.com/catalogsearch/res...

And if you search on google for Arduino L293 you will find a wide array of diagrams on how to connect it, and code examples of how to use it, because it is a very common chip.

It handles about 0.6A per channel, and comes in a DIP package. If you need more there are several other "Push pull" or two channel H bridge chips, including the L298n.

If there is any confusion about how to use it just ask. Like I said theres a ton of example code and diagrams out there.

Excellent, thank you!
pucksurfer8 months ago
Couldn't you just use a regular motor instead of a servo. It might bring the price down. And the code
Would just change a little bit
PaulMakesThings (author)  pucksurfer8 months ago
Yes that would work, if you want to get one with a tiny gearbox and add a little motor driver circuit, which wouldn't be too difficult. I haven't found tiny gear motors with enough reduction and motor drivers that can be gotten for less than $2 a set.

May i ask you where i can find these wheels and belts ? :)

PaulMakesThings (author)  νχαβιάς9 months ago

These are from a set, Tamiya TAMX8001 70100 Track & Wheel Set. Though you will get a lot of extra parts that way. I actually had these left over after I made a bigger set from that kit.

Oh thank you :)

I want to make one of these RC with a camera. Any ideas?
lumi30051 year ago
I am loving it. I like micro bots very much, especially this one since it's really down to the basics and still looks cute, cool and advanced at the same time.
rezdog1 year ago
Hi, I'm relatively new, I was considering putting a small camera on it and then connecting it to a ps3 controller. Any ideas how?
Also would it be possible to waterproof it?
PaulMakesThings (author)  rezdog1 year ago
That's an interesting question, I looked in to it and waterproof 9g servos can be gotten on ebay for about $15 each or retail for about $23. That might be a bit too expensive considering the whole thing is about $20 normally. I saw some tutorials on waterproofing servos, so maybe that could work. As for the board and battery, I would either pot them (see 'potting circuit boards), or if you still want to be able to make changes, I'd try a pill bottle and seal around the wires with silicon. If you didn't mind some cleanup when making changes you could fill the pill bottle with vegetable oil to help keep water out. When I worked on an underwater robot we sometimes filled cases with petroleum jelly, it's viscosity works even better, but cleanup is a lot worse. Practically though, I would just epoxy coat the circuit board and battery except for the contacts, then put in in a pill bottle, if it gets a little wet it would still be salvageable.
jpalita1 year ago
I'm a beginner in this so how do I put 2 wheels in 1 servo

and is there an alternative wheel besides tamiya?
PaulMakesThings (author)  jpalita1 year ago
I just used a screw that fit inside the axle closely and drilled a hole in the back of the servo case. It's fairly malleable plastic, it will tread in.

For alternatives I've looked at those silicon wrist bands for the tracks, and plastic bobbin spools with several rubber bands wrapped around them to build up the middle for the rollers. The materials for that will cost you a few dollars, and can often be found for free. Another thing I've tried for the wheels is plastic soda bottle caps with large washers glued on them for flanges.
Nice robot, you did great job!
Ploopy1 year ago
Could you use a chip like ATtiny 85 for this?
Instead of a ardino mini.
Great ROBOT, great instructable!
Here is my version.
PaulMakesThings (author)  crisiinvolo1 year ago
Very cool. There has been so much interest in this project. I really should update it.
they look awesome!!!! 8=D
That is so cool!!!!!!! You are very SMART =O
spystealth12 years ago
This is awesome, but you might want to do something so people know it's not a variation of instructable member "joe"'s tank wars 'ible. Also, you could add some arduino nano shields for added functionality, or maybe a flashlight or railgun.
How exactly do you plan to put a railgun on a 2 inch wide robot?
PaulMakesThings (author)  mgingerich2 years ago
You make a small railgun. Actually this is a good question, I'll see what I can do.
When will it be done?
PaulMakesThings (author)  oldmechanic2 years ago
I'm a full time robotic engineer, you have to give me some time on this stuff.
1-40 of 74Next »