top of page
Search

Mini Robot Arm




 


The Robot Arm is made using two Servo Motors. You are able to control the Arm's movement using a Joy Stick module. The Y-Axis on the Joy Stick controls the top half of the arm and the X-Axis on the Joy Stick controls the bottom half of the arm. By pushing on the Joy Stick the buzzer will start to buzz and the LED will turn on.


The Servo motor I am using is the MG 996R; but you can use any Servo as long as it runs off of 5V. I do not recommend using those Mini Servos which comes with most Arduino starter kits because they don't go from to 180° they go somewhere between 5° to 165°and they get jammed pretty easily.


The Joy Stick module is made from two potentiometers (Variable Resistors) and a push button. Inside a Servo motor there is a Brushed DC Motor, a Potentiometer, a Control Circuit, and some Drive Gears. The Dc motor is High Speed but low torque, the Drive Gears reduce the speed to about 60 RPM and at the same time increase the torque the potentiometer is connected to the output shaft as the motor rotates the potentiometer rotates as well thus producing a voltage that is related to the absolute angle of the output shaft; in the control circuit the potentiometer voltage is compared to the voltage coming from the signal line and if needed the controller activates the integrated H-bridge which enables the motor to rotate in either direction until the wo signals reach a difference of zero.



To calculate which angle the Joy Stick values correspond to; you will be using the Liner Interpolation formula which is y = y1 + ((x – x1) / (x2 – x1)) * (y2 – y1).



 

Components

  1. 2X Servo Motors

  2. 1X Joy Stick Module

  3. 1X Arduino UNO

  4. 1X Active Buzzer

  5. 1X LED

  6. 1X 330Ω Resistor

  7. Jumper Wires

  8. Straight Jumpers

  9. 1X Bread Board (5.5 Cm x 17 Cm)

  10. Popsicle sticks or Toothpicks (Optional)

  11. BlueTrack (Optional)



 


Code:


#include <Servo.h>

int servo_x_pin = 9;
int servo_y_pin = 10;

int x_pot = A0;
int y_pot = A1;
int button = A2;

int x_pot_val;
int y_pot_val;
int button_state;

int servo_x_angle;
int servo_y_angle;

Servo servo_x;
Servo servo_y;

int buzzer = 11;
int led = 12;

void setup() {
    // put your setup code here, to run once:
    Serial.begin(9600);
    servo_x.attach(servo_x_pin);
    servo_y.attach(servo_y_pin);
    pinMode(x_pot, INPUT);
    pinMode(y_pot, INPUT);
    pinMode(buzzer, OUTPUT);
    pinMode(led, OUTPUT);
    pinMode(button, INPUT);
    
    digitalWrite(button, HIGH);      
}

void loop() {
    // put your main code here, to run repeatedly:
    x_pot_val = analogRead(x_pot);
    y_pot_val = analogRead(y_pot);
    
    button_state = digitalRead(button);
    
    Serial.print("X_pot = ");
    Serial.print(x_pot_val);
    Serial.print(" Y_pot = ");
    Serial.print(y_pot_val);
    Serial.print(" Button = ");
    Serial.print(button_state);
    
    servo_x_angle = (x_pot_val*(60./341.));
    servo_y_angle = (y_pot_val*(60./341.));
    
    servo_x.write(servo_x_angle);
    servo_y.write(servo_y_angle);
    
    while(button_state == 0){
        digitalWrite(buzzer, HIGH);
        digitalWrite(led, HIGH);
        
        button_state = digitalRead(button);
    }
    digitalWrite(buzzer, LOW);
    digitalWrite(led, HIGH);
    
    
}


 







 



70 views0 comments

Recent Posts

See All
Post: Blog2_Post
bottom of page