Paul Vincent Bezzina
Published © GPL3+

Arduino Robot Arm Project [V2]

My second and more advanced attempt at creating an Arduino-operated robot arm.

IntermediateShowcase (no instructions)12 hours369
Arduino Robot Arm Project [V2]

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
×7
Rotary potentiometer (generic)
Rotary potentiometer (generic)
×5
Male-Header 5 Position- 1 Row- Long (0.1")
Male-Header 5 Position- 1 Row- Long (0.1")
×12
Female/Female Jumper Wires
Female/Female Jumper Wires
×1
Male/Female Jumper Wires
Male/Female Jumper Wires
×1

Software apps and online services

Arduino IDE
Arduino IDE
Fusion
Autodesk Fusion
Creality Slicer

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)
Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

Circuit Diagram

Code

Main Code

Arduino
This code is designed to enable the robot arm to perform all its basic functions by interpreting input data from the potentiometer.
#include <Servo.h>


 Servo servo1; // Creating objects
 Servo servo2;
 Servo servo3;
 Servo servo4;
 Servo servo5;
 Servo servo6;
 Servo servo7; 
 
 const int pot1 = A1; // Setting Analog pins for the potentiometers
 const int pot2 = A2;
 const int pot3 = A3;
 const int pot4 = A4;
 const int pot5 = A5;


 int pot1Ang; // Setting up a variable to store the angles
 int pot2Ang;
 int pot3Ang;
 int pot4Ang;
 int pot5Ang;


 int pot1Val; // For future variations 
 int pot2Val;
 int pot3Val;
 int pot4Val;
 int pot5Val;
 
void setup() {
 
 servo1.attach(2); // Telling the servo class what pins each one is attached to.
 servo2.attach(3);
 servo3.attach(4);
 servo4.attach(5);
 servo5.attach(6);
 servo6.attach(7);
 servo7.attach(8);


 Serial.begin(9600); // To read data from the serial logger.
}


void loop() {
 
  pot1Val = analogRead(pot1); // Reading the Analog values of the potentiometers.
  pot2Val = analogRead(pot2);
  pot3Val = analogRead(pot3);
  pot4Val = analogRead(pot4);
  pot5Val = analogRead(pot5);


  pot1Ang = map(pot1Val, 0, 1023, 0, 180); // Transforming the Analog data into         something the servo motors can understand.(Digital data) 


  pot2Ang = map(pot2Val, 0, 1023, 0, 180);  
  pot3Ang = map(pot3Val, 0, 1023, 0, 180);
  pot4Ang = map(pot4Val, 0, 1023, 120, 180);  
  pot5Ang = map(pot5Val, 0, 1023, 0, 180);


  servo1.write(pot1Ang);
  servo2.write(180 - pot1Ang); // Servo has to go the opposite direction of the other
  servo3.write(pot2Ang);
  servo4.write(180 - pot2Ang); // Servo has to go the opposite direction of the other
  servo5.write(pot3Ang);
  servo6.write(pot4Ang);
  servo7.write(pot5Ang);


}

Credits

Paul Vincent Bezzina

Paul Vincent Bezzina

5 projects • 7 followers
Aspiring electronics enthusiast and sixth form student. Always eager to learn and experiment with new technologies and hands-on creations.
Thanks to Eben Kouao, Unsure, and Uladz.

Comments