akssil-ga
Published © CC BY-NC-ND

Robotic Arm

"Unleashing the Power of Robotics: Wameedh Scientific Club's Arduino-Based Robotic Arm Redefines Automation"

IntermediateFull instructions provided23 hours441
Robotic Arm

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
PCBWay Custom PCB
PCBWay Custom PCB
×1
Stepper Motor
Digilent Stepper Motor
×3
Dual H-Bridge motor drivers L298
SparkFun Dual H-Bridge motor drivers L298
×1
Female/Female Jumper Wires
Female/Female Jumper Wires
×1
HC-06 Bluetooth Module
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

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

Story

Read more

Schematics

The circuit diagram

Code

The code of this project is shown below

Arduino
#include "GuiConnectHelper.h"  // Include the GuiConnectHelper library for handling commands from GUI
#include "string.h"
#include <Stepper.h>
#include <Servo.h>

Servo myservo;  // Create a Servo object for controlling a servo motor
GuiConnectHelper gcHandle;  // Create an instance of GuiConnectHelper for handling commands
const int stepsPerRevolution = 2038;  // Number of steps per revolution for the stepper motors
int art = 0, angle1 = 0;

// Define three Stepper objects with their respective pin connections
Stepper myStepper1(stepsPerRevolution, 10, 12, 11, 13);
Stepper myStepper2(stepsPerRevolution, 2, 4, 3, 5);
Stepper myStepper3(stepsPerRevolution, 6, 8, 7, 9);

void onCommandRecieved();  // Callback function for handling received commands

void setup() {
  GCH_init(&gcHandle, onCommandRecieved);  // Initialize GuiConnectHelper with the callback function

  // Set the speed of the stepper motors
  myStepper1.setSpeed(18);
  myStepper2.setSpeed(18);
  myStepper3.setSpeed(18);

  myservo.attach(A5);  // Attach the servo motor to pin A5
  myservo.write(0);   // Set the initial position of the servo motor

  Serial.begin(9600);  // Initialize the serial communication
  Serial.println("hello bimbo");  // Print a message to the serial monitor
}

void loop() {
  while (Serial.available())
    GCH_loadNextbyte(&gcHandle, Serial.read());  // Read the incoming bytes and process the commands
}

void onCommandRecieved() {
  char cmdName = GCH_GetCharCommandName(&gcHandle);  // Get the command name

  int angle, servoIndex;

  switch (cmdName) {
    case 'k':
      servoIndex = GCH_GetParamAsInt(&gcHandle, 0);  // Get the servo index parameter
      angle = GCH_GetParamAsInt(&gcHandle, 1);       // Get the angle parameter

      switch (servoIndex) {
        case 0:
          myStepper1.step(angle);  // Rotate the stepper motor 1 by the specified angle
          break;
        case 1:
          myservo.write(angle);  // Set the position of the servo motor to the specified angle
          break;
        case 2:
          myStepper1.step(-angle);  // Rotate the stepper motor 1 in the opposite direction by the specified angle
          break;
      }
      break;

    case 'b':
      char button = GCH_GetParamAsChar(&gcHandle, 0);  // Get the button parameter

      switch (button) {
        case 'U':
          myStepper3.step(102);  // Rotate stepper motor 3 in the positive direction by 102 steps
          break;
        case 'D':
          myStepper3.step(-102);  // Rotate stepper motor 3 in the negative direction by 102 steps
          break;
        case 'R':
          myStepper2.step(-102);  // Rotate stepper motor 2 in the negative direction by 102 steps
          break;
        case 'L':
          myStepper2.step(102);  // Rotate stepper motor 2 in the positive direction by 102 steps
          break;
      }
      break

Credits

akssil-ga

akssil-ga

5 projects • 5 followers
wameedh scientific club

Comments