Balloon Float Control System- Trouble with PSC Integration
Brian Cox
Posts: 5
Hello everyone-
I am working on a Senior Design Project at the University of Arizona, we have created a balloon release system with a pair of tiny HITEC "Feather" HS-55 servos and a BS2SX system with a Super-Carrier board and LCD terminal appmod.·
Anyway, I'm trying to get the thing programmed, and I'm stumbling along in the tiny bit of BASIC I've learned... (if this were in JAVA, I'd be done)· Anyway, I ended up soldering the serial communications wires to the board (White to P15, Red to Vdd, and Black to Vss) per suggestions of the Parallax tech support staff.· So I've had some trouble getting the Servo Controller to recognize commands coming from the chip.· I am able to poll the PSC for its firmware version number, and apparently am able to set the baudrate, the replies look like this:
Finding PSC
PSC ver: 1.3
Setting Baudrate
Baud reply:· 0þ0
I'm not sure what the Baud reply signifies...
I am able to send "messages" to the PSC, but it doesn't seem to be able to move the servos when I send a message for it to do so.· The message I've been sending is:
SEROUT Sdat, 1021, [noparse][[/noparse]"!SC", ch, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
Sdat is the pin, P15, 1021 the baud I've been told to use with the BS2SX, and the rest has to do with a lot of gibberish that I don't 100% understand.· I know ch is the channel number (I'm only using channels 0 and 1) and ra is the ramp rate (7 for now).· I can send this command to the PSC, and it "gets" there, because the green serial light on the PSC flashes, but nothing happens with the servos.· I'm confident the servos are working, because when I turn on the PSC they go to zero position and maintain it (if you try to move them, they fight you.)
What am I missing?!· HELP!
EDIT: When the servos "zero" after the PSC is powered up, they go to their middle state, as in they are able to move 90 degrees to the right or left, could this have something to do with my problem?
Post Edited (Brian Cox) : 11/12/2005 4:17:43 AM GMT
I am working on a Senior Design Project at the University of Arizona, we have created a balloon release system with a pair of tiny HITEC "Feather" HS-55 servos and a BS2SX system with a Super-Carrier board and LCD terminal appmod.·
Anyway, I'm trying to get the thing programmed, and I'm stumbling along in the tiny bit of BASIC I've learned... (if this were in JAVA, I'd be done)· Anyway, I ended up soldering the serial communications wires to the board (White to P15, Red to Vdd, and Black to Vss) per suggestions of the Parallax tech support staff.· So I've had some trouble getting the Servo Controller to recognize commands coming from the chip.· I am able to poll the PSC for its firmware version number, and apparently am able to set the baudrate, the replies look like this:
Finding PSC
PSC ver: 1.3
Setting Baudrate
Baud reply:· 0þ0
I'm not sure what the Baud reply signifies...
I am able to send "messages" to the PSC, but it doesn't seem to be able to move the servos when I send a message for it to do so.· The message I've been sending is:
SEROUT Sdat, 1021, [noparse][[/noparse]"!SC", ch, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
Sdat is the pin, P15, 1021 the baud I've been told to use with the BS2SX, and the rest has to do with a lot of gibberish that I don't 100% understand.· I know ch is the channel number (I'm only using channels 0 and 1) and ra is the ramp rate (7 for now).· I can send this command to the PSC, and it "gets" there, because the green serial light on the PSC flashes, but nothing happens with the servos.· I'm confident the servos are working, because when I turn on the PSC they go to zero position and maintain it (if you try to move them, they fight you.)
What am I missing?!· HELP!
EDIT: When the servos "zero" after the PSC is powered up, they go to their middle state, as in they are able to move 90 degrees to the right or left, could this have something to do with my problem?
Post Edited (Brian Cox) : 11/12/2005 4:17:43 AM GMT
Comments
But as an anecdote to 'auto-sonde' launchers.
A co-worker of mine was up in the Yukon working on a remote Radiosonde launcher.
It was a new gizmo that would fill the balloons, attach/test the payload, and launch all on it's own...then prep for the next one.
Well, he was working on it, and since radiosondes typically go up every 12hours, he sped up the machine to troubleshoot it better.
Well, he fixed it...but forgot to reset the timer....I think 100 balloons were launched before someone called and told him to get back there!!
Bugger of a system....balloons would break and gum up the filler nozzle....
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·
Steve
"Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
SEROUT Sdat, 1021, [noparse][[/noparse]"!SCSBR",1,CR]
1021 being the baud rate of the bs2sx, or something to that effect...
Could this be the cource of my troubles?· I use this command to see what the resulting baud rate is:
SERIN Sdat, 6, 500, SetBaud, [noparse][[/noparse]STR buff\3]
-Brian
·· What is missing from you SEROUT line, I think, is the $8000 added to the baudmode parameter for "open" baud mode.· Do you have an actual section of code which talks to the PSC?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Basically Button 1 exits the loop, Button 2 changes the channel from (0 to 1) or (1 to 0), Button 3 moves the servo to position 250, and Button 4 moves the servo to position 1250...· The message "gets" to the servo controller, because the green serial communication light blinks when I press buttons three or four, but the servos don't move.·
The message may be being sent at the wrong baud rate, could this be my probelm?· The PSC's default baud is 2400, so when I first send a message to change the baud, should the baud be what it is running at or what I want?· I'm not sure I have successfully changed the baud, what does the symbol value it spits back out mean?
Thanks for any help you can give...
-Brian
'
Begin code snippet
DO
··· GOSUB LCD_Get_Buttons······················ ' read/debounce buttons
··· addr = Msg4······ ································ ' show "Testing Servos" on 1st line
··· GOSUB LCD_Put_String
····GOSUB LCD_Button_Labels···················· ' display the button labels on LCD Line 2
··· IF buttons.BIT2 THEN
····· pw = 250
····· GOSUB SetServoPos
··· ELSEIF buttons.BIT3 THEN
····· pw = 1250
····· GOSUB SetServoPos
··· ELSEIF buttons.BIT1 THEN
····· IF ch = 0 THEN
······· ch = 1
····· ELSE
······· ch = 0
····· ENDIF
··· ENDIF
· LOOP UNTIL (buttons.BIT0)
'
End code snippet
'
Get LCD Button Data
LCD_Get_Buttons:
· LcdDirs = %0000······························ ' make LCD bus inputs
· buttons = %1111······························ ' assume all pressed
· FOR scan = 1 TO 10
··· buttons = buttons & LcdBusIn··············· ' make sure button held
··· PAUSE 5···································· ' debounce 10 x 5 ms
· NEXT
· LcdDirs = %1111······························ ' return bus to outputs
· RETURN
'
Set Servo on channel 'ch' to position 'pw'
SetServoPos:
· SEROUT Sdat, 1021+$8000, [noparse][[/noparse]"!SC", ch, ra, pw.LOWBYTE, pw.HIGHBYTE, CR]
· RETURN
SEROUT Sdat, 45+$8000, [noparse][[/noparse]"!SC", ch, ra, pw.LOWBYTE, pw.HIGHBYTE, CR
Where the 45 is the new baud rate on the bs2sx?· What is the magic number for the BS2SX at 2400 baud?
Sorry about all of the questions, I am just wandering lost at this point...
If you're going to user SERIN/SEROUT in your programs, do yourself a favor and start with the attached template -- it has that stuff all worked out and if you use named constants instead of "magic numbers" (bad practice), then you can change Stamp modules without changing your code.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax