Shop OBEX P1 Docs P2 Docs Learn Events
Servo's — Parallax Forums

Servo's

Brandon C.Brandon C. Posts: 106
edited 2009-06-10 02:37 in Propeller 1
Hi! I am about to order the propeller chip. I have just one more question though. Can the chip run up to 32 servos at once, or move one at a time?

Comments

  • Chad GeorgeChad George Posts: 138
    edited 2009-06-07 17:27
    Yes, there is an object in the default library that controls 32 servos on a single cog.
  • Brandon C.Brandon C. Posts: 106
    edited 2009-06-07 17:29
    OK great! Thanks!
  • SRLMSRLM Posts: 5,045
    edited 2009-06-07 18:45
    Note that you'll need a power supply that can handle the servos...
  • Brandon C.Brandon C. Posts: 106
    edited 2009-06-07 19:18
    I'm aware of that. smilewinkgrin.gif

    Will I need a resistor between the pulse wire and the Propeller?
  • W9GFOW9GFO Posts: 4,010
    edited 2009-06-07 19:26
    Mr. Dr. Professor said...
    I'm aware of that. smilewinkgrin.gif

    Will I need a resistor between the pulse wire and the Propeller?

    It is recommended to use a 4.7 k resistor, I'm not sure why.

    Rich H
  • Mike GreenMike Green Posts: 23,101
    edited 2009-06-07 19:32
    You could also use a lower resistor value, like 1K. The purpose of the resistor is to reduce noise pulses coming from the servo. Theoretically, the servo shouldn't produce any noise since the control lead is an input for the servo, but it is possible for some of the motor noise to be coupled back into the control lead and the 1K (approximately) resistor would attenuate this without interfering with the control pulses coming from the Propeller.
  • Bill HenningBill Henning Posts: 6,445
    edited 2009-06-07 19:46
    You will need to add extra outputs as the Propeller only has 32 I/O pins in total, and four are by default used for I2C and serial ports.

    Cheapest / simplest is probably to add four 74HC595's, and using just four Propeller pins you can get the 32 I/O's you need.
    Mr. Dr. Professor said...
    Hi! I am about to order the propeller chip. I have just one more question though. Can the chip run up to 32 servos at once, or move one at a time?
    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Largos - a feature full nano operating system for the Propeller
    www.mikronauts.com - a new blog about microcontrollers
  • W9GFOW9GFO Posts: 4,010
    edited 2009-06-07 20:18
    Bill Henning said...
    You will need to add extra outputs as the Propeller only has 32 I/O pins in total, and four are by default used for I2C and serial ports.

    Really? I was under the impression that after boot up, those pins were free to be used.

    Rich H
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2009-06-07 20:27
    W9GFO,

    After bootup ALL 32 pins can be assigned to Servo's

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • Brandon C.Brandon C. Posts: 106
    edited 2009-06-07 20:58
    I don't even have 32 servos! I was just curious if I would actually be able to move all those servos at the same exact time. I only need like 6 pins for servos.

    Anyways I just ordered my Propeller chip. I am so excited! roll.gif

    Thank you all for the help!
  • Bill HenningBill Henning Posts: 6,445
    edited 2009-06-08 00:30
    Beau,

    That is true, however I wonder how the Servo's would like the I2C traffic during boot, or serial traffic while programming.

    Bill
    Beau Schwabe (Parallax) said...
    W9GFO,

    After bootup ALL 32 pins can be assigned to Servo's
    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Largos - a feature full nano operating system for the Propeller
    www.mikronauts.com - a new blog about microcontrollers
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2009-06-08 03:27
    Bill Henning,

    I believe that this has been brought up before, and there are ways to buffer the signal to the servo upon powerup. During testing when I wrote the object, normal I2C traffic to the EEPROM did not seem cause any noticeable movement on the servo's.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • Bill HenningBill Henning Posts: 6,445
    edited 2009-06-08 03:40
    Thanks Beau,

    That is good to know... I do plan on getting into robotics, and have some servo's waiting for my attention smile.gif
    Beau Schwabe (Parallax) said...
    Bill Henning,

    I believe that this has been brought up before, and there are ways to buffer the signal to the servo upon powerup. During testing when I wrote the object, normal I2C traffic to the EEPROM did not seem cause any noticeable movement on the servo's.
    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Largos - a feature full nano operating system for the Propeller
    www.mikronauts.com - a new blog about microcontrollers
  • Joel RosenzweigJoel Rosenzweig Posts: 52
    edited 2009-06-08 15:30
    I was just curious if I would actually be able to move all those servos at the same exact time.
    The Beau's servo object in the OBEX will move a group of 8 servos at one time, followed by the second group of 8 servos, followed by the third group of 8, followed by the 4th group of 8 servos.· It will not move all 32 servos at the same exact time.· But, because these groups are sequenced closely together, the results will look reasonable for many applications.

    If you must have all of your servos move at the same time, make sure they are in the same group of 8.· If you need more than 8 servos to move at the same time, you'll have some code modifications to make.· You said above you're only only to move 6, so you should be fine as-is.

    Joel-


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I saved Earth from an Alien Attack.· Can you?


    http://www.joelspennyarcade.com
    ·
  • W9GFOW9GFO Posts: 4,010
    edited 2009-06-08 15:51
    Joel Rosenzweig said...

    The Beau's servo object in the OBEX will move a group of 8 servos at one time, followed by the second group of 8 servos, followed by the third group of 8

    Beau's servo object sends a pulse to each of 32 servos every 20 milliseconds. Rather than send a pulse to all 32 then wait 20 mS it sends a pulse to eight, waits 5 mS, sends pulse to eight more, waits 5 mS and so on.

    There is no disadvantage whatsoever in this approach as far as controlling servos is concerned. All servos are updated at 50 hz. With the exception of very high performance servos, there is nothing to be gained by framerates faster than 50 hz.

    Rich H
  • Mike GreenMike Green Posts: 23,101
    edited 2009-06-08 16:11
    The main reason for staggering the pulses for groups of 8 is to reduce the peak current drain. If you commanded all 32 servos to move at the same time and they were heavily loaded (mechanically), the peak current drain could be as high as 32A (1A per servo). With only 8 servos initiating a new movement at a time, the peak current drain would be more like 8A + maybe 6A for the other 24 servos in steady state movement. These numbers may be wildly off, but the idea is the same ... You get about 5ms for the peak current load from the group of 8 servos to subside before starting up another group of 8 servos.
  • W9GFOW9GFO Posts: 4,010
    edited 2009-06-08 16:22
    I thought the purpose of staggering was to avoid the propeller chip having all it's pins go high at the same moment.

    Rich H
  • Brandon C.Brandon C. Posts: 106
    edited 2009-06-08 17:10
    So would there be any noticeable lag in between a group of servos moving?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    No purchase necessary. See back panel for more details.

  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2009-06-08 17:19
    W9GFO,

    Mike is correct. It would have actually been easier to make all pins HIGH and then drop them off in turn, but the initial current demand (Not on the Propeller) on the Servo's would be large.


    Brandon C.,

    If you can perceive 15ms (worst case scenario) then you would see a noticeable lag. Between each group, there is a lag difference of 5ms. ...Consider a single servo however, the lag difference of a single servo can be as high as 20ms if you send an update right at the tail end of the servo pulse. The lag between groups is really negligible.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • Brandon C.Brandon C. Posts: 106
    edited 2009-06-08 17:30
    That's fine. If I ever do use 32 servos in a robot, the robot would obviously be big enough to support my external servo controller (SSC-32). For now I am just using a small 6 servo biped and would like a single board that can control 6 (maybe 7) servos at a time. The propeller would be perfect for this.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    No purchase necessary. See back panel for more details.

  • W9GFOW9GFO Posts: 4,010
    edited 2009-06-08 17:33
    Somewhere I read a caution about setting a large number of pins high, don't remember where. Does this not apply to the Propeller? Or perhaps it only applies when driving LEDs or something that draws more current.

    Rich H
  • SRLMSRLM Posts: 5,045
    edited 2009-06-08 18:21
    @W9GFO
    You have to be careful about how much current you source sink. There is a rating for each pin and a separate rating for a group of 8 pins. So if you set all pins high then, depending on what you're doing, you may have a problem. The series resistor would help prevent the problem.
  • Joel RosenzweigJoel Rosenzweig Posts: 52
    edited 2009-06-09 18:44
    W9GFO said...

    There is no disadvantage whatsoever in this approach as far as controlling servos is concerned. All servos are updated at 50 hz. With the exception of very high performance servos, there is nothing to be gained by framerates faster than 50 hz.

    Rich H
    Rich,

    You're confusing frame rate (50hz) the rate at which servos are given a signal pulse, with the phasing, the point in time within a frame at which a servo is given its update signal pulse.··As I indicated earlier, Beau's object cascades 4 groups of updates.· Each group updates 8 servos at the same time.· This has nothing to do with the frame rate.· Because the groups are cascaded,·all servos do not get updates at exactly the same time.

    Whether or not this makes a noticeable difference to anyone is a different issue.· The answer to that depends completely on the requirements of the mechanical system that the servos are part of.·

    The reason I even replied to the thread was that I have a particular sensitivity to this phase issue in my applications.· It was quite possible that the original poster would have a similar sensitivity, too.· It's hard to say without knowing what he was doing.· Making a blanket statement that there is no disadvantage whatsoever in this approach can lead people down the wrong path.·

    Joel


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I saved Earth from an Alien Attack.· Can you?


    http://www.joelspennyarcade.com
    ·
  • W9GFOW9GFO Posts: 4,010
    edited 2009-06-10 02:37
    Joel Rosenzweig said...

    You're confusing frame rate (50hz) the rate at which servos are given a signal pulse, with the phasing, the point in time within a frame at which a servo is given its update signal pulse.

    No, I wasn't. But I agree that in certain situations with critical timing issues that the phasing could present a problem so I will amend my statement.

    There is no disadvantage whatsoever in this approach as far as controlling servos is concerned - except in special cases where critical timing is an issue where more than eight servos (or multiple servos that cannot be in the same group) must begin movement within less than 15 mS of each other or be synchronized within less than 15 mS.
    Joel Rosenzweig said...
    The Beau's servo object in the OBEX will move a group of 8 servos at one time, followed by the second group of 8 servos, followed by the third group of 8, followed by the 4th group of 8 servos. It will not move all 32 servos at the same exact time. But, because these groups are sequenced closely together, the results will look reasonable for many applications.

    I was responding to that mostly. All servos in fact can be moving at the exact same time unless they are commanded to move such a small amount that they are finished moving in under 15 mS. It made it sound a little bit like eight servos would move, then eight more, then eight more and so on - as if only eight could me moving at any one time. I think that under normal uses it would look more than "reasonable".

    Rich H
Sign In or Register to comment.