Shop OBEX P1 Docs P2 Docs Learn Events
Servo motor problems,please help!! — Parallax Forums

Servo motor problems,please help!!

bumble88bumble88 Posts: 7
edited 2006-11-04 13:46 in Robotics
Hi,

I'm doing the 2DOF·hexapod walking robot.
This is the program that I used to test on the servo motor. But somehow the servos keep on moving to the same direction regardless of how I tune it inside the program. 750 is the middle value and the range is 500 to 1000.
·
'
[noparse][[/noparse] TestPscchannel.BS2 ]

' {$STAMP BS2px}
' {$PBASIC 2.5}
'
' Use this program to test PSC channels
·
'
[noparse][[/noparse] I/O Definitions ]

PSC············ PIN···· 7············· ' PSC module
PSC········· ···PIN···· 8············· ' PSC module
·
·
#SELECT $STAMP
· #CASE BS2SX, BS2P
··· Baud······· CON···· 1021 + $8000
· #CASE BS2PX
··· Baud······· CON···· 1646 + $8000
· #CASE #ELSE
··· Baud······· CON···· 396 + $8000
#ENDSELECT
·
·
'---- [noparse][[/noparse]Walking Variables]

servoPosition·· VAR···· Word················· ' Servo Position
servoAddr······ VAR···· Byte················· ' Servo addresses
ramp········· ··VAR···· Byte················ ' Ramp used in SEROUT
·
'_________________________________________________________________________
·
Main:
'---- [noparse][[/noparse] Move channel 7 & 8 to normal position ]

· ramp = 8·············· 'Rotation speed (ramp)
· servoAddr = 7········· ·'PSC channel 7
· servoPosition = 750··· ········ ·'Position
· GOSUB Write_PSC····· 'Write to PSC
·
· ramp = 8·············· 'Rotation speed (ramp)
· servoAddr = 8········· ·'PSC channel 8
· servoPosition = 750··· ········ 'Position
· GOSUB Write_PSC····· 'Write to PSC
· PAUSE 1000············ 'Wait 1 seconds to provide
························ 'servos time to reach position
·
'---- [noparse][[/noparse] Move channel 7 & 8 to 900 ]

· ramp = 8·············· ··· 'Rotation speed (ramp)
· servoAddr = 7········· ··········· ··········· 'PSC channel 7
· servoPosition = 550··· ········ ··········· 'lift the leg
· GOSUB Write_PSC······· 'Write to PSC
·
· ramp = 8·············· ··· 'Rotation speed (ramp)
· servoAddr = 8········· ······················· 'PSC channel 8
· servoPosition = 550··· ········ 'forward the leg
· GOSUB Write_PSC····· ······ 'Write to PSC
· PAUSE 1000············ ··········· 'Wait 1 seconds to provide
························ ·········· 'servos time to reach position
GOTO Main
·
'_________________________________________________________________________
·
Write_PSC:
· SEROUT PSC,Baud,[noparse][[/noparse]"!SC",servoAddr,
········ ramp,servoPosition.LOWBYTE,
········ servoPosition.HIGHBYTE, CR]
RETURN

Comments

  • Paul BakerPaul Baker Posts: 6,351
    edited 2006-11-03 17:23
    Have you centered your servo?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-11-03 19:18
    The PULSOUT 'tick' size varies based on the BS2 model being used. You MUST have a pulse size of 1 mSec to 2 mSec -- where 1.5 mSec is 'centered'.

    On a BS2, there's 2 uSec per 'tick', so a value of 750 'ticks' is 1.5 mSec. I believe the BS2px has a different sized 'tick' -- you'll have to check the manual under PULSOUT to find the right number of 'ticks' for 1.5 mSec on the BS2px.
  • FranklinFranklin Posts: 4,747
    edited 2006-11-03 19:43
    '
    [noparse][[/noparse] I/O Definitions ]
    PSC PIN 7 ' PSC module
    PSC PIN 8 ' PSC module

    Is this what you intended? I don't know the psc syntax

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-11-03 20:27
    Hello,

    [b]' -----[noparse][[/noparse] I/O Definitions ]------------------------------------------------[/b]
    [b]PSC             PIN     7              ' PSC module[/b]
    [b]PSC             PIN     8              ' PSC module[/b]
    
    

    This section of your code should generate a symbol already defined error since you're trying to use the same label for more than one value.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • bumble88bumble88 Posts: 7
    edited 2006-11-04 13:46
    Hi,

    Actually we have tried the program that I have·posted earlier on and it works·just fine in the beginning. The hexapod walking robot legs are able to move front and back.·However, there·is·an accident. The servo controller got burn.

    Does this incident affect other electrical components like BOE, servo motor wires? Since that incident, our servo motors did not function in the way·that we have wanted. We always thought that our programs are having problems.

    We even tried with a new servo controller. The problem still·remains the same.
Sign In or Register to comment.