Servo Motor / Robotic Arm GUI

by HACKER in Circuits > Arduino

249 Views, 5 Favorites, 0 Comments

Servo Motor / Robotic Arm GUI

Robotic Arm GUI-Cover.jpg
Screenshot 2024-08-29 120912.png

This Project is for the Microcontrollers Contest. I'm a 13 years old student from Wycherley International School Colombo (Sri Lanka). This project is mainly based on controlling projects that involve with servo motors, specially Robotic arms.

Supplies

To make this project you we need;

  1. An Arduino (Arduino Uno)
  2. Some jumper wires
  3. A breadboard
  4. Some servo motors

And that's all you will need for this project, if you have a robotic arm or any project with servo motors you can use them.

Software and Code

Screenshot 2024-08-29 120912.png

First of all you must know the code of this project. This is the link to download the Software (https://drive.google.com/file/d/1hpI_DEqP04iCi5y8TBkhbzimQvCUXf6q/view?usp=sharing). DO NOT CAHNGE ANTHING IN THE FOLDER. Bellow is the Arduino code.

#include <Servo.h>

Servo servo_0; // Declaration of the object to control the first servo
Servo servo_1; // Declaration of the object to control the second servo
Servo servo_2; // Declaration of the object to control the third servo
Servo servo_3; // Declaration of the object to control the fourth servo
Servo servo_4; // Declaration of the object to control the fifth servo
Servo servo_5; // Declaration of the object to control the sixth servo
Servo servo_6; // Declaration of the object to control the sixth servo

void setup() {
Serial.begin(9600); // Initialize serial communication
servo_0.attach(2); // Associate servo_0 to pin 2
servo_1.attach(3); // Associate servo_1 to pin 3
servo_2.attach(4); // Associate servo_2 to pin 4
servo_3.attach(5); // Associate servo_3 to pin 5
servo_4.attach(6); // Associate servo_4 to pin 6
servo_5.attach(7); // Associate servo_5 to pin 7
servo_6.attach(8); // Associate servo_5 to pin 8
}

void loop() {
if (Serial.available() > 0) { // If data is available to read
String input = Serial.readStringUntil('\n'); // Read data string up to line break
int servoIndex = input.substring(0, 1).toInt(); // Get servo index
int servoValue = input.substring(2).toInt(); // Get servo value

switch (servoIndex) {
case 1:
servo_0.write(servoValue);
break;
case 2:
servo_1.write(servoValue);
break;
case 3:
servo_2.write(servoValue);
break;
case 4:
servo_3.write(servoValue);
break;
case 5:
servo_4.write(servoValue);
servo_6.write(180 - servoValue);
break;
case 6:
servo_5.write(servoValue);

break;
default:
// Invalid servo index
break;
}
}
}

Downloads

Circuit Diagram

Stunning Tumelo.png

Now connect the motors according to the Circuit diagram here. You can use 6 or less. The signal pins are from 2 to7.

About Software

Now open the file (DO NOT CAHNGE ANTHING IN THE FOLDER) extract it and click on GUI_servo.exe, which will open the application. And connect the Arduino before you run the application.

Success

Screenshot 2024-08-29 120912.png
Gui Demo

Now click on the drop down button and click on the COM port of your Arduino. And you can control the servo motor successfully, also you can record and run positions of the motors. Watch this demonstration video.