PDA

View Full Version : robotic arm...



shirleyz
- 29th May 2008, 12:17
do anyone know how to control the servo motor of the robotic arm...i'm using three servo..so planning to use picbasic...

Acetronics2
- 29th May 2008, 12:43
Hi,

May be you should begin by one of such sites ... ( "robotics" KEYWORD for Google ...)

http://www.mcmanis.com/chuck/robotics/

But it's just my own opinion ...

Alain

malc-c
- 30th May 2008, 09:06
do anyone know how to control the servo motor of the robotic arm...i'm using three servo..so planning to use picbasic...

Assuming you mean a "standard" RC servo? You need to generate a 1 to 2ms pulse every 20ms for each servo. Most RC servos use 1.5ms as the centre position, 1ms for minimum position, and 2ms for max. Depending on the physical limits of the servo, you might be able to get enough angular movement of each arm to do something useful (aka like the Lynx5)
http://www.lynxmotion.com/images/jpg/l5arm3.jpg

shirleyz
- 30th May 2008, 10:47
hi,

yes, i mean a standard RC servo. if i'm using 20Mhz oscillator, izzit still the same..i mean izzit 1ms for min, 2ms for max and 1,5ms for centre??
can i have some sample code using picbasic..i know must use pulseout, rite??

thx

Jumper
- 30th May 2008, 11:38
This depends what you want to do. Do you want your pic to be more or less dead for 30% of the time or do you plan to do more things?

The thing is that you should update your 3 servos for the arm every 20 ms to keep them in the right position. If you don't do that they can start to drift or loose torque so they will become weak. If all your 3 servos are in the max position you will be spending 3*2ms waiting and then you have 14 ms for other stuff... in fact your PIC will seem to be locked up for 15-30% of the time depending where your arm is.

What you need to have here is an interupt routine that executes every 20 ms and inside this routine you should use a second timer to generate a new interupt for each servo. With DT's interupts you can easily set this up. In your case at 20 MHz you would have a variable for each servo with a value from 5000 to 10000 (representing min and max) depending on your servo position.

All this of course comes down to if you have any timers availible. If you dont have that you better try to make a fast main loop where you use high and low (or =1 , =0) to set the pins manually.

I would go for the interupt solution, sure it might be a bit harder in the beginning but after you have made this you can write more or less anything you want in your main loop and that will not affect your arm in any kind of way. Your main loop just need to set the variable value for each servo and the interupt routine will keep the servos there for you.

I know is sucks that I didnt give you any code but I dont think it is time for coding yet until you have figured out what you want your PIC to do.

Maybe you also want your PIC to do other things such as following a line and then you can not wait for stuff to finish before you try to correct the heading again....

/me

malc-c
- 30th May 2008, 12:09
hi,

can i have some sample code using picbasic..i know must use pulseout, rite??

thx

Thats the fun part of these projects, writing your own code, experimenting with different bits of hardware, and learning how/why these things work, and to develop your electronics skills.

You'll also receive more help when people see that you have tried to develop something for yourself rather than asking others to do all the work for you ;)