Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!
Sriram MN
Published © GPL3+

Cardboard Robotic Arm

This project is about a simple robotic arm which can be made using three servo motors. The arm is controlled by a computer.

BeginnerShowcase (no instructions)3 hours2,584
Cardboard Robotic Arm

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
Servo Motor
×3

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Schematics

This is how I connected the servos to Arduino.

untitled_sketch_2_zoqLGmb3sR.fzz

Code

Code for the Controlling the arm

Arduino
#include <Servo.h>
int x = 0,y=0,z=0;

Servo s1,s2,s3;  // create servo object to control a servo


 
void setup()
           {
              Serial.begin(9600);
              s1.attach(5);  
              s2.attach(4);
              s3.attach(2);
           }



void loop() {
  
 

int val = Serial.parseInt(); //read int or parseFloat for ..float...

Serial.println(val);

  if(val==1)
              {
                x=x+5;
                  s1.write(90+x);                 
                   delay(150);                           
                   s2.write(90+y);
                   delay(150);
                   s3.write(90+z);
                   delay(150);
              }
 
   else if(val==2)       
   {
                x=x-5;
                  s1.write(90+x);                 
                   delay(150);                           
                   s2.write(90+y);
                   delay(150);
                   s3.write(90+z);
                   delay(150);
              }      
                              
      
  else if(val==3)       
             {
                y=y+5;
                  s1.write(90+x);                 
                   delay(150);                           
                   s2.write(90+y);
                   delay(150);
                   s3.write(90+z);
                   delay(150);
              }      
  else if(val==4)       
             {
                y=y-5;
                  s1.write(90+x);                 
                   delay(150);                           
                   s2.write(90+y);
                   delay(150);
                   s3.write(90+z);
                   delay(150);
              }  
else if(val==5)       
   {
                z=z+5;
                  s1.write(90+x);                 
                   delay(150);                           
                   s2.write(90+y);
                   delay(150);
                   s3.write(90+z);
                   delay(150);
              }      

  else if(val==6)       
   {
                z=z-5;
                  s1.write(90+x);                 
                   delay(150);                           
                   s2.write(90+y);
                   delay(150);
                   s3.write(90+z);
                   delay(150);
              }  
}    

Credits

Sriram MN
5 projects • 9 followers
A Engineering student who just stepped into the world of electronics. Interested in Astronomy,Robotics,Iot,Quantum phenomenon,Ml and AI .

Comments