Shop OBEX P1 Docs P2 Docs Learn Events
basic stamp- servo motors — Parallax Forums

basic stamp- servo motors

eskrima1eskrima1 Posts: 3
edited 2010-01-11 19:12 in BASIC Stamp
Hello, I was wondering if someone could tell me, how many servo motors can be run·using I/O·on the basic2 homework board. Also, can power and ground be supplied separately to the servo while using the pulsout signal from the bs2? thanks

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-01-09 01:16
    You can certainly use 3 servos with a HomeWork Board. 8-10 servos is pretty well a maximum. What happens is that a Stamp can only produce one control pulse at a time and the pulse can be up to 2ms in width. The control pulses need to be repeated about every 20ms or the servo will shutdown. 10 servos at 2ms takes a total of 20ms and that leaves no time for the Stamp to do anything else. Practically speaking, 4-5 servos is probably a maximum. All of this assumes that the servos are not being powered by the HomeWork Board. Servos can take a lot of current, typically up to 1 Amp each under heavy mechanical load and the HomeWork Board can't supply that.

    You can certainly supply power separately to the servos. You need to have a common ground connection. A 6V supply is best.
  • Bill ChennaultBill Chennault Posts: 1,198
    edited 2010-01-09 02:40
    Mike--
    The control pulses need to be repeated about every 20ms or the servo will shutdown.
    

    ·Will you please explain to me what you mean by "shutdown?" Pardon me for asking something that is doubtless obvious.

    --Bill

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    You are what you write.
  • eiplannereiplanner Posts: 112
    edited 2010-01-10 08:10
    I suppose I can post this here instead of Robotics because of the title on the thread and I am running the stamp on my Boe.

    I am loving the Boe and the lessons, but right now, I am struggling to keep the DURATIONS constant in performing things like a simple 1 ft radius right turn, straight driving, and all the other maneuvers. Whats happening is: I will spend several rounds of setting the durations, watching the travel, resetting the durations, and so on until I get it to do exactly what I want it to do. Then I will move on to the next maneuver and perform the same steps. However, when I go back to a previous maneuver that was already fine tuned and try it again, it won't repeat the maneuver anywhere near the way it did before. It seems to me that the battery levels are playing havoc on the repeatability. I say this because I can spend 30 minutes running the Bot back and forth from the computer to the floor executing the same maneuver to fine tune it and it eventually gets achieved. Then after I set the Bot down and work on some programming or something for 20 minutes and go back and try the same maneuver again, it doesn't perform it the same. Is this inherent of the servos? Or, do I need some sort of voltage regulator in the circuit to achieve a steady voltage? I'm talking about the duration argument not being off by 1 or 2, it's goes off by 30 to 40. I calibrate it again to do the task and over and over this keeps happening.

    -I centered the servos.
    -I attached all mechanical parts precisely as directed by the book.
    -I refresh the batteries prior to full depletion. ( I am most of the time running the Boe on what I would say was batteries in mid cycle...not fully charged and not low)
    -I test run after test run to fine tune each maneuver until it can repeat it multiple times before I start a new one.
    -I am using simple PULSOUT commands with no variables that could be getting mixed up.

    counter VAR Word

    ' Boe-Bot Spin Left

    FOR counter = 1 to 24
    PULSOUT 13, 850
    PULSOUT 12, 850
    PAUSE 20
    NEXT

    This is all each of my maneuvers consist of.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    It's not the size of the dog in the fight, but the size of the fight in the dog.
  • Mike GreenMike Green Posts: 23,101
    edited 2010-01-10 16:22
    @eiplanner - These RC servo motors are inherently inaccurate. You are simply not going to be able to get the reproducible movement you want with just the servo. All of the thing you've done do help including the use of fresh batteries. Using rechargable batteries does help because they have a relatively flat discharge curve compared to alkalines. Using a voltage regulator can help some, but you need a large enough regulator with a heat sink (the BoeBot's one will work with 2 servos). You will also need a larger battery pack (5 cells instead of the BoeBot's normal 4 cell battery).

    Look at the wheel position encoder kit for the BoeBot. This allows the BoeBot to track the actual distance moved by each wheel. You will still have problems with wheel slippage on the ground that the encoder won't measure. The only way around that is for the BoeBot to have some kind of absolute position mechanism. You can't use dead reckoning.

    www.parallax.com/StoreSearchResults/tabid/768/List/0/SortField/4/ProductID/80/Default.aspx?txtSearch=wheel+encoder

    @Bill Chennault - As I understand it, analog RC servos use the control pulse to turn on the control circuitry that holds the motor in position (probably to save battery power). I'm sure there's an RC delay circuit set for somewhere over 20ms that switches on power to the H-bridge. If no pulses come in, somewhere past 20ms, the motor power is turned off so the servo mechanism won't maintain position. The only thing doing so is the friction of the geartrain. If you use pulses, say 50ms apart, the motor will have a jerky movement and tend to slip because the power is being turned on and off.
  • Bill ChennaultBill Chennault Posts: 1,198
    edited 2010-01-10 16:44
    Mike--

    Thanks. You pretty much exactly described my problem, which appears to be similar to eiplanner's.

    I will play around a bit with the little Parallax "Standard" servo. All I want it to do is move the Ping sensor back and forth and that probably does not have to be highly accurate! If I can't get it to do what I want before long, I will go to Plan B, which is probably three Pings mounted at some more or less optimum angle relative to one another on the front of the machine.

    --Bill

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    You are what you write.
  • eiplannereiplanner Posts: 112
    edited 2010-01-10 19:17
    Mike,

    I'm a little disappointed with the inaccuracy of the servos. I would have liked to be able to perform dead reckoning with the Bot. It sounds like the only way to accomplish it is through the use of sensors, place marks, line following and such. Even then, I fear the movements might be a bit jerky.

    I will try the extra battery or maybe even another 4 pack, a separate voltage regulator, some pulse ramping, a stationary on signal to wake up the servos, and anything else I can come up with and I will post back the results.

    Thanks for the information.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    It's not the size of the dog in the fight, but the size of the fight in the dog.
  • FranklinFranklin Posts: 4,747
    edited 2010-01-10 19:36
    The inaccuracy of the servos comes about from the fact that they have been modified from their intended purpose and were not designed to be precision devices in the first place. If you want accuracy you can have it with the proper hardware but servos are not that hardware.

    " I am a little disappointed with the acceleration of my Yugo. I would have liked to go from 0 to 60 in 3.5 seconds. " [noparse];)[/noparse]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • eiplannereiplanner Posts: 112
    edited 2010-01-11 02:05
    Well Franklin, I'm still waiting for you to tell me what is the proper hardware. I'm also still looking for any helpful advice that might be still trapped in your comment. All I can find is a cute analogy about your Yugo. You have basically stated:

    I am up an unsanitary tributary without any feasible means of propulsion!

    or better yet, it sounds like you are saying...

    I chose to enter the unsanitary tributary without even considering propulsion.

    Page 132 of the "Robotics with the Boe-Bot" refers to dead reckoning as a very popular entry level robotics contest under Activity #3: Calculating Distances. The book also states that you must use trial and error to fine tune your Boe-Bot. After spending at least 12 hours tweaking and tweaking the PULSOUT Durations and still not getting the Bot to make a full 4 ft diameter circle and stopping in the start location, I simply inquired about what I might be doing wrong. Upon finding out that it is not even possible to accomplish this with just the servos, yes, I was disappointed! I wasted a lot of time on something I shouldn't have.

    I don't think I was wrong in assuming that the Boe-Bot was an entry level robot that was capable repeating the same movement twice. A small note in the text concerning inaccuracies of servos may have saved me some time. It was like shooting a gun with a warped barrel and wondering why you can't hit the bullseye.

    Thanks for sharing...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    It's not the size of the dog in the fight, but the size of the fight in the dog.
  • FranklinFranklin Posts: 4,747
    edited 2010-01-11 02:45
    I think your first analogy is more correct. You are trying to get precision from non precise parts. I would recommend encoders and stepper motors if the floor to wheel connection can be maintained or a much more robust system with accelerometers, gyros and encoders if you plan to be on rough surfaces.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • W9GFOW9GFO Posts: 4,010
    edited 2010-01-11 19:12
    One thing that can help with accuracy of movement is to either ramp or pause between changing directions. In other words, a 90 left turn and stop will result in a different heading than a 90 left turn that immediately transitions into driving forward.

    Also, the servos being non precise as they are, may not respond proportionally identical. If you do some testing by timing rotations you can figure out if a correction factor is needed to be applied to one of the servos.

    Note that these things will not achieve fine repeatability, however, it may help a bit.

    Another thing, as the PULSOUT values change the duration of your loop will change. In pursuit of the best accuracy you need to modify the PAUSE times appropriately:

    FOR a = 0 TO 100
    PULSOUT 14, 280     ' takes about 1/4 mS for the command and 1/2 mS for the pulse length total ~ .750mS
    PULSOUT 15, 280     ' another ~ .750 mS
    PAUSE 18            ' The other lines of code use up a small amount of time so I use PAUSE 18 to keep the pulses close to every 20mS - because that's just the way I am. 
    NEXT                ' PAUSE 20 would be fine but be sure to reduce once you add more code within the loop or the servos may start stuttering
    
    FOR a = 0 TO 100
    PULSOUT 14, 1280    ' takes about 1/4 mS for the command and 2.5 mS for the pulse length total ~ 2.750mS
    PULSOUT 15, 1280    ' another ~ 2.750mS
    PAUSE 14            ' 20.000mS - (2 * 2.750mS) = 14.500mS round down to account for execution time of FOR..NEXT
    NEXT
    
    FOR a = 0 TO 200
    PULSOUT 14, 790     ' takes about 1/4 mS for the command and 1.5 mS for the pulse length total ~ 1.750mS
    PULSOUT 15, 790     ' another ~ 1.750mS
    PAUSE 16
    NEXT
    



    Rich H

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Simple Servo Tester, a kit from Gadget Gangster.

    Post Edited (W9GFO) : 1/11/2010 8:14:08 PM GMT
Sign In or Register to comment.