Introduction: Arduino Drawing Robot

Picture of Arduino Drawing Robot

I designed this project for a 10-hour workshop for whose goal is to introduce teenage women to STEM topics. The goals for this project were:

  • Easy to build.
  • Easy to program.
  • Did something interesting.
  • Low-cost so participants could take it home and continue to learn.

With those goals in mind, here were a couple of the design choices:

  • Arduino compatible for ease of programming.
  • AA battery power for cost and availability.
  • Stepper motors for accurate motion.
  • 3D Printed for ease of customization.
  • Pen plotting with Turtle graphics for interesting output.
  • Open Source so you could make one of your own!

Here is the robot that came closest to what I wanted to do: I don't have a laser cutter and shipping from England was prohibitive. I do have a 3D printer, so I guess you can see where this is going . . .

Don't let the lack of a 3D printer deter you. You can locate local hobbyists willing to help you out at

It took a lot of work, but I'm please with how it turned out. And, I learned quite a bit in the process. Let me know what you think!

Step 1: Parts

Picture of Parts

There are a number of ways to power, drive, and control robots. You may have different parts on hand that will work, but these are the ones I've tried and found to work well:



Printed Parts (check out if you don't have access to a printer):

    • 1 x Ball bearing caster
    • 1 x Chassis
    • 2 x Wheels
    • 2 x Stepper bracket
    • 1 x Pen Holder / servo bracket
    • 1 x Pen Collar
  • I use low-resolution, 100% fill, and no support. This is about 4 hours worth of printing.


  • Phillips screw driver
  • Hot glue gun
  • Digital multi-meter
  • Sharp knife
  • Crayola colored markers

Step 2: Flash the Firmware

Before we get too far into construction, lets load the test firmware on to the microcontroller. The test program just draws for boxes so we can check for proper direction and dimension.

  1. Download the Arduino software from
  2. Open the Arduino software.
  3. Download the attached zip file and unzip it to the Arduino sketchbook location.
    • You can find (or change) this location in the Arduino IDE: [File] -> [Preferences]-> "Sketchbook Location".
  4. Load the test sketch: [File] -> [Sketchbook] -> [TIRL_Arduino_TEST]
  5. Attach your Arduino to your computer with a USB cable.
  6. In the Arduino IDE:
    1. Set you board type: [Tools] -> [Board] -> Your board type.
    2. Set your serial port: [Tools] -> [Port] -> Usually the last one listed.
  7. Upload the sketch using the arrow icon.

If you have any problems, refer to for help.

Step 3: Pen Holder and Battery Holders

Picture of Pen Holder and Battery Holders
  1. Insert the nuts on the top side of the chassis (Image 1). You may have to press them in.
  2. Install the Pen Holder with the Servo Bracket on the top side of the chassis (Image 2 & 3).
  3. Attach the battery holders on the bottom of the chassis using 3Mx6mm flat-head screws (Image 4)
    • You need at least 5xAA to properly power an Arduino via it's onboard regulator. Six would work as well, so I've include holes for either size on both sides.
    • You want the weight shifted toward the caster, so put the 3xAA toward the back.
    • Orient the holders so the leads are closest to the rectangular cable runs.
  4. Thread the battery leads through the rectangular cable runs (Image 4).
  5. Repeat for the other battery holder.

Note: Unless specified, the remainder of the screws are 3Mx8mm pan head screws

Step 4: Stepper Backets

Picture of Stepper Backets
  1. Insert a nut into the stepper bracket and attach them to the top of the chassis with a screw (Image 1).
  2. Insert the stepper into the bracket and attach with screws and nuts.
  3. Repeat for the other bracket.

Step 5: Caster

Picture of Caster
  1. Insert the ball bearing into the caster.
    • Do not force it in or it will break. Use a hair-drier or hot air gun to soften the material if needed.
  2. Attach the caster to the bottom side of the chassis in front of the battery holder.

I've tried other round objects like marbles, but smooth and heavy seems to work well. If you need a different diameter, you can edit the openScad file ( to fit what ever you have on hand.

Step 6: Breadboard and Brains

Picture of Breadboard and Brains
  1. Remove one of the power rails using a sharp knife, cutting through the bottom adhesive (Image 1).
    • One rail has power (red) on outer edge, they other negative (blue). I'm keeping the first attached, and it will match the schematics and photos. If you use the other, just adjust the wires accordingly.
  2. Holding the breadboard over the chassis rails, mark where they intersect the edge (Image 2).
  3. Using a straight edge (like the removed power rail), mark the lines and cut through the backing (Image 3).
  4. Place the breadboard on the chassis with the rails touching the exposed adhesive (Image 4).
  5. Attach the Arduino to the other side of the chassis using 4-20 screws (Image 5).

Step 7: Capacitor and Part Placement

Picture of Capacitor and Part Placement
  1. Place the darlington driver and power switch on to the bread board (Image 1).
    • I've added orange dots for visibility to mark the following:
      • Pin 1 of the darlington driver
      • The battery pin of the microtroller.The power switch "on" position.
  2. Trim the capacitor leads if necessary (longer is negative) (Image 2).
  3. Insert the capacitor into the correct rails on the top of the breadboard (Image 3).

Step 8: Power

Picture of Power
  1. With the right-hand battery leads:Connect the red line to the first pin of the power switch (Image 1).
  2. Connect the black lead to an empty row between the microcontroller and the darlington chip (Image 1).
  3. With the left-hand battery leads:Connect the red line to the same row as the black lead of the other battery (Image 2).
  4. Connect the black line to the negative rail of the breadboard (Image 2).
  5. Connect power to the microcontroller:
    1. Red jumper from positive rail to the battery pin (orange dot, Image 3).
    2. Black jumper from the negative rail to the pin marked "G" (Image 4).
  6. Install batteries and switch the power on (Image 5).
  7. You should see the green and red lights of the controller come on (Image 6).


  • If the microcontroller lights do not come on, immediately turn the power off and troubleshoot:
    • Batteries installed in the correct orientation?
    • Double check battery leads positioning.
    • Double check switch leads positioning.
    • Use a multi-meter to check voltages of batteries.
    • Use multi-meter to check power rail voltages.

Step 9: Stepper Power

Picture of Stepper Power

Now that you've got power to the microcontroller, let's finish wiring power to the steppers:

  1. Connect a black jumper from the upper left darlington pin to the negative side of the power rail (Image 1).
  2. Connect a red jumper from the lower left darlington pin to the positive side of the power rail (Image 1).
  3. Connect a red jumper from the lower left darlington pin to one row right of the darlington (Image 2).
  4. Insert pin headers for the stepper's white JST connectors (Image 2).

Step 10: Stepper Control Signals

Picture of Stepper Control Signals

The microcontroller provides 5 volt signals to the darlington array which in turn, provides VCC to the stepper coils:

  1. Start with pin next to the ground pin on the darlington driver, and install orange, yellow, green, and blue wires in that order (Image 1).
  2. Attach the jumpers to the following arduino pins (Image 2):
    1. orange - Digital pin 4
    2. yellow - Digital pin 5
    3. green - Digital pin 6
    4. blue - Digital pin 7
  3. Back at the darlington, continue jumper for the other stepper in the reverse of the others:
    • blue, green, yellow, and orange (Image 3).
  4. Attach the jumpers to the following arduino pins (Image 4):
    1. blue - Digital pin 9 (pin 8 used latter for the servo).
    2. green - Digital pin 10
    3. yellow - Digital pin 11
    4. orange - Digital pin 12

Step 11: Stepper Coil Connections

Picture of Stepper Coil Connections

The stepper's white JST connectors attach to the pin header. The red lead is power, and should match the red power jumpers we installed earlier (Image 1).

All colors should match the microcontroller jumpers on the opposite side of the darlington, with the exception of green, which matches the pink wire of the stepper (Image 2).

Step 12: Servo

Picture of Servo
  1. Install the servo horn with the servo rotated clockwise to the stop and the horn horizontal (Image 1).
  2. Attach the servo to the holder, and the horn pointed to the right stepper side (Image 1).
  3. Attach brown (ground), red (5V power), and white (signal) jumpers into the servo connector, matching the servo wire colors (Image 2).
  4. Attach the power and ground jumpers to the ground and 5V header on the Arduino (Image 3).
  5. Connect the white signal wire to the Arduino's Digital Pin 8 (Image 4).

Step 13: Wheels

Picture of Wheels
  1. Place the rubber o-ring around the edge of the wheel (Image 1).
  2. If the fit of the hub on the axle is loose, you can use a 3M screw to hold it in place (Image 2).
    • Do not tighten it too much or you will strip the plastic.

Step 14: Testing

Hopefully you already uploaded the firmware in Step 2. If not, do it now.

The test firmware just draws a square repeatedly so we can check direction and accuracy.

  1. Place your robot on a smooth, flat, open surface.
  2. Turn the power on.
  3. Watch your robot draw squares.

If you are not seeing lights on the microcontroller, go back and troublshoot power as in Step 8.

If your robot is not moving, double check the power connections to the darlington driver in Step 9.

If your robot is moving erratically, double check the pin connections for the microcontroller and darlington driver in Step 10.

Step 15: Calibration

Picture of Calibration

If your robot is moving in an approximate square, it is time to put some paper down and put a pen in it.

Measure your wheel diameter (Image 1) and wheel base (Image 2) in millimeters.

Your calibration settings in the code are:

float wheel_dia=63;     // mm (increase = spiral out)
float wheel_base=109;   // mm (increase = spiral in)
int steps_rev=128;      // 128 for 16x gearbox, 512 for 64x gearbox

I started with a measured wheel diameter of 65 mm and you can see the boxes rotating outward or clockwise each step (Image 3).

I eventually arrived at a value of 63mm (Image 4). You can see that there is still some inherent error due to gear lash and such. Close enough to do something interesting!

Step 16: Raising and Lowering the Pen

Picture of Raising and Lowering the Pen

We've added a servo, but haven't done anything with it. It allows you to raise and lower the pen so the robot can move without drawing.

  1. Place the pen collar on the pen (Image 1).
    • If it is loose, tape it in place.
  2. Check that it will touch the paper when the servo arm is lowered.
  3. Check that it will not touch the paper when raised.

The servo angles can be adjusted either by removing the horn and re-positioning it, or through the software:

int PEN_DOWN = 20; // angle of servo when pen is down
int PEN_UP = 80;   // angle of servo when pen is up

The pen commands are:


If you want to use different pen sizes, you will have to modify the pen holder ( and pen collar ( with the correct diameter.

Step 17: Have Fun

I hope you made is this far without too many curse words. Let me know what you struggled with so I can improve the instructions.

Now it is time to explore. If you look at the test sketch, you will see I have provided you some standard "Turtle" commands:

forward(distance);   // millimeters
left(angle);         // degrees
done();              // release stepper to save battery

Using these commands, you should be able to do just about anything, from drawing snow flakes or writing your name. If you need some help getting started, check out:

Step 18: Other Platforms

Picture of Other Platforms

Could this robot be done with a <Insert your favorite board here>?

Yes! This platform is very flexible. You would mainly just need to modify the chassis.

I've done it with a Raspberry Pi (Image 1) and an Adafruit Trinket ( (Image 2).

Let me know what you come up with!


MonicaR74 made it! (author)2017-08-20

Com algumas modificações...

MakersBox (author)MonicaR742017-08-20

Thanks for posting a photo!

NurmatH (author)2017-05-14

Thanks for such a great project.

I would like to make one, but all my 28BYJ-48 stepper motors came with ULN2003 driver. Can i use them for this project ?


MakersBox (author)NurmatH2017-05-14

Yes. I've seen pictures of at least one other person doing it that way. You really don't need a breadboard if you go that route, and most of the drivers come with LEDs that help with troubleshooting.

wilfrodger (author)2017-03-30

Hey, i made it but still having problems with the callibration! Could it be something to do with the step_rev variable, currently it's at 128, but my motor has 513 steps. Any info would be useful, here's a link to my motor specs

MakersBox (author)wilfrodger2017-04-04

How close to 90 degree turns is it making with the 128 step setting?

MakersBox (author)MakersBox2017-04-05

Make sure nothing is loose and that the wheels are straight. Also, if the caster isn't rolling freely, or you are on a rough surface, that will cause issues as well.

wilfrodger (author)MakersBox2017-04-05

I mean, it is very close... sometimes, but it's not that repeatable, if you know what I mean? I can run the code twice and it will sometimes draw very different things.

MakersBox (author)wilfrodger2017-03-30

Give it a try and see what happens. The part number corresponds with what I was using, but your data sheet clearly indicates 513 is correct. Let me know how it goes.

wilfrodger (author)MakersBox2017-04-04

I've tried making it 513 and it over shoots all the instructions that are written. A right(90); makes it do a full turn and a forward(100); makes it draw almost the whole short side of an A4 page.

wilfrodger (author)wilfrodger2017-04-04

I'm guessing it's because it messes with the step() function. The line that says:

int steps = distance * steps_rev / (wheel_dia * 3.1412);

judejdp (author)2017-03-29

anyone please help.. My Stepper wheel is not rotating

SamarSri made it! (author)2017-03-01

Finally I made my little DrawBot.
3D printing was not available at my location,so I used bottle caps as pen holders.

Just some changes in the code and now I can make the DrawBot draw anything from patterns to complex drawings!!

P.S.- I'll add more images.

P.P.S - A video of my bot drawing squares:

I'll be happy to help you too. Just shoot me a mail at :

keileen89 (author)SamarSri2017-03-08

My students want to build this. Would you be able to provide assistance? We have no access to a 3d Printer.

MakersBox (author)keileen892017-03-08

i have left-over parts I would be willing to donate. Can you message me from my profile?

SamarSri (author)keileen892017-03-08

Yes. I'll be happy to help.
Mail me any problems that you encounter at

MakersBox (author)SamarSri2017-03-01

Love it! Thanks for posting pictures.

keileen89 (author)2017-03-08

My students want to build this. Would you be able to provide assistance? We have no access to a 3d Printer.

RocketPenguin (author)2017-01-01

Why not just put Makeblock's mDraw software on it? The design appears identical to theirs... :P

socbay (author)2016-11-05

I've fixed it..Thank the author for sharing, i like it.My english is bad ,sorry if i write wrong grammar.

socbay (author)2016-11-05

why do my right stepper not run reverse? it only run forward. Can you help me? Thank you!

observing (author)2016-10-20

Thanks, MakersBox. I recently made one, but used a NodeMCU for the controller. In addition to the operations in your test code, the robot provides a WiFi access point and web server for sending it Logo commands. I had enough program memory to implement the FORWARD, BACKWARD, RIGHT, LEFT, and REPEAT commands along with defining functions (TO-END) with variable arguments. I still need to implement an expression parser and a way to store and retrieve functions in its internal SPIFFS file system similar to the way volab seems to be storing his alphabet on external SD card.

MakersBox (author)observing2016-10-20


PMPU_student made it! (author)2016-10-08

Hello, I made this robot as my first arduino project, it really is cool, I've even made some improvements (well, I think these are improvements).

The robot really isn't precise sometimes, especially at rotating (after some rotation precision is lost). Code changes I've made seem to improve precision for a little bit.

I added this function to the code:

float getNearestAngle(float angle_){

float angle = 0;

int step = 0;

float previousAngle = 0;

float step_length = 3.1412 * wheel_dia / steps_rev;

while(!(previousAngle <= angle_ && angle_ <= angle)){

step += 1;

previousAngle = angle;

angle = step * step_length * 360 / (wheel_base * 3.1412) + 0.01;


float dif1 = angle_- angle;

float dif2 = angle_- previousAngle;

if(abs(dif1) < abs(dif2)){

return angle;


return previousAngle;



and in functions left(float degrees), right(float degrees) I wrote:

float rotation = getNearestAngle(degrees) / 360.0;

instead of:

float rotation = degrees / 360.0;

Here is the short explanation on an example:

Lets rotate by 58 degrees.

According to my calculations, original code will rotate only by 57.631138392857146 degrees(that is the value that is the closest to the desired one _and_ is lesser than it). That means you are doing a certain amount of motor steps. But if you do one more step during rotation you will rotate by 58.0078125 degrees, which is much more precise(but it is greater than desired value, thats why in original code it is not picked). The thing is that original code always decides to rotate by value that is lesser than desired value while it is sometimes worse than choosing the value that is bigger. My code chooses from both variants, minimizing the error.

I really hope that it works correctly. It would be great to receive some feedback from people. Here is the comparison of both algorithms.


joaomiguelr (author)PMPU_student2016-10-17


MakersBox (author)PMPU_student2016-10-08

Totally awesome. Thanks for sharing your improvements!

volab (author)2016-07-25

Thanks for sharing MakersBox.

I made one and i made some changes. I add an sd card to store alphabet.

The next step, i'll add bluetooth.

I share files on VoLAB wiki @

DeloisD (author)2016-06-21

Hi, i've done this little robot, but i've a question about the batteries and how them was connected.
They are in a serial configuration, so basically we do a count for establishing the V (1.5 x 6 = 9V)
If we put a 9V in our arduino, this will reduce the V to 5, due to a in-built regulator in the pin input VIN of arduino. But how we "feed" all the other stuff?
In the picture created with fritizing seems like the stepper are "feed" with 9V which is weird because they need 5V.. can anyone help me?

MakersBox (author)DeloisD2016-06-22

I've got the batteries connected straight to the steppers because I don't want to pull the current through the regulator. The beauty of the darrlington array is that it can control voltages other than 5V using the Arduino's 5V signal.

IshratJ (author)2016-05-17

why my device is not giving perfect angle??

HanooF (author)2016-05-08

Hi.. I would like to know the structure of the robot where to find it

RinaS7 made it! (author)2016-05-03

I'm having an issue where the bot won't move the full 90 degree angle.. it keeps making shapes like the picture. Any suggestions?

MakersBox (author)RinaS72016-05-03

The blue one or the orange? Check to make sure your batteries are not dragging and then double-check the parameters for wheel size and wheel base.

MakersBox (author)MakersBox2016-05-04

What is the length of each segment? I'm wondering if you have a different number of steps per rotation:

int steps_rev=128; // # 512 for 64x gearbox, 128 for 16x gearbox

RinaS7 (author)MakersBox2016-05-04

The batteries aren't dragging and the wheel size and wheel diameter is correct and so is the wheel base. Any other suggestions? Could I have wired something wrong?

RinaS7 (author)MakersBox2016-05-03

The blue one. If I 3d printed using the same files you posted shouldn't the sizes be the same?

MattiaK (author)2016-04-11

Hello can someone show me the electric circuit of this project

MakersBox (author)MattiaK2016-04-11

Here is the reference I used when designing the project:

MattiaK (author)MakersBox2016-04-16

Thank you

IshratI (author)2016-03-29

i have made this but my wheel is not thin alike u, thats why its giving not accurate left right angels..... can u give me solution how can i edit my wheel_base.plz its urgent

volab (author)2016-01-25

Hello, thank MakerBox for the sharing of this design.

I want to know why this parameter steps_rev need to be 512 with a 28BYJ-48 motor.

His datasheet says 64x gear and a "stride angle" of 5.25° (/64). Should this paramter be 4096 ?


Les moteurs risque d'être un peu poussif pour embarqué un laser de découpe aussi petit soit-il. Mais pourquoi pas en revoyant certaines pièces.

Philippe want to transform your design in a cutting robot. He propose to replace the pen by a small laser to cut some light materials as paper or foam.

I made one and when it works i post some pictures here.

Fenyx82 made it! (author)2016-01-17

Super fun!

favior made it! (author)2016-01-16

Great great design! I made some edits to the chassis file to hold the half boards we have and to use ball casters I found in Harbor Freight. Thanks to a DIY arduino and an awesome 3D print hub partner I am able to create kits for a robotics club I coach for a very good price. Thank you!

ozgura2 (author)2015-11-29

We made a drawing robot with my kids as you can see in the pictures and it works fine. We used parts from my stock and printed the body with the 3d printer I builded up.

Now our next job will be to design and print a fancy cover on top :) Additionally I'll add a small spring to push down the pen while drawing, in order to have straight lines.

Many thanks from my family for the very helpful instructable.

Aslan Family

MakersBox (author)ozgura22015-11-29

I love the white color! Thanks for posting pictures!

I just posted an Instructables about how to learn how to make patterns with it:

ozgura2 (author)MakersBox2015-11-30

Great! I'll check it out soon.

Soumojit (author)2015-11-27

can t download 3d files . please upload the file in other place or give me direct link

and can i make this with out 3d print and if i 3d print what is the cost of printing

abdullahmaten (author)2015-11-18

can u send a video of how to assemble the parts

please its urgent before thursday

MakersBox (author)abdullahmaten2015-11-21

Sorry. Too much going on. Are you having trouble with anything specific?

MakersBox (author)2015-11-12

Take a look at

About This Instructable




More by MakersBox:OSH Park BadgeGeek SpinnerProgrammable POV Fidget Spinner
Add instructable to: