Shop OBEX P1 Docs P2 Docs Learn Events
continuous rotation servo position control — Parallax Forums

continuous rotation servo position control

no fearno fear Posts: 2
edited 2006-12-13 23:57 in General Discussion
Okay, so I'm very new to Basic Stamp, but I've used other programming applications so I can figure most of the things out.

·My real problem is that I need to get a Parallax Continuous Rotation Servo (CRS from now on) to move at fairly precise positioning Using BSII.· Ultimately,·i need to get a cycle going where one CRS rotates 360 degrees, and another one just after rotates exactly 60 degrees (hysteresis would be very bad.)· I tried using the PULSOUT command, but of course, getting the servo to rotate to a precise location is very difficult, I.E. I either get over rotation or under rotation, and this then translates.· So if I run my code, it will say rotate 358 degrees instead of 360, and then 354 and then 352 and so on.· Is there any way to get a CRS to run without this sort of instability?· Heres the code i've been working with, excuse its simplicity.

' {$STAMP BS2}
' {$PBASIC 2.5}
counter VAR Word 'Work space for FOR NEXT
Servo_pin CON 0 'I/O pin that is connected to servo
FOR counter = 0 TO 397
PULSOUT servo_pin,3
PAUSE 2
NEXT
STOP

I think the pulsout option is not good for this application, but i have no idea what else could be done.
·

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2006-12-13 23:13
    The real problem is that continuous rotation servos are simply not designed for this type of use. The motors are not precise in speed, there's some play in the gears, etc. Even a conventional servo is not quite that accurate although it will reposition itself fairly well repeatedly. Even if you had precise feedback (with an encoder or variable resistor mechanically attached to the servo output shaft), it would be difficult to get accuracy to a degree or so without some hunting at the end. There's just too much mechanical play.

    You could use a DC motor with a gearbox and position encoder or a stepper motor with a gearbox and the appropriate driver hardware. There are also some more sophisticated servos like those from CrustCrawler that have a digital controller and better position feedback. I don't know if they have a continuous rotation equivalent.
  • no fearno fear Posts: 2
    edited 2006-12-13 23:20
    thanks for the info...how would i control a stepper motor on the bs2? What sort of programming is used?
  • Mike GreenMike Green Posts: 23,101
    edited 2006-12-13 23:57
    Parallax has some stepper controllers like this (www.parallax.com/detail.asp?product_id=27938) that are controlled with a serial command stream (look at the documentation). You could make your own driver hardware since it just involves 4 power MOSFETs, a couple of resistors, and diodes for back-EMF protection. The coils are not too different from relays and the "What's a Microcontroller?" tutorial (www.parallax.com/dl/docs/books/edu/wamv2_2.pdf) talks about controlling those from a Stamp. The Stamp just needs to activate the coils in order by writing a moving bit pattern to a set of 4 pins. A sophisticated controller will allow the motor to run on a higher peak voltage for rapid stepping, yet limit the average current to avoid overheating the coils by using Pulse Width Modulation (PWM).
Sign In or Register to comment.