I am working on an Arduino based Robot Arm. Some parts arrived, some didn't, and I had some problem with the ones that arrived, than I made this project.
You will need
-Servos and brackets/claws for them
-16*2 LCD (or better)
- Dual axis joystick
-Power source, and something to measure the power(I used an "USB Charger Doctor")
-If the servo is acting up, than you may need a capacitor, I used a 4700uF 16V capacitor, but anything is good above 470uF
Step 1: Making the Connections
MG955 or similar big servos need a lot of power what would kill the arduino, so use external power source. If you have an USB to jumper cable than use that, if you don't:
Cut off the mini/micro usb end, you will find 4 or 2 wires. You will need the Red and Black wire, solder them to jumper cable. You either cut one cable half, or use a black and a red jumper cable, both of them is good, but remember to which is which. Plug them into the breadboard.
Connect the LCD the way you always do, I used one with 4 pin(Vcc, GND, SDA, SCL), if you use something else you need to change the code too.
5V to 5V
GND to GND
VRx to A1(analog 1)
VRy to A0
SW is not necessary
5V to 5V
GND to GND
servo1 to 9/D9 (digital 9)
servo2 to 10
Step 2: The Code
You can find the code here.
Some changes you may need to make
-You may need to change the LCD controller to the one you always use
-in 32. row I used 140 as default position because my claw go from 116 to 180, if you use an other bracket or something change to the middle point
-in 53 and 55 row I used 518 and 511, that's because that's my default joystick position
-in 58 and 59 as I said my claw is goes from 116 to 180,and the one in the bracket goes from 53 to 180, so this code function to not exceed servo limits
Step 3: Without the Calibration
As you can see if I exceed the 116 or 53 it starts to drain more power(killing the power source), and stuck there. I can't move it afterwards
Step 4: With the Calibrating
As you can see, now it doesn't jam
Step 5: Calibrating
Change the 58 and 59 line to ...0,180); so the servos can move everywhere
Upload the code
Slowly start moving the joystick, so it will change the pos one by one. If you reached the critical angle read it from the LCD, and restart with the other servo. You may need to move back the first servo.
If you have the values your servo can't exceed subtract it by 3-4 degree just to be safe.
Write these values into the 58-59 line and upload the new code. And if it's still acting up subtract an other few degree
If everything works fine, you can copy the constrain() to other your projects and never fear again