Micro Servo Robot

4 axis robot arm with a small gripper and teach function. (In fact: it is a 3 axis robot)

This robot can follow. This robot can learn. And this robot can repeat endles. And he lost all his memory if the batterys are low. This makes it new all the time he is powered again. - The idea for this project is taken from https://www.robotshop.com/letsmakerobots/node/21633 - Stoerpeak made me do it! -

Arduino mini pro 5V/16MHz

4 micro servos 180degrees

4 22k potentiometer

NmH Battery 4.8V

Wires, Button, Switch

Balsa wood, Metal, Plastic

Zip Ties and Glue


Teach mode: After a reset the robot arm follows the teach in arm while simple mapping the analog inputs every 25ms to the servo motors. Pressing the button stores each servo position in a array

Play mode: Double press the button switch to play mode. The sketch reads the array step by step and and moves the robot arm. For cool loocking movements i added a routine calculates different micro steps for each servo to have moving start and end sync on all axis. Also added a ramp for soft increase/decrease velocity. Shorter travel distances the robot does slow, longer distances with faster speed. Its all about timing so my thoughts in this moment

Play Mode version 1.1 The gripper input is used to set the delay (0,1,3,15,60,300 seconds) after a loop is done. The switch (it was left from the project start) pauses the robot

08/2015 i added the same code 1.3 but i try add english comments

10/2015 flowchart for the code and electrical diagram. (make sure you use a pullUp resistor at input 4,6 / change the code for input 4. This should fix the 'slow running problem' often happend)


Hey people!!: If u share my code please keep decency and give me credits. And dont forget Stoerpeak!

This is a companion discussion topic for the original entry at https://community.robotshop.com/robots/show/micro-servo-robot
1 Like

Nice build

Hi, nice build !

Thank you for sharing. I like the idea of a potentiometer arm to control the one with servos. In fact it’s a more elaborated joystick, but I’m a simple hobbyist…

I like the flexible gripper too.

Would be nice that you post your code to have a look at your “algorythm” of microsteps and ramp for velocity.

I like it! Yeah, the code

I like it! Yeah, the code would be interesting.


Ok, zip file attached. But i can imagine the code is very ugly for someone has studied that stuff.  But it works well :wink:

Have you heard of baxter. I think your design is better.

Dear: Pinaut

You should know I am a big fan of baxter and your robot is a lot like him. Baxter is an industrial smart robot that can do almost anything. Maybe you should make your robot humanoid to resemble baxter, just saying.

From: Noah


Thanks so much for sharing and giving good explanation of algorithm approach.


quite precise movements. why don’t you create direct interface with human hands and fingers? Great job anyway!!

Well, first of all, welcome

Well, first of all, welcome to LMR. Your robot arm is something really cool, especially the learning option. 

You said he’s losing all his memory when powered down. Why not write those nubers in the EEPROM or add an SD card to your robot arm for lots of different moving patterns.

Another thing. Don’t worry about how your code looks like. Important is that it works. Once compiled it’s just looking the same like any other code :slight_smile: Viele Grüße nach Deutschland …


losing memory

Sure it would be possible write the recorded steps in a memory (the code writes data to serial after start playmode (for debug or later using)). But i’m fine with ‘no memory’ because … how should i say? … its the soul from this robot: Be something like ‘virgin’ or rebirth and new each time he is powered on. - Everything in life is ephemeral. :wink:


nice stuff, great writeup, great pics and video! Welcome to LMR!


Soul, rebirth, fair enough.

Soul, rebirth, fair enough. Still, he should remember something, at least give him a name :slight_smile:

Power problem (aka circut diagram?)

As an early start on this, I tossed together the 4 pots and 4 micro servos, just wired (power wise) in serial to the 5v and ground on the Arduino.  (through a breadboard)

When running one pot and micro servo (and a quick wacked tougher piece of code) it is working OK, but when I wired in all 4 of each I appear to not have enough power to drive them.


does your design have power directly wired to the Arduino and separately to the servos and pots, or am I missing something else obvious?


The OctopusInAKilt

servo power

While programming this project i run the (micro!)servos directly from the arduino mini powered by the usb port from my macbook.  This has given ‘jumping’ and imprecisely servo movements. This is extremly non-serious! Don’t do that with bigger size servos! After change to the Battery power - yes arduino and servos are paralell - the servos running well.

1 Like

Servo moving very slow in Play mode

Pinaut, thanks for sharing.

I am just finished the wiring on the breadboard and have a question: does anyone have any idea why any servos move very slow in the Play mode? very slow, like 10 seconds for around 20 degrees.

The follow mode is fine, all servos move as quick as the potensio.

please help. Thank in advance,

DK (a newbie who want to learn programming)

very slow moving

Hi there

Tested the code 1.3 again and cannot see your ‘very slow movement’ effect. Did you change something in the code? What is your power source? (see discussion below)


Help with the instructions

Hello !
I am a newbie in this field and this would be my very first attempt at a robot. I do have experience in electronics and programming though. I was wondering if I could get the instructions for making this robot  ? Like the connection diagram,steps or something ?:slight_smile:

i dont understand the circuit diagram

hye… u have really nice project !!! i have build the circuit but i have the problem about your circuit diagram post… can u explain more details. can u skecth new circuit diagram because i really dont see how the circuit works… and what value of resistor did u put in the circuit diagram?  im new in arduino … sory for my bad english.

button and switch connection problem

im done with the circuit on the breadboard. im use arduino uno . the servo work perfectly with the potentiometer. and now, i have problem with button and switch connection. can u draw me the connection ??? in the .ino code, u have declare DI 13, DI 4 and DI 6 …and where to connect it?



DI 4 for the Switch, DI 6 for the Button, DO13 is output for the led

The button and switch needs a pulldown resistor. > http://arduino.cc/en/Tutorial/Button

Connection Diagram

Simple as it is:


Analog inputs 0,1,2,3
PWM out 3,5,10,11
Button DI 6, Switch DI 4 > may button goes to LOW instead HIGH; cant remember ;-)
Did i forget something?
> http://arduino.cc/en/Tutorial/Button
> http://arduino.cc/en/Tutorial/potentiometer
> http://arduino.cc/en/Tutorial/Knob (servo)