Introduction: Cardboard Robotic Arm

Picture of Cardboard Robotic Arm

This is an Arduino controlled robotic arm I made just from cardboard and small servos. It takes around 2 hours to build. Once built, you can write all sorts of code to make it do anything.

In this instructable, I include two programmes I wrote. One makes the arm move periodically to lift a small object. The other takes input from the user via potentiometers, and moves the arm. The arduino records this movement and plays it in a loop afterwards.

This instructable focuses mainly on building the hardware. It can be divided into three parts. The claw, the elbow and the base.

Material required-

  1. Cardboard
  2. 1 clothespin
  3. 3 servo motors
  4. Arduino
  5. 3 potentiometers (optional)

Tools required-

  1. Fevicol or Hot glue.
  2. Black tape
  3. cello tape
  4. Knife
  5. Ruler
  6. Screwdriver
  7. Pins

Step 1: The Claw

Picture of The Claw

I used a metal clothespin. Attach one of it's halves to the servo motor with tape and fevicol. You can use hot glue too.

Cut out a piece of cardboard of dimension approximately 3cm X 13cm. Attach the servo blade of the elbow to one end with fevicol and tape. This connection needs to be strong as this joint transmits the torque from the servo to the arm.

To the other end, attach the other half of the clip. After these connections dry, attach the claw servo with more glue and tape.

Ensure that the claw closes properly during servo operation.

Step 2: The Elbow

Picture of The Elbow

This part is like the claw in the sense that it has a servo motor attached at one end, and a servo blade at the other.

  1. Take 3 to 4 layers of cardboard of dimensions around 3cmX 15cm and sandwich them together Make sure that the longer side is along the cardboard grain, for higher strength.
  2. Towards the top, drill a hole of the dimensions of the servo, and embed it inside the cardboard.
  3. Make 2 cardboard trusses as shown in the pictures with cardboard which can support the claw during operation.
  4. Attach the truss to the elbow with fevicol such that a centimeter of space remains. The base servo will fit in this place.
  5. Coat the bottom surface of the trusses with cello tape to reduce friction.
  6. Attach the servo blade to the base with fevicol or hot glue, and pins. This joint needs to be strong to ensure proper power transmission from the base to the elbow.

Step 3: The Base

Picture of The Base

All of the arm's operations are within this region.

  1. Cutout 3 to 4 layers of cardboard and sandwich them together with tape.
  2. At the center, you need to fix the base servo. So cutout a t-shaped cavity.
  3. At the center, fix the servo with fevicol or hot glue.. I used the metal gear mg90 servo for the base.
  4. Make sure that the servo is in level with the base. The gear should fit in the space we left between the elbow and the trusses.
  5. There should be enough space in the T- hole for the wires to slip under.
  6. Mark of the circle in which the elbow will rotate with tape.
  7. Coat this circle with cello-tape to reduce friction between the base and trusses.
  8. You can even apply lubricant like machine oil over the cello-tape.

Step 4: Putting It All Together

  1. Attach the claw piece to the elbow such that at 180 degree the claw touches the base.
  2. Tape the connecting wires and jumpers to the side of the elbow pillar.
  3. The elbow pillar should connect with the base servo with little effort. You can make this connection permanent with a screw. I chose to keep it free so that during violent servo movement the arm doesn't get damaged.
  4. Pass all the wires underneath the base through the hole.
  5. Attach one final layer of cardboard to the base, which will ensure that the base servo doesn't touch the ground, and the wires are hidden.

Step 5: The Potentiometer Controller

Picture of The Potentiometer Controller

Connect 3 pots to the arduino analog input pins. Any value will do. I used 10k.

Step 6: Code

I have attached the two codes used in the videos and described in the introduction.

UPDATE 18-10-2017

I have updated the code for servoRecordandPlay, now it can record for a minute on the UNO, and for over 4 minutes on the mega with 3 servos. Also, I have specified the pins explicitly.

Step 7: Some Tips...

  1. Make appropriate measurement before cutting the cardboard, or gluing anything together.
  2. At every step of the construction, plan where to put the wires. Otherwise it will be a real hassle in the end.
  3. Give the glue time to dry before powering the servos.


ukhan14 (author)2017-10-18

Hi thanks for the updated code it worked nicely on uno.

But Sourav the movements while recording are not precise enough.. like while recording its very hard to get the gripper right on top of the object which needs to be picked up. However, while playing it moves fluently.

I understand that may be you should not expect too much with these micro servos but still, can you do something to make the recording movement more precise or fluent.

I was trying to upload my videos here but failed, may be only pictures are allowed here

SouravB22 (author)ukhan142017-10-20

