Servo controller HELP!!!!
mphillips
Posts: 12
I am currently making a robotic arm for digital class with a bs2 and 4 servos. I got the basic code from "experiment #25 hobby servo control" The only problem is that the sweep of the servo is about 22.5 degrees if that. How can i modify to get at least 90 degrees of sweep. What is the deciding factor in the code that says how much distance the servo covers.
Heres the code I am using:
4 servo control.bs2
Heres the code I am using:
4 servo control.bs2
Comments
PULSOUT servo2, (750 + sPos)
So the pulse will always be at least 1500usec (750 * 2us)
Change the 750s to 500, or 600. What results?
Try getting this to work with one servo and make all the other RCTIME / PULSOUT stuff into comments, then add one servo at a time to see when it stops working. You'll probably find that two servos will work, but not three. If you switch to a faster Stamp like the BS2px, you may find that you can use three or four servos, but you will have to adjust the calculations because the time unit for that is not 2us. I think it's 0.8us, but you'll have to check the Stamp Manual or help files for the exact values.
(750 + sPos) determines servo position for god sake. Inasmuch, for god sake, the pulse out will always be 1500 (which is 750 * 2) + whatever sPos is, for god sake. 1500us is midposition (or thereabout), for god sake. What, for god sake, is the argument?
Re: 1 -- While not strictly true, a decent generalization is that 1000us (1ms) is about 45 degrees off-center for a "normal" servo. 2000us is 45 degrees off-center the other way. 1500us is "center". For servos with something like a 180 degree range, a good starting place is 500us at one end and 2500us at the other. If you think of it in microseconds, it's easier, and then the flavor of Stamp (i.e. what is the "unit" for a pulsout) is trivial, e.g.
Or, enter a value in us and put the servo there:
Re: 2 -- what Mike Green said
Mike I have made a code with just one servo like the one in experiment 25. I have the same result as with 4 servo code. I have to move one servo at a time though. I cannot control two at the same time, i realize that two movements simultaneously wont happen
I really only need to control 3 servos to get my project done.I just need to get a wider sweep with one. then i can figure out how to make them all work.
Let me try to ingest this info and maybe i will realize what u guys are trying to tell me. Im a little slow sometimes.
Mike thanks again for the in depth reply. U helped me a few weeks ago to figure out how to get multiple servos moving. Now i am just trying to get a wider range of movement.