Shop OBEX P1 Docs P2 Docs Learn Events
propeller servo controller not communicating and basic stamp2 — Parallax Forums

propeller servo controller not communicating and basic stamp2

AntonuccioAntonuccio Posts: 17
edited 2011-03-23 05:43 in BASIC Stamp
hello
I am currently buliding a servo powered robot using a Parallax Propeller servo controller (PSCU) and a basic stamp 2 microcontroller (bs2). Despite my best efforts I can not get the servo controller to operate properly. I have done a lot of reaserch and have set my electronics up as Parallax dictates. I am also using multipe test programs sent to me by Parallax that should work "out of the box." Despite my efforts every time I attempt to run a program my servos just twitch wildly.So what am I doing wrong? My setup is as follows: I have a 9v battery connected to my bs2. From the bs2 I have a jumper going from pin 15 of the bs2 to the PSCU. I have a 7.4v power source going to my PSCU and have servos attached to pins 1-9.

I have done many experiments to try and remedy this problem myself including: I have tested the communication between my bs2 and PSCU with an ocilloscope and as far as I can tell they are communicating. I set up a variable power supply to my PSCU and supplied a range of voltage from about 4v to 9v in an attempt to see if my 7.4v power source was the problem. It was not. I have replaced my original servo controller with a 2nd to see if a defective PSCU was creating problems. However my results were the same.

As I am a novice programmer and this is my first time working with Parallax gear I have a strong feeling that I am making some mundane mistake or overlooking something small that is inhibiting my electronics. If anyone could shed some light on this mystery I would be quite greatful because I am out of ideas.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2011-01-23 09:01
    You haven't mentioned that you have the grounds of the BS2 and PSCU connected together. That's necessary.

    Keep in mind that a 9V battery is a poor power source. It has a very small power capacity and can provide relatively little current. That given, a BS2 by itself draws very little current.

    It's possible to connect the PSCU to a PC via the USB connector and there's software for the PC on the PSCU's product webpage that lets you control servos from the PC. Have you tried that? That's a good way to test the servo controller, servos, and power supply.
  • dandreaedandreae Posts: 1,375
    edited 2011-01-24 08:39
    What brand of servos are you using? Are you able to identify the servo controllers in the PSCI software? Have you tried using a different I/O pin?

    Dave
  • AntonuccioAntonuccio Posts: 17
    edited 2011-01-24 16:48
    I have the PSCU and the bs2 connected with a jumper I bought from parallax and as far as I can tell, through voltage and ocilloscope tests, the PSCU is getting power, ground, and signal. Also I have tried to use the PSCI software to control the servos via my pc with no luck.

    I am using Futuaba S3003 servos. I did not mention in my first post that I have my bs2 on a Board of Education and when I have the servos connected directly to the BoE I am able to controll them normally. I have also tried using multiple I/O pins with the same result.
  • Mike GMike G Posts: 2,702
    edited 2011-01-24 17:48
    PSC issues are generally connections, power, or the jump. Make sure you did not reverse any servo connections. Try connection only one servo for now. Even one reversed servo connection will cause problem. Is your 7.4V power source charged up? Make sure the network jumper (I/O 0-15 or 15-31) is in the correct position for you application.
  • AntonuccioAntonuccio Posts: 17
    edited 2011-01-25 17:33
    According to the schimatic I have been following all my connections are correct and my power supplies all have a fresh charge. I have tried to isolate the problem by using 1 servo at a time with no luck.

    For reference I have attached a diagram of the setup I am using.

    example1.jpg
    837 x 707 - 159K
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2011-01-26 04:56
    Can you post a picture of your set-up, one with everything in view?
  • Mike GreenMike Green Posts: 23,101
    edited 2011-01-26 10:05
    Usually a diagram like you posted is not very useful because the Propeller Servo Controller is a stable, well-tested product and it's very rare for there to be something wrong with it. Almost all the time, the problem is that something is not connected as it should be or there's a problem with the power source and your diagram shows nothing about what's actually there, just what you believe you have. That's why you get advice like "check your connections" or "check your power supply".
  • AntonuccioAntonuccio Posts: 17
    edited 2011-01-26 17:41
    Interesting. If the graph means nothing then perhaps I have been going at this all wrong. I have had multiple sets of eyes investigate my setup and all agree that my components are assembled correctly but those eyes have also been using the above graph as reference.

    Attached to this post is a pic showing my project and the exact setup I am using with callouts to the components in question. If anyone can see a bad connection or stupid mistake I may be making please let me know.


    setup1.jpg
    1024 x 560 - 87K
  • Mike GMike G Posts: 2,702
    edited 2011-01-26 18:11
    There's a jumper next to the reset button. It should be removed for I/O channels 0-15. I can't see it from your picture.

    The easiest way to test the PSC is to just hook it you your PC with the USB cable. No not connect servo power or servos. Open the PSCI program and execute the version command. If the version numbers comes back, then you have a servo connection, power, or programming issue.

    Your BOE power switch is set to position 2, correct?

    Consider posting your PBASIC code.
  • AntonuccioAntonuccio Posts: 17
    edited 2011-01-27 17:52
    There is a jumper on the top right corner of my PSCU. Should it be removed?

    A friend and I have made many attempts to get the PSCI software to talk to my PSCU with no luck. It does not respond in any way.

    I am putting my BoE power switch to position 2.

    Here is one of the many test codes I have tried to execute.

    '{$STAMP BS2}
    '{$PBASIC 2.5}
    ch VAR Byte
    'ch0 VAR Byte
    pw VAR Word
    ra VAR Byte
    Sdat CON 15
    baud CON 396


    ra =6

    DO
    FOR ra = 15 TO 16
    pw = 270
    SEROUT Sdat, Baud+$8000,["!SC", 0, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
    SEROUT Sdat, Baud+$8000,["!SC", 11, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
    PAUSE 5000
    pw = 1270
    SEROUT Sdat, Baud+$8000,["!SC", 0, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
    SEROUT Sdat, Baud+$8000,["!SC", 11, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
    PAUSE 5000
    NEXT
    LOOP
  • AntonuccioAntonuccio Posts: 17
    edited 2011-02-16 16:26
    hello all

    It has been some time since my last post. In that time I have been trying all of the above suggestions given to get my project working. I am still having no luck. Is their anyone out their who can review the data i have provided and shed any more light on my sad situation?

    Thanks
  • FranklinFranklin Posts: 4,747
    edited 2011-02-16 16:55
    MikeG wrote:
    There's a jumper next to the reset button. It should be removed for I/O channels 0-15.
    The easiest way to test the PSC is to just hook it you your PC with the USB cable. Open the PSCI program and execute the version command. If the version numbers comes back, then you have a servo connection, power, or programming issue.
    If not your servo controller is not working. Try calling support for help.
  • Mike GreenMike Green Posts: 23,101
    edited 2011-02-16 17:51
    Do call Parallax Tech Support. Usually when a problem reaches this point, all the obvious suggestions have been made and the use of a forum or e-mail just doesn't work. Often there's something not said or done that's at the heart of the problem, but the customer doesn't even know what it is.
  • AntonuccioAntonuccio Posts: 17
    edited 2011-03-07 17:26
    Well I think I may have found the problem...

    I switched one of my Futaba S3003 servos with an official Parallax servo and got some encouraging results. The Parallax servo did not start to twitch wildly the second I applied power. The new servo simply rotated to its 90 degree position and held that position until I cut power. Despite these results I do not want to buy more of the Parallax servos until I can confirm without a doubt that my old servos are indeed my problem

    The following code was given to me from Parallax as a bit of test code for my Propeller Servo Controller. However since I am a novice programer I am not 100% on what my setup should be and what this program does exactly. If im not mistaken this program works with my jumper wire running from pin 15 of my BoE to my PSCU. Once I apply power to the BOE/ PSCU the servo attached to pin #6 in the PSCU should rotate roughly to the 0 degree position then to about the 180 degree position. Is my deciphering of this code correct? Is their anything I should add or take from the code to make it work better? I would greatly appreciate any advice anyone can give me as I feel I am now very close to deciphering my servo problems.


    here is the sample code mentioned above:

    '{$STAMP BS2}
    '{$PBASIC 2.5}
    ch VAR Byte
    'ch0 VAR Byte
    pw VAR Word
    ra VAR Byte
    Sdat CON 15
    baud CON 396

    ra =6
    DO
    FOR ra = 15 TO 16
    pw = 270
    SEROUT Sdat, Baud+$8000,["!SC", 0, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
    SEROUT Sdat, Baud+$8000,["!SC", 11, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
    PAUSE 5000
    pw = 1270
    SEROUT Sdat, Baud+$8000,["!SC", 0, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
    SEROUT Sdat, Baud+$8000,["!SC", 11, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
    PAUSE 5000
    NEXT
    LOOP
    'for postion 63 you'll need a pause of 60,000 for full rotation
  • bsnutbsnut Posts: 521
    edited 2011-03-07 18:26
    I have one big question for you. Are you using the test code that is provided in the docs from Parallax? I, would be trying the test form Parallax first before writing your own test code. This way you know that the Propeller Servo Controller works. Then if want to write your own code, then you can use their code as an model for your own to follow. This is how I learn to program Basic Stamps.
  • AntonuccioAntonuccio Posts: 17
    edited 2011-03-08 15:24
    The above code was given to me by Parallax. I have also been using code strait from the PSCU pdf.

    The code is as follows:

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}

    ch VAR Byte
    pw VAR Word
    ra VAR Byte

    Sdat CON 15
    baud CON 396

    ra = 7
    ch = 11

    DO
    pw = 1100
    SEROUT sdat, Baud+$8000,["!SC", ch, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
    PAUSE 1000
    pw = 300
    SEROUT sdat, Baud+$8000,["!SC", ch, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
    PAUSE 1000
    LOOP

    If anyone out there can simply tell me what pin my servo needs to be plugged into/ confirm what this program or the program in my above post are supposed to do I would be grateful beyond words.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2011-03-09 18:13
    Consternating -- "ch = 11". So, channel 11 is the servo at issue?
    That means that the servo should be connected to P11 on the PSCU?
    What happens then?
    What results if "ch = 11" is changed to "ch = 0" and the servo is
    connected to P0?
  • Mike GMike G Posts: 2,702
    edited 2011-03-09 19:25
    If im not mistaken this program works with my jumper wire running from pin 15 of my BoE to my PSCU. Once I apply power to the BOE/ PSCU the servo attached to pin #6 in the PSCU should rotate roughly to the 0 degree position then to about the 180 degree position. Is my deciphering of this code correct? Is their anything I should add or take from the code to make it work better? I would greatly appreciate any advice anyone can give me as I feel I am now very close to deciphering my servo problems.

    The code you posted assumes you have a servo connected to channel 11 and channel 0. ra=6 is the ramp value not the channel.
    ra =6
    DO
    FOR ra = 15 TO 16
    pw = 270
    SEROUT Sdat, Baud+$8000,["!SC", 0, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
    SEROUT Sdat, Baud+$8000,["!SC", 11, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
    PAUSE 5000
    pw = 1270
    SEROUT Sdat, Baud+$8000,["!SC", 0, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
    SEROUT Sdat, Baud+$8000,["!SC", 11, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
    PAUSE 5000
    NEXT
    LOOP
    

    See the PSCU manual.
  • AntonuccioAntonuccio Posts: 17
    edited 2011-03-10 17:55
    I have plugged my new servo into both p11 and p0 (at different times since I only have 1 Parallax servo right now), I turned my BoE to position 2, and I apply power to the PSCU. Then I hook everything up to my PC via usb and hit play... and the program seems to do nothing. The servo goes to its 90 degree position and holds it which makes me think im getting power but no signal.

    Im still not sure where im going wrong. Anybody have any ideas?
  • Mike GMike G Posts: 2,702
    edited 2011-03-10 18:47
    I have no idea what "hit play" means. Do you mean RUN in the PBASIC editor or are you using the PSCI application?


    What happens when you run this?
    ' {$STAMP BS2p}
    '{$PBASIC 2.5}
    
    #SELECT $STAMP
      #CASE BS2SX, BS2P
        N2400        CON     1021
      #CASE BS2PX
        N2400        CON     1646
      #CASE #ELSE
        N2400        CON     396
    #ENDSELECT
    
    
    Sdat    PIN     15 ' Serial Data I/O pin
    buff    VAR     Byte(3) ' temporary variable
    
    
    FindPSC: ' Find and get the version
      DEBUG "Finding PSC", CR ' number of the PSC.
      SEROUT Sdat, N2400+$8000, ["!SCVER?",CR]
      SERIN Sdat, N2400, 500, FindPSC, [STR buff\3]
      DEBUG "PSC ver: ", buff(0), buff(1), buff(2), CR
    STOP
    

    Or this?
    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    
    ' Set baud for all STAMP versions
    #SELECT $STAMP
      #CASE BS2SX, BS2P
        N2400        CON     1021 + $8000
        N38K4        CON     45 + $8000
      #CASE BS2PX
        N2400        CON     1646 + $8000
        N38K4        CON     84 + $8000
      #CASE #ELSE
        N2400        CON     396 + $8000
        N38K4        CON     6 + $8000
    #ENDSELECT
    
    PSC          CON     15                     ' PSC I/O Pin
    buff         VAR     Byte(3)                ' Temporary variable
    
    Main:
      GOSUB Get_PSC_Settings                    ' Check PSC Baud and Version
      PAUSE 1000
      DEBUG CR,"--------------------",CR
    
      GOSUB Force_N38K4                         ' Force 38K4 baud
      PAUSE 1000
      DEBUG CR,"--------------------",CR
    
      GOSUB Get_PSC_Settings                    ' Check PSC Baud and Version
      PAUSE 1000
      DEBUG CR,"--------------------",CR
    
      GOSUB N38K4_To_N2400_Baud                 ' 38K4 to 2400 Baud
      PAUSE 1000
      DEBUG CR,"--------------------",CR
    
      GOSUB Get_PSC_Settings                    ' Check PSC Baud and Version
      PAUSE 1000
      DEBUG CR,"--------------------",CR
    
      GOSUB Force_N38K4                         ' Force 38K4 baud
      PAUSE 1000
      DEBUG CR,"--------------------",CR
    
      GOSUB Force_N38K4                         ' Force 38K4 baud
      PAUSE 1000                                ' 38K4 is already set
      DEBUG CR,"--------------------",CR
    
      GOSUB Get_PSC_Settings                    ' Check PSC Baud and Version
      PAUSE 1000
      DEBUG CR,"--------------------",CR
    
      GOSUB N2400_To_N38K4_Baud                 ' Create an error
      PAUSE 1000
      DEBUG CR,"--------------------",CR
      GOSUB N38K4_To_N2400_Baud                 ' 38K4 to 2400 Baud
      PAUSE 1000
    
    END
    
    '-------------------------------------------------------------------------
    Force_N38K4:
      DEBUG "Force 38K4", CR
      SEROUT PSC, N38K4, ["!SCVER?",CR]
      SERIN PSC, N38K4, 500, Set_N38K4,[STR buff\3]
      DEBUG "38K4 Already Set",CR
      GOTO N38K4_Set
    Set_N38K4:
      DEBUG "Setting to 38K4", CR
      SEROUT PSC, N2400,["!SCSBR",1,CR]
      SERIN PSC, N38K4 ,500, Baud_Exception, [STR buff\3]
      DEBUG "Baud set to 38K4", CR, "PSC reply:  ", buff(0), buff(1), DEC buff(2), CR
    N38K4_Set:
    RETURN
    
    '-------------------------------------------------------------------------
    Get_PSC_Settings:
      DEBUG "Getting PSC Information", CR
      SEROUT PSC, N2400, ["!SCVER?",CR]
      SERIN PSC, N2400, 500, Try_38K4,[STR buff\3]
      DEBUG "Baud = 2400", CR, "PSC ver:  ", buff(0), buff(1), DEC buff(2), CR
      GOTO N2400_Found
    Try_38K4:
      SEROUT PSC, N38K4, ["!SCVER?",CR]
      SERIN PSC, N38K4, 500, Baud_Exception,[STR buff\3]
      DEBUG "Baud = 38K4", CR, "PSC ver:  ", buff(0), buff(1), DEC buff(2), CR
    N2400_Found:
    RETURN
    
    '-------------------------------------------------------------------------
    N2400_To_N38K4_Baud:
      DEBUG "Setting Baud from 2400 to 38K4", CR
      SEROUT PSC, N2400,["!SCSBR",1,CR]
      SERIN PSC, N38K4 ,500, Baud_Exception, [STR buff\3]
      DEBUG "Baud reply:  ", buff(0), buff(1), DEC buff(2), CR
    RETURN
    
    '-------------------------------------------------------------------------
    N38K4_To_N2400_Baud:
      DEBUG "Setting Baud from 38K4 to 2400", CR
      SEROUT PSC, N38K4,["!SCSBR",0,CR]
      SERIN PSC, N2400 ,500, Baud_Exception, [STR buff\3]
      DEBUG "Baud reply:  ", buff(0), buff(1), DEC buff(2), CR
    RETURN
    
    '-------------------------------------------------------------------------
    Baud_Exception:
      DEBUG "Failed to set baud", CR
    RETURN
    


    Or this with a servo connected to channel zero?
    ' {$STAMP BS2p}
    ' {$PBASIC 2.5}
    
    '---- [Programming Notes] ------------------------------------------------
    
    '-----[ I/O Definitions ]-------------------------------------------------
    PSC             PIN     15              ' PSC module
    
    #SELECT $STAMP
      #CASE BS2SX, BS2P
        N2400        CON     1021+$8000
      #CASE BS2PX
        N2400        CON     1646+$8000
      #CASE #ELSE
        N2400        CON     396+$8000
    #ENDSELECT
    
    
    '-------------------------------------------------------------------------
    
    servoAddr       VAR     Byte            ' Servo addresses
    ramp            VAR     Byte            ' Ramp used in SEROUT
    position        VAR     Word
    
    '-------------------------------------------------------------------------
    
    
    ramp = $F             ' Ramp (speed)
    servoAddr = 0         ' Channel 0
    
    Main:
      position = 500      ' Position
      GOSUB Write_Joint   ' Send position command
      PAUSE 3000          ' Pause 3 seconds
      position = 1000     ' Position
      GOSUB Write_Joint   ' Send position command
      PAUSE 3000          ' Pause 3 seconds
    GOTO Main             ' Loop
    
    ' Write to the PSC
    Write_Joint:
      SEROUT PSC,N2400,["!SC",ServoAddr, Ramp,position.LOWBYTE, position.HIGHBYTE, CR]
    RETURN
    
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2011-03-10 19:17
    Regarding the "7.2V" to the PSCU - you have some wires shoved into a connector of some sort on the battery end. Do you have the volts right there on the PSCU terminals, verified with a DVM?
    I would get in there with a meter and/or a scope, all of this fuss and bother. Did you buy the PSCU new from Parallax or is it second-hand?

    [I'm going to leave this to Mike G, as too many cooks...]

    PE - Checking in once every 24hrs is slowing down the process
  • AntonuccioAntonuccio Posts: 17
    edited 2011-03-16 16:32
    Perhaps someone out there on the Parallax forum could take a look at a setup I am trying to run? I have posted pictures of my setup before but this one is a little more clear and may communicate how I am going about things better.

    To recap I have a Basic stamp 2 on a Board of Education connected to a Propeller Servo Control Unit. Attached to the PSCU right now is a single Parallax standard servo. When I apply power to my BoE and then my PSCU and play a program I seem to get no signal from my BOE to the PSCU. The servo I have connected to the PSCU simply rotates to 90 degrees and holds its position telling me I am at least getting power.

    I am particularly curios to weather or not the jumper on the PSCU is to be remove, however I am not sure if there is something else in m y setup that may be inhibiting signal.

    setup.jpg
    792 x 612 - 64K
  • AntonuccioAntonuccio Posts: 17
    edited 2011-03-16 17:28
    Mike G wrote: »
    I have no idea what "hit play" means. Do you mean RUN in the PBASIC editor or are you using the PSCI application?



    When I say "hit play" I mean run in PBASIC not PSCI.

    Also thanks for the programs, but when I ran them I came up with the same results. The servo holding 90 degrees.
  • AntonuccioAntonuccio Posts: 17
    edited 2011-03-16 17:33
    PJ Allen wrote: »
    Regarding the "7.2V" to the PSCU - you have some wires shoved into a connector of some sort on the battery end. Do you have the volts right there on the PSCU terminals, verified with a DVM?
    I would get in there with a meter and/or a scope, all of this fuss and bother. Did you buy the PSCU new from Parallax or is it second-hand?

    I have had volt meter and an oscilloscope probes shoved in every terminal of my setup 100X over and everything seems normal as far as voltage and the BoE sending a signal. However I do not think the PSCU is receiving. Also all of the stuff im using came strait from Parallax brand new.
  • Mike GMike G Posts: 2,702
    edited 2011-03-17 15:14
    Also thanks for the programs, but when I ran them I came up with the same results. The servo holding 90 degrees.
    Antonuccio, the first two programs do not move a servo! They test your STAMP to PSCU configuration. As a matter of fact a servo doesn't even need to be connected nor does servo power. The first program requests the PSCU version number at 2400 baud. The second programs tries to set the baud to 38k4 and 2400 leaving the PSCU at 2400 baud at program end. You should have seen text roll down the debug window no mater if the PSC was operating properly or not. I'm not sure what to make of your response.
  • AntonuccioAntonuccio Posts: 17
    edited 2011-03-22 16:06
    I have discovered the problem.

    For some reason my PSCU thinks it is the 2nd in a series of two servo controllers.

    In other words channels 0-15 think that they are channels 16-31. I'm not sure why this is but I have adjusted my programs accordingly and so far things seem to be working.

    However I am perplexed as to why this problem is occurring.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2011-03-23 05:43
    In the PSCU manual, page 7 of 12, there is an explanation of PSS:
    PSS – Set Software Port (to range 0 – 15 or 16 – 31)
    Syntax: “!SCPSS” <mode> <CR>
    Reply: “PM” <mode>

    "Somehow" that got changed.
Sign In or Register to comment.