Shop OBEX P1 Docs P2 Docs Learn Events
Servo control — Parallax Forums

Servo control

TyUMOTyUMO Posts: 2
edited 2007-05-04 16:55 in Robotics
I am working on a Human Powered Submarine for my capstone class, I have a 2 axis joystick controlling 4 servos. I need one of the axis' on the joystick to move one of its two servos counter clockwise and the other one clockwise. This way the control surfaces, that the servos control, rotate the same direction. Thanks for any help.

Comments

  • FranklinFranklin Posts: 4,747
    edited 2007-05-04 16:03
    Could you not have the servo move a rod connecting both surfaces? (like they do on the elevators on a model plane)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2007-05-04 16:07
    How are the joystick, servos and microcontroller interfaced and how are you accessing the joystick variables.
    Are the servos continuous or not and do you need control of speed / angle.
    Do you want motion from 8 of the joystick positions or 4.

    Jeff T.
  • TyUMOTyUMO Posts: 2
    edited 2007-05-04 16:15
    The joystick is an analog playstation joystick, the signals are sent from that to the bs2p controller. We just have a simple code to move them with the joystick. The servos are wired directly to the outputs of the chup.

    DEBUG "Program Running!"

    time·········· VAR· Word
    DO
    · HIGH 7
    · PAUSE 10
    · RCTIME 7, 1, time
    · time = time */ 500
    · time = time + 400
    · PULSOUT 14, time
    ·HIGH 7
    · PAUSE 10
    · RCTIME 7, 1, time
    · time = time */ 500
    · time = time + 400
    · PULSOUT 13, time
    · HIGH 8
    · PAUSE 10
    · RCTIME 8, 1, time
    · time = time */ 500
    · time = time + 400
    · PULSOUT 12, time
    · HIGH 8
    · PAUSE 10
    · RCTIME 8, 1, time
    · time = time */ 500
    · time = time + 400
    · PULSOUT 15, time
    LOOP
    ·
  • Mike GreenMike Green Posts: 23,101
    edited 2007-05-04 16:55
    One obvious piece is that the servo pulse repetition rate is too slow.
    The servos should be getting pulses about every 20ms and you've got at least 40ms just of PAUSEs.

    Another observation is that you're reading the joysticks twice. Is that necessary?
    How about reading the one on pin 7 once, then doing the two PULSOUTs in succession (pin 14, then pin 13)?
    That would also eliminate a pair of PAUSEs and get the loop time down to a bit over 20ms which is ok.

    Generally, pulse widths less than 1.5ms result in movement of the servo in one direction while
    pulse widths greater than 1.5ms result in movement of the servo in the other direction. You
    could do the first PULSOUT using time, then the second using 750-time (for a BS2's timing granularity).

    Obviously, you'd handle the other joystick axis and the other two servos the same way.
Sign In or Register to comment.