Let's Make Robots! | RobotShop

Micro Servo Robot

MiniRobot_1_3.ino_.zip2.73 KB
MiniRobot_1_3EN.ino_.zip3.52 KB
Micro_Servo_Robot_Flowchart.pdf84.04 KB
Micro_Servo_Robot_Diagramm.pdf74.13 KB

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!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

1 klick to safe positions; Double klick for playmode (and serial out saved data)

!!! The button needs pullup resistor to 5V!!!

Hello and thank's Very uch for answer. I did it. I put the one resistor of 10k to VCC from pin6 but nathing :(


or just give me your code: he code you have loaded in your arduino that you show in the video. Please 

just want to confirm, the pull up resistor fixed the 'very slow motion on the play mode'.

note for other: make sure to change the code in "MiniRobot_1_3EN.ino_.zip" just like the note in the diagram "Micro_Servo_Robot_Diagramm.pdf".


is there any way to flip the rotation in the code?

somehow the 'hand' (sensor at pin A2) and 'rotate' (sensor at pin A0) spin the 'hand' (servo at pin 10) and 'rotate' (servo at pin 3) the opposite rotation, while the shoulder and griper is fine/correct.

Never mind, I found it. I flipped the values at

ist[0] = map(SensVal[0], 150, 900, 600, 2400)


ist[0] = map(SensVal[0], 900, 150, 600, 2400)

I resold the fiirst problem but now I have Problem with the playback its very very slow 

please any help ? 

Hello I resold The problem Of the playback  slow. 

I changed the calc part: 


void calculate()


      // travel distance for each servo

      dif[0] = abs(ist[0]-sol[0]);

      dif[1] = abs(ist[1]-sol[1]);

      dif[2] = abs(ist[2]-sol[2]);

      dif[3] = abs(ist[3]-sol[3]);


      // biggest travel way from all 4 servos

      stepsMax = max(dif[0],dif[1]);

      stepsMax = max(stepsMax,dif[2]);

      stepsMax = max(stepsMax,dif[3]);

      // stepsMax is the biggest distance a servo have to do beween momentary position and new pos read from the array




      if (stepsMax < 500) // del(ay) between a single step is bigger is move is smaler. just looks cool

        del = 1200; // CHANGE THIS TO 650


        del = 600; // AND THIS OTHER TO 301



did you use a 8MHz arduino? just wondering because u divide the delay time in half

but much more important to fix slow running problem is the pullup resistor at pin 4 and 6!

hi everybody,

my mode playback  speed is good but i need to make a slow play mode ... any idea?


the speed results from the delay between micro steps. try play around with the integer 'del = 1200'  ;-)