PDA

View Full Version : Converting PULSOUT command to PWM for a PWMPAL output to BOE-BOT Servos.



JackDaniels
09-27-2008, 05:22 AM
Hi there,

I can make the BoeBot practically do the Macarana with the pulsout command, but now I want to be able to process other things while the bot runs around.

I have added a PWMPAL to the mix, but what I can gather from the manuals isn't working.

I read that the PULSOUT command for the BS2 sends a 2 microsecond pulse for every number entered, ala 750 (used for full stop) is a 1500 microsecond pulse.

Translating this timing to the ontime-offtime command for the PWMPAL produces movement, not a full stop.

I also read somewhere in these forums that the PULSOUT command has a set time period of 20 milliseconds. I then tried the 1.5 milliseconds on, 18.5 milliseconds off, but it also produced movement.

Has anyone done this transition before?

JD

Mike Green
09-27-2008, 05:40 AM
Be careful of what you read. The PULSOUT doesn't have a set time period. You have to create that in your program with a PAUSE statement.

Servos require a control pulse roughly every 20ms or they will shut themselves down. If you read the PWMpal documentation, you'll see that the units for the on/off time are 25us. For a 1.5ms on time, the value is 1500 / 25 = 60. The 18.5ms off time gives 18500 / 25 = 740.

If you're using continuous motion servos (as it looks), they may not be calibrated for a 1.5ms stop setting. The "Robotics with the BoeBot" tutorial discusses how to adjust the servo using a short test program. You can do the same thing using the PWMpal set for a 1.5ms pulse width.

Post Edited (Mike Green) : 9/26/2008 10:45:26 PM GMT

Mike Green
09-27-2008, 05:56 AM
By the way, the posting of the same question / message to two different forums is not allowed. Please delete your other message in the Robotics forum. Use the X icon in the upper right hand corner of the message box.

JackDaniels
09-27-2008, 06:01 AM
Thanks Mike, I will look into that. Sorry about posting in two places, I wasn't sure if it applied to just the stamp or to the Boe-Bot.

JackDaniels
09-28-2008, 01:55 AM
Hi Mike, thanks for the tip about the 25 microsecond unit for the PWMPAL. I'm not sure why I just assumed it was the same 2 microsecond unit as with the BS2, but it works now.

I was also having a resetting issue with the stamp because it was plugged into a 5v dc plug.. but when I let it run on batteries it worked fine.

Thanks again.

Chris Savage
10-04-2008, 12:26 AM
Jack,

Your duplicate thread in the Robotics Forum was removed. Please follow up in this original thread on your PWMPAL questions.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering

Bruce Bates
10-04-2008, 01:23 AM
Jack -

Attaching a copy of your program would be most helpful in determining the problem.

Regards,

Bruce Bates

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When all else fails, try inserting a new battery.

JackDaniels
10-06-2008, 08:49 PM
Hi Bruce, thanks for reading this thread... but the code isn't the problem, as it is a grand total of 4 lines.

I serin the value I want to send to the motors and serout to the pwmpal. That's it.

I have found something interesting now, and am one step closer to getting it working.

Starting with the original conversion I made from the 2 microsecond on the Stamp Pulsout command to the 25 microsecond on the pwmpal, I setup a program that cycles through all possible combinations of bits sent to the pwmpal.

I have the OffTime byte set all the time to 255 and start the ontime bit at 0.

From 0-59, the servo runs full throttle backward.
At 60, the servo is at full stop. (This on time produces a full stop no matter what the off time is)
from 61-~120, full throttle forward is produced,
from 120-255, full throttle slows down incrementally.

I have played around with the upper byte (the pwmpal actually takes two bytes for on/off) for both the on an off times, but can't get the boe-bot servos to run more slowly in the backward direction.

Has anyone used the PWMPAL to control the Boe-Bot servos to free up the Stamp to do other things?

Thanks