Hmm, You can try and increase samplepersec to more than 8 (at the cost of less recording time). Or look for this line 61 at the record function.
if( val[i] >= store[i]+100 || val[i] <= store[i]-100){// to account for the changes in value due to loose wiring

I included this line because I didn't want to constantly instruct the servo to move based on the slightly different values read from the pot.
Try decreasing the 100 to 50 or lower; play around with it a bit. Maybe that will work for you.

ukhan14 (author)2017-10-17

Hi Sourav

To increase its memory i have connected it with arduino mega but then servos were behaving weirdly and two of them were not working at all.

Please guide me how to connect it with mega and how to change the code for mega. with thanks

SouravB22 (author)ukhan142017-10-17

Wow! Congratulations on building the arm! It looks great! I would love to see it in action.

I have updated the code slightly, maybe that would help you a bit.

I apologise for my crappy code, it offered no portability whatsoever. I had a glance at Mega's pinout and found the source of your problem. My code expects the pots to be connected to gpios 14,15,16 and 17 by default. It read random noise from those pins of the mega and sent them over to the servos.

Just write A0, A1 etc on the pot array of the new code, and it should be fixed. I think. And I don't think there should be a problem to attach a servo to a pwm pin.

But still, I don't think to abandon the uno just because of its limited memory is the best solution. Code is free, but hardware costs money. You could use shorter data types to encode the information. I think a byte to store a position should be enough for your needs, even on the UNO. You can get more than 40 seconds of recording time with 4 servos, with 8 samples per second in an UNO with the newer code.

SouravB22 (author)ukhan142017-10-17


I would need more information than that to help you, but here are some of the things you could do:

1.) Ensure you have wired the servos correctly to the pins that are defined in the code.

2.) Test the servo motors independently with example code to see if they are okay.

3.) Change the pin definitions in my code and see if that works for you.

ukhan14 (author)SouravB222017-10-17

mega is like a beast when it comes to dynamic memory comparison with uno. I am extremely desperate to enhance the learning memory upto 3 times of the current one which is now 50sec.

The goal is to develop a sorting bot application so that at least after getting enough learning memory it will be able to perform three different lift and drops for 3 different sized items and 3 different dropping positions.
I had conducted individual servo test with mega but no success. Or any innovative application if u can suggest, would be highly appreciated.

On mega everything seemed fitting and same like uno except that mega has separate digital pins and pwn pins which might have causing the trouble and i used mega's pwm pins for my four servos, starting from 2 to 5.

lastly, i couldn't find the pin definitions in the code as it only shows servo and pot as "N".. normally i have seen in different codes where servo pins and pots pins are defined and pin numbers are visible.. i dont know, i think u have develop some kind of formula and therefore no need to define pin individually. I can't interpret complex formats of coding except the basics formats and theoretical concepts. Please do explain me about changing pins and then i will be able to try it to connect and control with mega.

ukhan14 made it! (author)2017-10-14

Thanks a lot Sourav for being kind enough to share this working project of yours.

Wondering how can I learn to write a code like yours ?

There are a lot of video tutorials and code out there for arduino record and play mode with servos via momentary push buttons and I have tried almost all of them with arduino uno and not a single record and play mode worked for me except yours and for that I am really grateful to you.

Can you if possible explain to me the reason why record and play mode is that difficult or can you teach me somehow about how to add this record and play code in ardunio servo robot arm controlling via potentiometers?

The basic theoretic concept which I have understand yet is that you have to record all the value of servo motions in an array of arduino code and and then you have to repeat those recorded values in a loop to achieve this record and play feature.

with thanks

SouravB22 (author)ukhan142017-10-14

Thank you for your encouraging comment; I am really flattered!

There are a lot of reasons why a record and play code won't work, depending upon the logic used, it's implementation in the language, and maybe even hardware limitations. I personally haven't looked too deep for such code, since mine worked okay, but would be glad to see some if you share the link.

I'll just explain my code a bit here. You have got the basic theoretical concept right; I do have an array of angles for each servo. In the record function, I had a choice; whether to record in time or record motion. Recording in time means I add a new angle to the array after every interval of time. Thus the array basically becomes a graph of servo position vs time. I used this method, in the original code, I add a new value roughly every 125 ms. This method records for a fixed duration of time and reproduces the original movement exactly.

The other strategy is to record motion, that is, add a new value to the array after every fixed displacement, say 5 degrees. This would mean that the array won't get new values while you are not turning the knob. This method has the advantage of smoothing out the jerky hand movements of controlling the knob.

Once we have the array, we have to 'play' it. That is, make a function that reads the array and tells the servo where to go. If we choose the first method, that is the array is an angle vs time plot, we should do exactly that: write the angle to the array, wait for that predefined interval, and then write the next value. But the servo takes time to move from one location to the next, and I would also prefer not to write two wildly different values, say 0 and 180 in a short duration, as the Arduino won't have any problem sending the electronic signals to do that, but the mechanical parts won't respond to them, and be stuck. So I did a sort of a hack. My code doesn't exactly reproduce human motion. But my code ensures that such a thing doesn't happen to the servo. I wrote a function that takes 10ms to increment the position of the servo by 1 degree. And call this function without using any delay to read my angle array.

My code isn't perfect; there are a lot of optimizations that if done, would allow longer recording times, and more fidelity. One such obvious fix is to change the data type of the rec[][] matrix from an int to a byte.

ukhan14 (author)SouravB222017-10-14

Thank you once again for very focused and refreshing explanation.

