Introduction: Arduino Nano Based Microbot

Picture of Arduino Nano Based Microbot
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

Step 1: Construction: Modify the Servos

Picture of Construction: Modify the Servos
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.

  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
  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

Picture of 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

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 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

Picture of 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


//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()

//turns left about 90 degrees
void turnLeft()

//drives straight for 1 second
void driveForward()

//drives straight backward for 1 second
void driveBackward()

//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:

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:

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)

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):

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:
And even if you use the cheaper one I used, this may help you understand how it works


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.


AndyGadget (author)2012-05-16

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.

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.

but why won't the servos receive signal

I guess I should have mentioned, you can move the servo connection and then change the pin that is being used for PWM in your code. Check the schematic for your given Arduino to find out which pins support PWM.

According to this, the Nano Board can PWM 6 pins, they are 3,5,6,9,10,11. There are also libraries like this one that let you run a servo on any output pin:

vishalsa (author)2017-11-12


PaulMakesThings (author)vishalsa2017-11-13

If this is meant as a question could you be more specific?

lunacava made it! (author)2017-08-05

I just got started to make this robot!

It is not wired or anything, but It going to be looks like this if its done... i can't wait !!

lunacava made it! (author)lunacava2017-08-20

I made this Customized Robot with Ultrasonic sensor.

It uses 3.7v 800mAh Lipo buttery up converted to 5v. Small buttery fits on top of small servo.

wires are not cleaned yet.

but, very adorable.

PaulMakesThings (author)lunacava2017-08-20

I love it! I happen to be working on a rev 2 of this project with lipo as well. I like that you included the breadboard too.

srijan sehdev (author)2017-06-21

can a l9110 motor driver be used with this project

Sure, it will be very similar to using an L298 or L293 as shown here

So it ends up being a whole different project. The reason for using these little servos is that you get the controller, driver, motor and gearbox all in one package. If you are using these drivers you can (and must) use a DC motor rather than a servo.

If you have your own motors and a way to drive tracks with them (usually a gearbox and other mechanical details) then the I9110 looks like it will work fine. It says it has 800 mA per channel, which is more than the L293D many people use (500 mA if I recall correctly). But you will need two since it appears to be just one channel.

See my lego robot tutorial for an example of using the L298N to drive DC motors on a similar tank drive robot. Although that is with a PIC microcontroller and is commanded by an RC remote receiver.


Voltrex085 (author)2017-06-23

So if you wanted to turn this robot into an autonomous one as you suggested, what Arduino program/code would you use for it?

srijan sehdev (author)2017-05-24

#include <nano tank>

int rSpeed=0;

int lspeed=0;

Servo rightservo;

Servo leftservo;

