Robotic Arm Project Using Arduino and Servo Motor
Brief Description
We are providing basic information to learn and make the robotic arm which we make can move in different directions by using Arduino which is a microcontroller whose functioning is controlled by ATmega328p IC.
We use Servo Motors to control the movement of the robotic arm. We can move the robotic arm in the desired direction with the help of a Joystick Module.
Please make the circuit according to the circuit diagram and then upload the Arduino code which is provided in the last.
Note: There are many variants of Arduino available in the market but we use Arduino UNO for this project.
How Does it Work?
The robotic arm which we make can move in both positive and negative X and Y axis (2-D) with the help of two servo motors. We use the Joystick module for giving the commands. We can control the motion of servo motors through it. Mount one of the servo motors on the other using the attachments or you can also use a cardboard piece such that both can move comfortably in the desired direction. After completing all the procedures just move the Joystick in a random direction and your robotic arm will follow your commands. The benefits of using the Servo motor are that we can easily control its position and the degrees we want it to move. The response of the robotic arm is very quick and you can control it as per your choice.
Components Required
Circuit Diagram
Make the connections according to the above circuit diagram.
Connect the positive wires of both the servo motors to the 5-volt pin of the Arduino. Attach the negative wires of both the servo motors to the GND pin of the Arduino. Join the VCC of the Joystick module to the 5-volt pin of the Arduino and the GND pin of the module to the GND pin of the Arduino. Use the breadboard for making these connections and to supply a common 5volt supply from the Arduino. Connect the servo motors’ data pins to the digital 8 and digital 9 pins of the Arduino. Attach the VRX pin of the joystick to the analog 0 pin of the Arduino and VRY to the analog 1 pin of the Arduino. Please left the SW pin of the joystick as it is.
After completing the circuit upload the given Arduino code.
Upload the Arduino code which is given below as it is. You have to install <Servo.h> for the proper working of the project.
//Robotic_arm_code
#include <Servo.h>
const int servo1 = 8; // first servo
const int servo2 = 9; // second servo
const int joyx = 0; // joystick module
const int joyy = 1; // // joystick module
int servoVal; // read the value from the analog pin
Servo myservo1; // create servo object to control a servo
Servo myservo2;
void setup() {
Serial.begin(9600);
myservo1.attach(servo1);
myservo2.attach(servo2);
}
void loop(){
servoVal = analogRead(joyx);
servoVal = map(servoVal, 0, 1023, 0, 180); // set the position of the first servo
myservo2.write(servoVal);
servoVal = analogRead(joyy);
servoVal = map(servoVal, 0, 1023, 70, 180); // set the position of the second servo
myservo1.write(servoVal);
delay(15);
}
DO IT YOURSELF … AND STAY SAFE AT HOME
*Please contact us if you need any assistance or support.
Leave a reply