Rather I would like to learn through your code as it turned out more understandable for me especially after your explanation. I am hoping If you can modify your current code in a way for ardunio uno that it follows the first method for recording and playing servo movements, which will thus enable me to learn from the difference elements of the two codes for two different methods and also It will help me to develop my understanding about how to code the arduino to implement first method.

SouravB22 (author)ukhan142017-10-17

My code does follow the first method while recording the values. But it doesn't while playing them. I did the hack because of one main reason: we can turn the potentiometer quite fast, but if the servo motor turns as fast as it would if we simply programme it to match the pot, the cardboard construction would fall apart.

This code here is exactly what we need to do to implement the play method after recording in time-

void play(){

for(int i=0; i<samples; i++){





But this won't ensure the integrity of the cardboard structure.

ukhan14 (author)SouravB222017-10-17

you know when i added the 4th servo the dynamic memory got jumped and exceeded the limit but then after many attempts I finally got the recording time of 50 sec by changing following:
dynamic memory 91% used by global variables.

with 50secs in hand then i was able to record a decent pick and drop task in a loop which worked fabulously.

ukhan14 made it! (author)SouravB222017-10-17

I am so excited to share the pics of my robotic arm project with you.

I have replaced the cardboard with acrylic sheets to enable a reasonable strength to the general structure and worked nicely

Vardhanbatavia007 (author)2017-02-28

Sorry once again dor disturbing but 2 of my servos are only working. Sometimes first and second work and sometimes 1st and 3rd works but they don't work all 3 at a time. What should I do???

Maybe it's caused by lack of current

Can you ellaborate more? Send a couple of pics of the arm, the connections and the code.

Vardhanbatavia007 (author)2017-02-19

After making it I understood how hard you would have worked. Praised by your work and waiting for your next project........ :() :):):):):):):):):):)
Thanks once again...

Vardhanbatavia007 (author)2017-02-14

Hi Sourav, sorry once again I am distirbing you but can you please tell me how to connect the circuit on breadboard I dont know where to connect power terminals. I think I should connect that triangle in the circuit diagram with the reset button and for gnd I have 2 terminals on my arduino where should I connect...
Please reply.....

Just connect 5v from the arduino to a power rail in your breadboard. This is the triangle. Connect all wires connected to the triangle to this power rail.
Connect any of the three ground of the arduino to another power rail. Connect all grounded wires to this.

THANKS for your TIME

Vardhanbatavia007 (author)2017-02-14

Hey Sourav, do I need to upload both the codes to run the arm for continuous motion. I mean when I have planned an action, do I need to upload both the codes so that my arm performs the same action repeatedly???
Please reply

No just upload the ServoRecordandPlay. Perform an action when the led at pin 13 is on. After it turns off, the arm is no longer taking input from you, and plays whatever it recorded in a loop. If you want it to repeat another action, just press the reset button and record the action.


Vardhanbatavia007 (author)2017-02-18

Thanks bro you helped me so much I am almost done with it

Vardhanbatavia007 (author)2017-02-10

Hey how did you power it. I meam is it powered by external battery. If yes than how many volt or is it powered by arduino itself

It is powered by the arduino itself. You can attach an external battery of upto 12 volts to it.

If you are using servos which require more current than the arduino can source, you can use the external battery with a suitable voltage regulator (like 7805) to power them.

But that shouldn't be a problem because the arduino only supplies current to one servo at a time.

Thanks and how many ohms potentiometer did you use. I found several like 470 kohm to 1k ohm which should I use

Using a pot of very low resistance gives excellent readings to arduino, but it dissipates a lot of power.

Using a very high resistance takes in a lot less current, but it messes with the internal ADC of the arduino, and you don't get reliable readings.

So it is best if you use pots of resistances upto and including 10k ohms.

Thanks bro you are the best!!!

In which college do you study??? I am in 11th and soon will be in college......

DivyanshS19 (author)2017-02-10

how i use 4 servo with play record mode

SouravB22 (author)DivyanshS192017-02-11

There is a const int N in the first line of the code. It is set to 3. Just change it to 4 in your code.

Attach the 4th servo's data pin to GPIO 5, and it's control pot to analogread pin A3 (also called GPIO 17).

Vardhanbatavia007 (author)2017-01-30

Sourav bro I truly loved your project. I am also one such curious kid who wants to develop innovations at home.
Always boost your innovation and inspire us too.

Thank you for your appreciation.

Please share if you make some more interesting projects like this one

DIY Hacks and How Tos (author)2017-01-28

Awesome. This project is the perfect illustration of the fact that you don't need to spend a ton of money to get into robotics.

Thank You.

charumathiV (author)SouravB222017-02-06

Sir, we are keen about your project, could you please upload the circuit connection

SouravB22 (author)charumathiV2017-02-07

I just did. I am glad you are interested in it.

About This Instructable




Bio: I am an electronics and communication engineering student currently in my third year. I have an interest towards micro-controllers, electronic circuits and hardware hacking.
More by SouravB22:Arduino Keyboard Piano With 8 Bit R2R DACGame of Life on Nokia 5110 LCDVoltage Booster
Add instructable to: