Go Down

Topic: Need help with programming a robotic arm with a minimum of 3 servos (Read 2892 times) previous topic - next topic

Hi guys, I need help programming a robotic arm. The arm is a Robix kit that contains 6 servos, but if i can get 3 servos working, it is good enough. I also want to control it with a ps2 analouge controller. So far i need a robotic arm that can turn left/right up/down and activate a pincher. Any help will be great  8)

I am a noob btw, and i need it for a school project :smiley-mr-green:

Drew Davis

Would be glad to help but could you please give us a link to the kit.

Also, what Arduino are you using.

Btw once the first servo is working the other 5 will be easy!

Thanks for showing interest :)

The link : http://www.robix.com/contents.html

I am also using an Ardiuno uno, i got like a couple days ago

Can I use the Bill Porter schematic for hookin up my ps2 analouge controller?

Drew Davis

#4
Feb 26, 2013, 01:28 am Last Edit: Feb 26, 2013, 01:33 am by Drew Davis Reason: 1
To be honest I don't know how to use the ps2 controller but I can show you how to move your servos.

To control a servo you will need to use all three wires coming from it. The yellow one should be connected to a pwm pin on your Arduino. The black wire is ground and the red is live. You will need a 5v power supply. If you try to pull power from you Arduino you will destroy it. A battery pack or a wall wort should do the trick. Simply put the positive wire from the power source to the positive wire of your servo. Do the same with the ground wire.

Try just one servo to start with and use the code below. Once you get it working try to adapt the program to control 6 servos if you can't I will show you how.

Code: [Select]
#include <Servo.h>

Servo myservo




void setup()
{

 myservo.attach(9); // plug the servo into pin 9

}

void loop()
{
 

myservo.write(45);  

delay(1200);

myservo.write(180);

delay(1200);
}

Drew Davis

Also, make sure the servo you use is not connected to the arm!


If you can give me the link to the controller and the receiver I will look at them and see if I can figure out how to program it.

http://www.billporter.info/2010/06/05/playstation-2-controller-arduino-library-v1-0/

I was actually planning to do the cheapest way possible without a transmitter and a receiver. A direct link with the controller and arduino, and then the arduino to the servo(s)

http://www.youtube.com/watch?v=FKj9jJgj8Pc

This video helped me a little, but i still need to control it with a ps2 controller.

The trial run with one servo was successful, thank you  :)

Drew Davis

I get it now. That is much easier to program then if it was wireless.  It so cool… I want one :)

From what  I can see you will need 5 servos and 5 buttons.

1. up
2. down
3. left
4. right
5. pincher.

What buttons on the controller do you want to use for those motions. I was thinking the group of buttons on the left of the controller for motion and maybe one of the ones on the back side to activate the pinch?

Chose which one you want and we can start programing. Also do you have any experience in C?

I have absolutely no experience in C, I am a junior in high school and I am just starting off :smiley-red:. Ive seen a couple of tutorials on youtube but none really help me out. Although I have no experience this field really intrigues me and sheer amount of things one can create with an arduino. :smiley-mr-green:

Drew Davis

I'm also in high school, but have been at this for a while.

Do you know what buttons you want to use?

I have found this book to be an awesome help…
http://www.amazon.com/Beginning-Arduino-Programming-Apress/dp/1430237775

Drew Davis

Look into the robofest competition thats what got me started!

im good with using the left pad to control movement, and the bumpers on the back of the joystick for the pincher :) Thank you so much guys :smiley-sweat:

Drew Davis

I have 2 midterm tests this week so I don't know if I will be able to wright up an example for you this week. Unless somebody gets to it faster I should have something during spring break (next week).


wildbill

Search the forums for posts by Zoomkat - his test code for servos should get you started with one axis and once you have that it should be easy enough to add others.

Go Up