I am trying to use the PULSOUT command with a PICAXE 08M and a Futaba S9201 servo. In using the PULSOUT command I am seeing an approximately 30 degree travel in the servo arm as opposed to approximately 85 degrees using SERVOPOS. I have read the manual and several past posts on this subject but apparently "just don't get it". The current test code is attached. Would someone please steer me in the right direction here?
We gotta figure out what you are doing here --Why pause 19? 19ms is so specific, why 19? Why do you have a pause in a loop? Instead of pausing 10ms, 100 times, why not just pause 1000?
So this leads to the question, why pause exacty 1019ms?
I am not making fun here --if you can tell me how you got here, or how you expect this code to work, I/we could give you a better answer.
You are only sending one pulse to the servo and then 1 second later sending a different lenth pulse . You have to send around 50 pulses per second to servo . So your servo doesn’t get to it’s position after the pulsout 4,150 statement . It only moves a little toward the position .
I get a lot of jitter using the SERVOPOS command and wanted to try the PULSOUT command. The 19ms pause was something I saw in other posts and Rick100 uses it in his code above. I ahve also seen examples of taking the pulse pin (4) low before issuing the PULSOUT command. This didn’t seem to change the result. I was expecting the servo arm transition to be the same whether using SERVOPOS or PULSOUT and that is not happening so … seems to me like something else is going on within SERVOPOS.
It “pumpkin” hour for me as I get up at 04:30 CDT. I appreciate the responses so far but am headed for some z’s. I aapreciate any ideas you have … good nite all.
You are right about needing the “low 4” command before the pulsout .I changed the post so the program includes it . It makes sure the pin is an output and the pulse is high . The servpos command operates in the background to send a pulse every 20 milliseconds . If you use the pulsout command you have to put it in a loop that takes about 20 milliseconds . This makes it a lot harder to control a servo and do anything else at the same time . I noticed servo jitter when using the servopos command on one of my projects . While researching the problem I found this post on the Picaxeforum .
The bottom line is this post from the Picaxe technical support .
"Unfortunately on the lower pin count devices it is not possible to implement all the complexity of all the PICAXE firmware commands and a completely perfect servo command within the very limited memory space available, it is always going to be a compromise between the two. If you want perfect servo operation an intermediate chip dedicated to just servo pulsing, such as the AXE031, is always the best bet.
That said, we have completely rewritten the servo operation on the 18M2 parts to give a better performance with less jitter. It’s never going to be 100% perfect, but should be a fair bit more accurate than the older parts like the 08M.
__________________ PICAXE Technical Support"
Also if you’re using the serial or pulsin commands along with the servo commands you will get more jitter .
Thanks Rick100. As CtC requested, the scenario is:
a button activates the PULSOUT command to the servo
minutes or hours later, a switch activates the PULSOUT command to return the servo to its original state
this process repeats whenever the button is pushed and the switch activated. It may happen once a day or once a week.
I just want the servo arm to move between state 1 and state 2 (approx 85 degrees) whenever the button is pushed or the switch activated. What would the code look like to accomplish this?
this process repeats whenever the button is pushed and the switch activated. It may happen once a day or once a week.
I just want the servo arm to move between state 1 and state 2 (approx 85 degrees) whenever the button is pushed or the switch activated.
Does the device need to actively hold the state 1 and state 2 positions between button pushes? Is a servo motor the right solution for this applications?
"I just want the servo arm to move between state 1 and state 2 (approx 85 degrees) whenever the button is pushed or the switch activated. What would the code look like to accomplish this?“
The short program I posted yesterday will do exactly that . When you push the Normally Open momentary pushbutton attached to input 3 , with the pullup resistor , the servo will move from state 1 to state 2 .When you push it again the servo will move back to state 1 .
You said
"a button activates the PULSOUT command to the servo
minutes or hours later, a switch activates the PULSOUT command to return the servo to its original state"
A single pulsout command only produces 1 pulse and will not position the servo . It takes repeated pulses to drive a servo to a new position and hold it there . When the pulses stop the servo motor stops trying to hold the position .
Cactus ask " Does the device need to actively hold the state 1 and state 2 positions between button pushes?” . If it doesn’t you might try sending it a series of 50 pulses with a pause 19 in between each one . After that your program can do something else as long as it moniters the button . If you use this method and something alters the servo position , like an external load or your dog bumps it , the servo will not drive it back into position until you push the button again . I tried this method once and it seemed to work .
If all the picaxe has to do is moniter the button and change the servo between 2 positions then the program I provided is the better solution .
Ok, thanks to everybody I finally understand how PULSOUT works. I put Rick100’s program in the 08M and the servo would move the full range alright but would jitter badly at both ends of the range. I had a spare 08M and put it in place and everything worked perfectly.