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

Servo Controller

don_sdon_s Posts: 35
edited 2006-11-08 17:34 in BASIC Stamp
I just hooked up my server controller to the BOE. Keyed in the VER? (version) program. Never did get the version. I have used pins 12 - 15 (15 is used in the program). Tech is closed today, so does anyone have any suggestions?

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2006-11-04 22:28
    See this thread:
    http://forums.parallax.com/showthread.php?p=612151
    Is that what you experience?

    regards peter
  • don_sdon_s Posts: 35
    edited 2006-11-05 00:48
    I dont think so. I did change to a different BOE (Rev. C) and I did get the version # of 1.4. I then entered the program to ramp up one servo (Pin 11) and got nothing.

    Question 1. Will the controller not work on previous BOE's. The other I have is a REV B.

    Question 2. What should I look for to determine why the controller is not operating the servos..

    Thanks
    Don S
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-11-05 01:33
    Don,
    ·
    ·· Be sure you’re only powering the PSC from 5V.· The Rev B BOE (if Serial) will have Vin at its Servo Headers if you’re using them.· You should be able to use the BOE just fine.· You said you got the version to work before, so it sounds like the PSC is responding.· Which model BASIC Stamp do you have?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • don_sdon_s Posts: 35
    edited 2006-11-05 04:39
    I Have a BS2. I think I see my problem with my first BOE, but I am still not getting the servos to respond to the example program.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-11-05 05:33
    Don,
    ·
    ·· How are you powering the servos?· The PSC runs its logic from the BOE, but you need power for the servos as well.· Is the switch on the PSC on?· Is there a jumper block across the 2-pin header?· If so remove it.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • TechnoRobboTechnoRobbo Posts: 323
    edited 2006-11-05 17:12
    I'm wondering if you set the higher baud rate before you used the “!SCVER?” command
    A few·notes:

    1.Resetting the Stamp does not reset the PSC. Run the code below first to synchronize Baud rates at the beginning of the any program. I use a DPDT switch to power my PSC Servo Power and BS2 simultaneously.
    2. The PSC's LED shows you if your communicating. - I find it very useful.
    3. Make sure the Servo Power switch is "on" I power the servos from 4 AA in series using a RadioShack battery harness (see they do still sell usefull parts).
    4. Make sure the jumper is not installed. unless your daisy chaining, but you stated your using pins 11,·12 and 15 so i guess your not.
    5. Please note the goofy numeration of the pins - even on left side, odd on right.· Messed me up.

    I find the PSC works flawless - seriously.· I dont bother storing the servo positions I just ask the PSC. It's fast and it·storage space.

    The code below:
    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    · SERVO PIN 15· 'Servo Interface
    · BAUD· CON $818C 'initial baud
    · HiBAUD CON 6
    · PW VAR Word 'Servo Command

    · ServoInit:
    · SEROUT SERVO, HiBAUD,[noparse][[/noparse]"!SCSBR",0,CR]'Slow PSC down if reset occurs
    · PAUSE 100
    · SEROUT SERVO, BAUD,[noparse][[/noparse]"!SCSBR",1,CR]'set high baud

    · pw=825 'stop code for my servos - not parallax servos - yours may differ

    · 'set drive left and right servos to stop
    · SEROUT SERVO,HiBAUD,[noparse][[/noparse]"!SC",12,0,pw.LOWBYTE,pw.HIGHBYTE,CR]' your pin might not be 12
    · SEROUT SERVO,HiBAUD,[noparse][[/noparse]"!SC",14,0,pw.LOWBYTE,pw.HIGHBYTE,CR]' your pin might not be 14



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Have Fun


    TR
  • don_sdon_s Posts: 35
    edited 2006-11-07 02:54
    Thanks for your reply. I am getting closer but still feel a long way from where I want to be. If you will look at the code and tell my what is wrong.
    I can get the servo on 12 to work correctly, The servo on 13 always wants to run in reverse and never stops.
  • PARPAR Posts: 285
    edited 2006-11-07 06:50
    don_s said...
    Thanks for your reply. I am getting closer but still feel a long way from where I want to be. If you will look at the code and tell my what is wrong.
    I can get the servo on 12 to work correctly, The servo on 13 always wants to run in reverse and never stops.
    Your code assumes that "760" centers (or stops) the servos. Apparently, that's a suitable value for the servo on pin 12, but not for pin 13's servo.

    You probably need to "center" (calibrate) that servo (or vary the value from 760 to other nearby values (e.g., 750, 740, 770 780) to find which value brings you closer to centering/stopping that one servo.

    PAR
  • don_sdon_s Posts: 35
    edited 2006-11-07 12:48
    I have gone back to the boe and that is the number that will stop both servos. I also check the forward and reverse numbers. Again 12 works as I thought it should but 13 does not.
    No matter what # in put in for 13 it always runs in reverse and never stops.

    Don_S
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-11-07 13:08
    Don -

    When you say "BOE" are you speaking ot the BOE-Bot or the Board of Education carrier board?

    Are both of these R/C servos the same make and model?

    Are both wired the same way?

    Are they independently powered, or are both powered from the same source?

    Is the source of power external to the board on which the Stamp is mounted?

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • don_sdon_s Posts: 35
    edited 2006-11-07 15:32
    I'm sorry forgot the facts!!

    Yes the servos are connected to the BOE-BOT. The servos are the same ones supplied with the kit (Parallax).
    I have used the servos on the boe-bot with no problem.
    I have the servos powered through the "PSC" as an outside source.
    I have two power sources, one for the BOE-Bot and one for the servos on the "PSC".

    I modified the code to comment out all the controls to 12 and put each servo on 13 to verify that I dont have a servo problem. Both servos work on the pin 13. (the servos ran in the direction that they should)

    Don_S
  • PARPAR Posts: 285
    edited 2006-11-07 15:40
    don_s said...
    ...I have the servos powered through the "PSC" as an outside source.
    I have two power sources, one for the BOE-Bot and one for the servos on the "PSC".
    ...
    Do the PSC and the BOE-Bot share a common ground?

    PAR
  • don_sdon_s Posts: 35
    edited 2006-11-07 15:58
    I would have to assume yes. I connected the two using the jumper wire. There was no mention of using a seperate ground. My electronics experience is very little, so if this is needed can you explain why?

    Thanks
    Don_S
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-11-07 16:21
    Don,
    ·
    ·· Can you post a minimum piece of code to move the servos that demonstrates the problem you are seeing?· If so I will connect one up here and see what is going on.· Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • don_sdon_s Posts: 35
    edited 2006-11-07 16:45
    Hows this?
    ' {$STAMP BS2}
    '{$PBASIC 2.5}
    Servo PIN 15 ' Servo Interface
    Baud CON $818C ' Initial Baud
    HiBaud CON 6
    Pw1 VAR Word ' Servo Command
    Pw2 VAR Word ' Servo Command
    ra VAR Byte
    cha VAR Byte
    chb VAR Byte

    Ra = 30
    cha = 12
    chb = 13

    GOSUB Servoinit
    pw1 = 500
    pw2 = 1000
    SEROUT Servo, Hibaud,[noparse][[/noparse]"!SC", cha, ra, pw1.LOWBYTE, pw1.HIGHBYTE, CR]
    SEROUT Servo, Hibaud,[noparse][[/noparse]"!SC", chb, 30, pw2.LOWBYTE, pw2.HIGHBYTE, CR]
    PAUSE 2000

    pw1 = 760
    pw2 = 760
    SEROUT servo, hibaud,[noparse][[/noparse]"!SC",cha,30,pw1.LOWBYTE, pw1.HIGHBYTE, CR] ' Right Pin
    SEROUT servo, hibaud,[noparse][[/noparse]"!SC",chb,30,pw2.LOWBYTE, pw2.HIGHBYTE, CR]
    PAUSE 2000

    pw1 = 1000
    pw2 = 500
    SEROUT servo, hibaud,[noparse][[/noparse]"!SC",cha,30,pw1.LOWBYTE, pw1.HIGHBYTE, CR] ' Right Pin
    SEROUT servo, hibaud,[noparse][[/noparse]"!SC",chb,30,pw2.LOWBYTE, pw2.HIGHBYTE, CR]
    PAUSE 2000

    pw1 = 760
    pw2 = pw1
    SEROUT servo, hibaud,[noparse][[/noparse]"!SC",cha,30,pw1.LOWBYTE, pw1.HIGHBYTE, CR] ' Right Pin
    SEROUT servo, hibaud,[noparse][[/noparse]"!SC",chb,30,pw2.LOWBYTE, pw2.HIGHBYTE, CR]
    PAUSE 2000

    DEBUG "Leave Mainline", CR

    STOP

    ServoInit:
    SEROUT Servo, Hibaud,[noparse][[/noparse]"!SCSBR",cha,CR] ' Slow PSC down if Reset Occurs
    PAUSE 100
    SEROUT Servo, Baud,[noparse][[/noparse]"!SCSBR",chb, CR] ' Set High Baud

    pw1 = 760
    pw2 = 760 ' Stop Code For Servos
    SEROUT servo, hibaud,[noparse][[/noparse]"!SC",cha,0,pw1.LOWBYTE, pw1.HIGHBYTE, CR] ' Left Pin
    SEROUT servo, hibaud,[noparse][[/noparse]"!SC",chb,0,pw2.LOWBYTE, pw2.HIGHBYTE, CR] ' Right Pin
    DEBUG "Leave Servoinit", CR
    RETURN

    Thanks
    Don_S
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-11-07 17:38
    Don_S -

    I'm not all that familiar with a PSC, but a BAUDMODE of 6 for a BS-2 just doesn't seem appropriate.

    Addidionally, I stand to be corrected, but I thought the format of the SEROUT command when addressing the PSC was more like this:

    SEROUT Pin_No, BAUDMODE, [noparse][[/noparse]"!SC",12,0, pw.HIGHBYTE, pw.LOWBYTE, CR]

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • don_sdon_s Posts: 35
    edited 2006-11-07 17:45
    Bruce,
    You may be right on the baud rate as I copied this from a section of code given to me earlier.
    I understand baud rates, but the codes that are being used, I have not figured out.

    But I dont see where you think the SerOut Command is incorrect.
    If you are looking at :

    " SEROUT servo, hibaud,[noparse][[/noparse]"!SC",cha,30,pw1.LOWBYTE, pw1.HIGHBYTE, CR]"
    The only idfference is the 30 in the 5th parm, which if I remember correctly, the ramp up function. But I could be wrong, which is most of the time according to my wife! lol.gif

    Thanks
    Don_S
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-11-07 17:49
    Don,
    ·
    ·· I will try this momentarily, but I am concerned about your baud rate setting…You’re not using an OPEN baud mode in the code.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-11-07 18:26
    Don -

    Here is a line extracted directly from your program, with only some spacing added to improve the readability:

    SEROUT servo, hibaud ,[noparse][[/noparse]"!SC", chb, 30, pw2.LOWBYTE, pw2.HIGHBYTE, CR]

    I don't have the sample program handy, and thus I may be incorrect in what I'm about to suggest, but I might expect it to read as follows rather than what you have above:

    SEROUT servo, hibaud, [noparse][[/noparse]"!SC", chb, 30, pw2.HIGHBYTE, pw2.LOWBYTE, CR]

    Note that HIGHBYTE and LOWBYTE are REVERESED between the two statements.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • don_sdon_s Posts: 35
    edited 2006-11-07 18:46
    Bruce,
    This is from the documention:

    SEROUT Sdat, Baud+$8000,[noparse][[/noparse]"!SC", ch, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]

    Where LOWBYTE comes first.

    If you dont kind me asking, why would you switch them..

    Thanks
    Don_S
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-11-07 22:01
    Don,
    ·
    ·· My observations are that with the higher baud rate sending the SEROUT back to back like that is causing missed data on the PSC.· Try the attached code.· I had to correct the baud mode as well as put PAUSE 100 statements in between these SEROUT commands.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-11-07 22:22
    Don -

    I guess the best answer is common sense, since the high byte of a WORD variable is on the left, and the low byte is on the right.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • don_sdon_s Posts: 35
    edited 2006-11-07 22:51
    Chris,
    I used your code with the same results.
    Now here is a twist.
    I took two other servos from another Boe-Bot that I have and it worked fine.
    I took the orginal servos from the first Boe-Bot and put them in pin 12 and 13. Eliminated the PSC and did a ramp up program that I have and they worked correctly.
    Could it be possible that one servo just doesnt register the commands from the PSC?

    I am trying to run all my servos off of the PSC. Two for movement and one for 180 deg. rotations. Can this be done with the PSC?

    Bruce,
    As this is not my area of expertise and I have not been doing this very long, I dont see it as common sense. Until you mentioned it, I did know the High byte was on the left and the low was on the right.

    Thanks
    Don_S
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-11-07 23:13
    Don,
    ·
    ·· Yes, in theory you could do this, so long as you keep in mind that no two servos are exactly the same.· Case in point was the original code you sent me…You had a STOP value of 760, which actually caused both of my servos to move slowly…I had to change it to 750, which is the normal center/stop position on a calibrated servo.· But yes, you should be able to do what you want no problem.· It looks like you will need to compensate for some differences in the servos though.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • don_sdon_s Posts: 35
    edited 2006-11-08 13:17
    I have one more question then I will let this thread die hop.gif

    What could cause one servo to run all the time on the PSC no matter what the command, but run correctly when hooked to the Boe-Bot and using the pulseout commands?

    Thank you to everyone for the help.

    Don _S
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-11-08 17:34
    Don,
    ·
    ·· There could be slight differences in the PULSOUT value needed on the BASIC Stamp as opposed to the PSC.· You may simply need to tweak the value a little to get the servo to stop.· That’s part of any system that uses a continuous rotation servo.· Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
Sign In or Register to comment.