PING Mounting Bracket programming help ! !
Hello everyone !
·· I have recently bought from Parallax a Ping sensor with the mounting bracket. First i tested the Ping·sensor using the programs Ping_Demo and PingMeasureCmAndIn, provided from Parallax's website. Everything worked·fine. Then i used·RoamingWithPING-V1.0·just to see the Ping working with the·Mounting Bracket. I got a strange ·behaviour as regards the Mounting bracket. The servo was twisting rapidly 5 degrees·left and right like crazy. I thought i should make a code only for the servo, in order to·see its behaviour. With this code i just wanted the servo to keep·spinning 45 and 90 degrees left and right. The results were not·the expected ones.
The servo only turn left or right. If i use·only·the subroutine·GOSUB LEFT90·or only the subroutine GOSUB RIGHT90, eveything ok, but when i use them both, GOSUB LEFT90 and then·GOSUB RIGHT90, it turns left and then it does nothing, it stucks. I suppose that i don't use right the command PULSOUT...so i can control the polarity of the pulse and consequently control the servo's movement. In addition, i don't quite understand, why the number 1085 is used at this command ·''PULSOUT PingServo, 1085''. in order the servo to turn 90 degrees left and the·number 225·''PULSOUT PingServo, 225'', in order the servo to turn 90 degrees right. Please some help..........
Thank you,
Christofer
·· I have recently bought from Parallax a Ping sensor with the mounting bracket. First i tested the Ping·sensor using the programs Ping_Demo and PingMeasureCmAndIn, provided from Parallax's website. Everything worked·fine. Then i used·RoamingWithPING-V1.0·just to see the Ping working with the·Mounting Bracket. I got a strange ·behaviour as regards the Mounting bracket. The servo was twisting rapidly 5 degrees·left and right like crazy. I thought i should make a code only for the servo, in order to·see its behaviour. With this code i just wanted the servo to keep·spinning 45 and 90 degrees left and right. The results were not·the expected ones.
The servo only turn left or right. If i use·only·the subroutine·GOSUB LEFT90·or only the subroutine GOSUB RIGHT90, eveything ok, but when i use them both, GOSUB LEFT90 and then·GOSUB RIGHT90, it turns left and then it does nothing, it stucks. I suppose that i don't use right the command PULSOUT...so i can control the polarity of the pulse and consequently control the servo's movement. In addition, i don't quite understand, why the number 1085 is used at this command ·''PULSOUT PingServo, 1085''. in order the servo to turn 90 degrees left and the·number 225·''PULSOUT PingServo, 225'', in order the servo to turn 90 degrees right. Please some help..........
Thank you,
Christofer
Comments
And are you sure you plugged the Servo plug into the three-pin connection properly?
And what are you using to power it? It's possible a low battery would cause these symptoms.
If you read the code comments you will see that every servo is different, therefore the code requires you to provide calibration values for the various sections, if you do not you will experience undesirable behavior. That code also requires the IR detectors to be connected. If you don’t want to use those and have to calibrate I would suggest using the simple code located at the following link. I hope this helps. Take care.
http://www.parallax.com/Store/Robots/RoboticAccessories/tabid/145/CategoryID/51/List/0/Level/a/ProductID/248/Default.aspx?SortField=ProductName%2cProductName
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
I know that the parameter of pulsout needs calibration. When i use only the subroutine LEFT90 and it turns 70 degrees instead of 90, but it moves. The same thing happens when i use only the subroutine RIGHT90. The problem is that when i use the subroutine LEFT90 and then RIGHT90, it turns left but then it does nothing, it stucks. I don't thing this behaviour comes because of the wrong parameters of the pulsout command. Could something else go wrong with the code i posted?
Thank you in advance,
Christofer
Additionally you asked why it would keep scanning.· Do you have the IR sensors connected as per the code?· If not it will do that.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
Post Edited (Chris Savage (Parallax)) : 4/30/2008 8:28:19 PM GMT
Thank you very much for your suggestions. I just want to clarify something...When i want the servo to turn 45,90...x degrees right or left, it does it pretty well by changing the number of iterations of the loop. The problem is when i want the servo to turn left and then right or the opposite. In other words scan 180 degrees. I suppose that this shouldn't happen, because when i am experimenting seperately to turn left or right, the servo works. Furthermore, i have not connected neither the IR sensor nor the servos of the Boe-bot with the Ping Mounting Bracket. I just want to work with the Ping and the Mounting Bracket at first and be sure that everything works. For that reason, i modulated the code RoamingWithPING-V1.0 for my needs. Did you see the code?? Is something wrong with it?
The servo "control signal" is a 1 mSec to 2 mSec wide pulse, repeated every 20 to 50 mSecs. The 'position' of the Servo depends on the width of the pulse.
So, "full left" would be a 1 mSec pulse (repeated every 20 to 50 mSec), "full right" a 2 mSec pulse (repeated every 20 mSec), and "mid-range" a 1.5 mSec pulse (repeated every 20 mSec).
The pulse is repeated 20 times or so, to give the servo time to move to the 'commanded' position.
The problem was the power. I used a classic 4,5 V battery from a store to supply the BS2, PING and servo at first and the servo was not working correctly. Then i used a circuit and i made 4.5V to 5 V and everything is ok !!! allanlane5 you were right...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support