Servo Controller
don_s
Posts: 35
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
http://forums.parallax.com/showthread.php?p=612151
Is that what you experience?
regards peter
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
·
·· 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
·
·· 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
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
I can get the servo on 12 to work correctly, The servo on 13 always wants to run in reverse and never stops.
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
No matter what # in put in for 13 it always runs in reverse and never stops.
Don_S
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 -->
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
PAR
Thanks
Don_S
·
·· 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
' {$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
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 -->
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!
Thanks
Don_S
·
·· 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
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 -->
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
·
·· 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
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 -->
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
·
·· 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
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
·
·· 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