propeller servo controller not communicating and basic stamp2
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.
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
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.
Dave
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.
For reference I have attached a diagram of the setup I am using.
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.
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.
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
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
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
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.
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?
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.
See the PSCU manual.
Im still not sure where im going wrong. Anybody have any ideas?
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 STOPOr 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 RETURNOr 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] RETURNI 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
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.
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.
PSS – Set Software Port (to range 0 – 15 or 16 – 31)
Syntax: “!SCPSS” <mode> <CR>
Reply: “PM” <mode>
"Somehow" that got changed.