void setup(){

Serial begin(9600);






void loop (){



switch(command)//these are the letters and numbers that app sends to the bluetooth module













rightservo.write(90);//if disconnect turn motors off





void forward()//define what is forward





void back()//define what is backward





void left()//define what is left





void right()//define what is right





void stop()//define what is stop





are these codes correct?

TrevorB23 (author)2017-04-02

Bought a ton of sensors. Not sure what capabilities the Iron Midget will get, but i am pretty sure he is going to drag a trailer full of the guts of a laser tag gun like an artillery piece.

I like it! It's cool to see another one built. After 5 years and so many views, I'm considering an update. Maybe remote control and a camera. Also it seems like you can buy ready made continuous micro servos now, and maybe I could improve the way the pins are brought out. Back when I made this I was just out of college and now I'm an engineer at SpaceX, I should be able to improve it at least a bit :P

TrevorB23 made it! (author)2017-03-31

I plan to do a couple of things differently so this is just going to be version 1.0. It's actually kind of tricky to get the idler axles to not collapse inward under the tension of the tank treads. So I'm going to glue a donut-shaped axle guide on to the side of the servo to help support the idler wheel and keep axles parallel. Also found a very quick way to modify the servos without any soldering which was very helpful. Also instead of using the pins on the dip socket, the header pins that I needed from the Nano itself were bent outward before placing it in the dip socket that way I could solder onto those pins well away from the Treads instead of right next to them. But yeah I have to make a second robot...great instructable.

srijan sehdev (author)2017-03-13

What if I attach the signal wire to the wrong digital pin???

If you attach the servo signal wire to the wrong pin then the robot will not move. Servos just sit still when they get no signal. The highest voltage on this robot is 5V, so it isn't enough to toast anything no matter how you connect it.

robt33 (author)2016-02-28

what is the hypothesis of this robot

PaulMakesThings (author)robt332016-06-14

I don't understand the question. I suppose if the robot is viewed as an experiment the hypothesis is "I bet I could use these micro servos to make a very simple little tank" and the conclusion was that I could.

robt33 (author)PaulMakesThings2017-02-20

how would i screw in the other wheel on the back side like the one thats not the driver.

PaulMakesThings (author)robt332017-02-20

There's no special trick to that. I just found a screw that was the right size for the idler to spin on and the right length to go through and into the plastic on the other side, but not too far to avoid going into the gears. Then I drilled a small hole in the case and attached the wheel with it.

Prabash (author)2017-01-01

From where you buy this robot chassi?

DuinoMC (author)Prabash2017-02-16

In and if you want continuous rotation servos you can get one for $4.99!!!

EZtechProjects (author)2016-08-25

What types of batteries can I use and what must they have?

What Arduno and servos are you using? The batteries need a voltage that is sufficient for either the regulated or unregulated input on your arduino, and for your servos. And they need to have enough current to power both the servos.

There could be quite a range of current on the servo, a 9g servo could draw 200-300 mA free running, and up to 700 mA when stalled, maybe a bit more. Without the motor torque constant (Kt) or velocity constant (Kv), or any info about your build I can only guess. Mine draws about 420 mA when driving full speed in a straight line on my desk. If you have the servos you want to use the best way to be sure of current need is to test it.

Once you have that info, pick a battery with a maximum continuous discharge current that is high enough. This may also be listed as a C rating. 1C means the discharge rate is the capacity of the battery in unit/hours divided by hours times the rate, which is 1 in this case. That makes it sound complicated but for example, if you have a 240 mAh battery drop the h and multiply it by the C number.

240 mAh with 2C means you can draw 480 mA

1.8 Ah with 3C means 5.4 A

2400 mAh 30C means 72,000 mA or 72 A

You get the idea.

IlirD2 (author)2017-02-13


Really nice project. I'm planning to do it. The problem is: I have two 3.7, 680 mah li-po batteries which I think I will have to connect in series. Is there any problem for the arduino if it receives an input of 7.4 volts?

Waiting your answers,

thanks for sharing the project

PaulMakesThings (author)IlirD22017-02-13

According to the page for the Arduino Nano

Its input voltage is 7-12 V, but it also says "operating voltage 5 V" I can see how this would seem a bit confusing. The 5V is what it gets after the regulator, the 7-12 V is what it can take if it goes through the regulator. At the USB connection, you don't want to exceed 5V. But the pin Vin goes into the 5 V regulator, which will cut down voltages 7-12 V to 5 V so they can power the microcontroller and other components.

See this schematic:

In short, connect 7.4V to Vin and the negative battery lead to a ground pin and you'll be fine. Just don't connect it to the 5V pin, that pin is connected to the 5 V rails after the regulator and anything much over 5 V will probably fry something.

As a side note, this device is not tolerant at all of reverse voltage, make sure you connect battery + to Vin and battery - to Gnd, do it backwards for even a moment and the Arduino will be busted.

Aneriah (author)2016-05-23

What is the total cost of this project, I dont have any of the pieces that I need.

cladeport (author)Aneriah2017-01-15

two servos are max 10$

arduino nano is about 5$

battery is tricky, i would guess about 10$ max

if you already have soldering iron, some cables, hot glue.

i dont know about the tank tracks, i searched and found nothing, so youll have to make them or use LEGO ones idk.

JackM26 (author)2016-11-27

Hi, great project. This may sound silly, but could you scale up this. So have the nano controlling a bigger motor? Sorry I am new to all of this kind of stuff. Thanks!

DarwynnM (author)2016-09-14

Gater clips??

Shouldnt this have been at the front of the project for tools and parts needed.

PaulMakesThings (author)DarwynnM2016-09-14

I don't think gator clips are required for any of these steps, also, I didn't make a tool list. This only requires basic electronics tools like wire cutters, pliers, a soldering iron, and a small screwdriver.

DarwynnM (author)2016-09-14

My servos are already continuous. So i skip this step right?

PaulMakesThings (author)DarwynnM2016-09-14


EZtechProjects (author)2016-08-27

Would a 500mah battery work?

That capacity will be enough, but many small LiPo batteries are 3.7V, and some arduino boards are 5V. If you have one that runs on 3.3 then a 3.7V cell should be fine. If it has a 5V regulator it might not power on.

EZtechProjects (author)2016-08-25

It's a great robot I commented on it over 3 years ago and have been waiting to finally make it I just don't know which batteries to use

EZtechProjects (author)2016-08-25

It's a great robot I commented on it over 3 years ago and have been waiting to finally make it I just don't know which batteries to use

SRIJANSEHDEV (author)2016-08-05

what will happen if I use more than 10k resistor? Will the servo work?

It will work with a wide range of values, it's just working as a voltage divider to give the servo control IC a reference voltage that is right in the middle. In this case since the positive voltage is 5V and the other end is ground (0V) and the two resistors are equal, you get 2.5V.

The servo usually works by comparing the potentiometer voltage to the target voltage and setting the speed proportional to the difference, so that the further it is from the target position the faster it will move, and it will stop when it gets there. By setting the feedback voltage fixed in the middle of the range it moves at a speed which is proportional to the target voltage minus the middle voltage, so that it stops when it gets a neutral signal and runs faster in one direction or the other depending on the command.

But more to your question, any values that match eachother will work so long as they aren't so low that they effectively short out the controller (if you used say 7 ohms the power would all go through your resistors and the system would shut down) or so high that the reference voltage is undetectable. So anything from 2k to 1M should work, maybe even outside that range.

SRIJANSEHDEV (author)2016-08-05

what will happen if I use more than 10k resistor? Will the servo work?

SRIJANSEHDEV (author)2016-08-05

what will happen if I use more than 10k resistor? Will the servo work?

Chandima_B (author)2016-08-01

Beautiful robot (y)


imortgagebrokerbrisbane (author)2016-07-18


googolover (author)2016-02-08

how do you wire the battery to the circuit?

It's just wired to Vin and Gnd on the nano, which are split to go to the power wires on the servos. But if I were to do it now I'd probably use a simple lithium polymer charge circuit that provides a charge regulator, and a little Lithium polymer cell.

For example this charger on ebay

and maybe a cell like this

Then you would just connect the battery lines from batt+ and batt- on the board to your battery. And the in+ and in- to Gnd and Vin on your arduino. Since you don't want to feed power from the arduino when plugged in straight into the battery I might suggest putting a diode on the connection between the battery and the arduino so that power can only flow from the battery to the board and not vice-versa. I'm actually not sure if this is strictly necesary as this board may be set up so the battery inputs on the board can be used as outputs when it is not powered. I'll try it and get back to you on that.

srijan sehdev (author)2016-03-25

can we use gear box instead of servos

About This Instructable




Bio: I am a robotic engineer, and I like to make things and teach others.
More by PaulMakesThings:Add Radio to a Syma S107 IR Helicopter (or any other IR device)A 3D Print Ready Jack O' Lantern in Solidworks3D Printed Hanging Internal Gear Clock
Add instructable to: