Rad Silviu
Published

Mini robotic arm

Make a mini robotic arm with 2 servos and a joystick.

BeginnerFull instructions provided15 minutes2,195
Mini robotic arm

Things used in this project

Hardware components

SG90 Micro-servo motor
SG90 Micro-servo motor
×2
Arduino UNO
Arduino UNO
×1
Analog joystick (Generic)
×1
Breadboard (generic)
Breadboard (generic)
×1

Story

Read more

Schematics

Mini robotic arm

Code

Mini robotic arm

Arduino
//add the servo libary
#include <Servo.h>

//define our servos
Servo servo1;
Servo servo2;

//define joystick pins (Analog)
int joyX = 0;
int joyY = 1;

//variable to read the values from the analog pins 
int joyVal;
void setup ()
{
  //attaches our servos on pins PWM 3-5
  servo1.attach(3);
  servo2.attach(5);
}

void loop ()
{
  //read the value of joystick (betwen 0-1023)
  joyVal = analogRead(joyX);
  joyVal = map(joyVal, 0, 1023, 0, 180); //servo value betven 0-180
  servo1.write(joyVal); //set the servo position acording to the joystick value

  joyVal = analogRead(joyY);
  joyVal = map (joyVal, 0, 1023, 0, 180);
  servo2.write(joyVal);
  delay(15);
  
}

Credits

Rad Silviu

Rad Silviu

12 projects • 8 followers

Comments