MisterBotBreak
Published

How to Make a Robotic Arm

This project will show you how to make a robotic arm using four servos (I only focus on coding, I don't have any 3D files to share).

BeginnerShowcase (no instructions)12 minutes62,797
How to Make a Robotic Arm

Things used in this project

Hardware components

SG90 Micro-servo motor
SG90 Micro-servo motor
×4
Rotary potentiometer (generic)
Rotary potentiometer (generic)
×4
Jumper wires (generic)
Jumper wires (generic)
×1
Arduino UNO
Arduino UNO
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Robotic Arm - schematics

Code

4 Servo

Arduino
#include <Servo.h>

Servo my1Servo;  
Servo my2Servo;
Servo my3Servo;
Servo my4Servo;

void setup()
{
  pinMode(13,OUTPUT);
  Serial.begin(115200);
  my1Servo.attach(3); 
  my2Servo.attach(5); 
  my3Servo.attach(6); 
  my4Servo.attach(9);
}
 
void loop()
{
  int valcomfrom1pot = analogRead(A0);           
  int degree1 = map(valcomfrom1pot, 0, 1023, 0, 180);     
  my1Servo.write(degree1);              
  Serial.println("Angle (Servo 1) : ");
  Serial.println(degree1);
  
  int valcomfrom2pot = analogRead(A1);           
  int degree2 = map(valcomfrom2pot, 0, 1023, 20, 70);     
  my2Servo.write(degree2);                          
  Serial.println("Angle (Servo 2) : ");
  Serial.println(degree2);
  
  int valcomfrom3pot = analogRead(A2);           
  int degree3 = map(valcomfrom3pot, 0, 1023, 0, 90);     
  my3Servo.write(degree3); 
  Serial.println("Angle (Servo 3) : ");
  Serial.println(degree3);
  
  int valcomfrom4pot = analogRead(A3);           
  int degree4 = map(valcomfrom4pot, 0, 1023, 0, 90);     
  my4Servo.write(degree4);
  Serial.println("Angle (Servo 4) : ");
  Serial.println(degree4);
  
  Serial.println("");
  Serial.println("");
  Serial.println("");
  Serial.println("");
  Serial.println("");
  Serial.println("");
  Serial.println("");
 
  delay(40);
}

Credits

MisterBotBreak

MisterBotBreak

48 projects • 149 followers
I love electronics and cats :D !

Comments