brambi001
Published © LGPL

Mini robotic arm

A little robotic arm(homemade) with 3 mini servos!

IntermediateProtip246
Mini robotic arm

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
×3
9V battery (generic)
9V battery (generic)
×1
Analog joystick (Generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×14

Story

Read more

Schematics

Wiring scheme

I couldn't find the joystick module so i put a random connection there, in the code there's written where to connect each pin.
Same thing fo the power supply module that i used for the 9V battery, you can either use that or just connect the + and - to the board

Code

Code

C/C++
//joystick:connect the 5V pin to 5V on the board, the GRD pin to GRD on the board, the X axis to the analogic pin 0, the Y axis to the analogic pin 1 and the SW pin to the analogic pin 3
//servo n.1:connect the red cable to the 5V on the board, the brown/black cable to GRD on the board and the yellow/orange cable to the pin 3
//servo n.2:connect the red cable to the 5V on the board, the brown/black cable to GRD on the board and the yellow/orange cable to pin 5

#include <Servo.h>//include the servo library

Servo servo1;//define the name of the servo n.1
Servo servo2;//define the name of the servo n.2
Servo servo3;//define the name of servo n.3
int X=0;//define which analogic pin the X axis of the joystick is attached to on the board
int Y=1;//define which analogic pin the Y axis of the joystick is attached to on the board
int SW=3;//define which analogic pin the SW is connected to 
int ServoVal;//create a value for the servo motors

void setup() {
  servo1.attach(3);//define which pin to attach the servo n.1
  servo2.attach(5);//define which pin to attach the servo n.2
  servo3.attach(7);//define which pin to attach servo n.3
}

void loop() {
  ServoVal=analogRead(X);//set the value of the servo as the analogic read of the X axis of the joystick
  ServoVal=map(ServoVal, 0, 1023, 0, 180);//map the values for the joystick
  servo1.write(ServoVal);//write the value on the servo n.1
  
  ServoVal=analogRead(Y);//set the value of the servo as the analogic read of the Y axis of the joystick
  ServoVal=map(ServoVal, 0, 1023, 70, 180);//map the values for the joystick
  servo2.write(ServoVal);//write the value on the servo n.2
  delay(15);//a bit of delay to avoid rebounce

  if(analogRead(SW)==LOW) {
    ServoVal=180;
    servo3.write(ServoVal);
  } if(analogRead(SW)==HIGH) {
    ServoVal=0;
    servo3.write(ServoVal);
    }
  }
//doing so you can move the servo motors using X and Y axis of the joystick

Credits

brambi001

brambi001

6 projects • 2 followers

Comments