Shop OBEX P1 Docs P2 Docs Learn Events
Golf Challenge: Controlling 2 servos with one pin — Parallax Forums

Golf Challenge: Controlling 2 servos with one pin

Beau SchwabeBeau Schwabe Posts: 6,566
edited 2013-01-31 13:25 in General Discussion
The idea was suggested in this thread...

http://forums.parallax.com/showthread.php/145161-Controlling-2-servos-with-one-pin-using-a-transistor


Here is the Challenge:
Using only 1 pin and a Basic Stamp or Propeller, the object is to control two servo's using as few parts as possible.

I have a transistor only based solution, but I'd like to see what others can come up with.
«1

Comments

  • jmgjmg Posts: 15,173
    edited 2013-01-07 22:19
    Here is the Challenge:
    Using only 1 pin and a Basic Stamp or Propeller, the object is to control two servo's using as few parts as possible.

    One package/component can split the three states of a pin into two Logic signals, and another may be needed if one of those Logic signals needs to be inverted ( or the inverter may already be spare somewhere in the design )
  • ercoerco Posts: 20,256
    edited 2013-01-07 23:34
    Great idea Beau! Now name a prize and criteria to really pique interest. Minimal parts count, or elegance, or accuracy, or ease of use?
  • Beau SchwabeBeau Schwabe Posts: 6,566
    edited 2013-01-08 05:50
    erco,

    Using a Basic Stamp or Propeller... "control two servo's using as few parts as possible... using only 1 pin" - Lets keep it simple....

    How about a P8X32A QuickStart OR a BASIC Stamp 2 OEM Module (Kit Form) for the prize depending on if a Propeller or Basic Stamp was used in the solution?

    Lets announce a winner on January 31st. 12:00pm (CDT) will be the cut-off. To keep it blind, entries must be sent to me at ...

    bschwabe@parallax.com


    EDIT: Two standard Hobby servos, each with independent position control
  • Martin_HMartin_H Posts: 4,051
    edited 2013-01-08 05:58
    My solution is go buy a ServoPal. It's a single part and a complete solution!
  • RobotWorkshopRobotWorkshop Posts: 2,307
    edited 2013-01-08 07:11
    One thing that isn't clear and isn't specified is what kind of control of the servos is needed?

    - Are all the servo's connected meant to receive the SAME position information? In this case it may just be a matter of boosting the output to drive more SERVO inputs.

    - Or, is the intent to try and interleave the position information to drive two separate servos with two separate positions? Sort of like the way they were sent from the old RC transmitter to the receiver?

    That makes a huge difference....
  • Beau SchwabeBeau Schwabe Posts: 6,566
    edited 2013-01-08 07:36
    RobotWorkshop,

    Two standard Hobby servos, each with independent position control
  • ercoerco Posts: 20,256
    edited 2013-01-08 09:05
    Martin_H wrote: »
    My solution is go buy a ServoPal. It's a single part and a complete solution!

    Discontinued! http://www.parallax.com/StoreSearchResults/tabid/768/txtSearch/servopal/List/0/SortField/4/ProductID/481/Default.aspx

    Hopefully it may return one day.
  • Duane C. JohnsonDuane C. Johnson Posts: 955
    edited 2013-01-08 09:29
    How about this:
    Servo1Pin01.png

    This circuit can drive 2 analog servos independently.
    One assumes the 1mS to 2mS PWM pulses are sequentially generated in software.
    1. The lower servo is pulled high directly by the Prop Pin for the required PWM time. Then the Pin is set to input.
    2. The upper servo is pulled high when the Prop Pin is pulled LOW for the required PWM time. Then the Pin is set to input.

    Duane J
    199 x 330 - 4K
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2013-01-08 09:34
    erco wrote:
    Discontinued! http://www.parallax.com/StoreSearchR...1/Default.aspx

    Hopefully it may return one day.
    The ServoPAL is on a brief sabbatical and will return to Parallax's shelves with a SimplyTronics logo.

    -Phil
  • tonyp12tonyp12 Posts: 1,951
    edited 2013-01-08 09:40
    Is this cheating?
    2 parts:
    one tiny IC and 0.1uf cap

    Can control 2 (or even 5) servos with its 50/50mA push-pull
    Autobaud, the first 3 bits out of 8 sets the baud rate.

    http://www.ti.com/lit/ds/scps228/scps228.pdf
    852 x 284 - 19K
  • localrogerlocalroger Posts: 3,451
    edited 2013-01-08 09:55
    tonyp12 wrote: »
    Can control 2 (or even 5) servos with its 50/50mA push-pull
    Autobaud, the first 3 bits out of 8 sets the baud rate.

    I think with that part you would have trouble timing the width of the output pulses accurately enough for servo positioning. For one part in 100 your pulse timing must be accurate to 10 microseconds.
  • Beau SchwabeBeau Schwabe Posts: 6,566
    edited 2013-01-08 09:58
    Tricky! ... the one transistor solution beats the 4 transistor solution I had. Lets keep it going until the 31st.
  • tonyp12tonyp12 Posts: 1,951
    edited 2013-01-08 10:00
    >I think with that part you would have trouble timing the width of the output pulses

    With the correct software routine it could be done (the same way servo32 does it etc)

    Min PER DIN period: 0.001 ms
    Maximum switching frequency on DIN: 1 MHz
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2013-01-08 10:01
    It should be noted that a solution for the BS2 will have to be much trickier than one for the Prop. Duane's, for example, will not work with the BS2, since PULSOUT leaves the pin in an output state and will gltich the other servo.

    -Phil
  • ercoerco Posts: 20,256
    edited 2013-01-08 10:03
    @Beau: What's "simple"? Purely parts count? Is an IC the same as a resistor or cap? If so, I have a one-part $4 IC serial input 8+ servo controller IC for you.

    IMO a complete challenge (or the next challenge) should read 2 pots on one pin, which control 2 servos using a different pin. Very demonstrable.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2013-01-08 10:04
    tonyp12 wrote:
    Min PER DIN period 0.001 ms
    Maximum switching frequency on DIN: 1 MHz
    Yes, but it takes 10 clocks just to set up each pin transition.

    -Phil
  • tonyp12tonyp12 Posts: 1,951
    edited 2013-01-08 10:11
    >Yes, but it takes 10 clocks just to set up each pin transition.

    How small resoltion does a servo need, if 1ms to 2ms is the range?
    And you shop that up that in 0.001 ms parts.

    And there is no problem to stager five 2ms pulses in a 20ms period, with no overlapping.
    And you could even add the Props wait for a 12.5ns resolution.
  • Beau SchwabeBeau Schwabe Posts: 6,566
    edited 2013-01-08 10:13
    Erco,

    Even though it wasn't spelled out clearly, I think using an IC other than what's on the Stamp or Propeller is cheating. I sorta feel like I just blew $30 ... Sigh. :-)
  • ercoerco Posts: 20,256
    edited 2013-01-08 10:22
    Erco,

    Even though it wasn't spelled out clearly, I think using an IC other than what's on the Stamp or Propeller is cheating. I sorta feel like I just blew $30 ... Sigh. :-)

    I agree. Transistors & passive components only. Maybe relays & plywood.

    Hmmm. How fast can I toggle a relay? :)
  • Duane C. JohnsonDuane C. Johnson Posts: 955
    edited 2013-01-08 10:46
    It should be noted that a solution for the BS2 will have to be much trickier than one for the Prop. Duane's, for example, will not work with the BS2, since PULSOUT leaves the pin in an output state and will glitch the other servo.
    Ok, I don't have a BS2 but I would think you could do it the old fashioned way with a software wait function for the 1mS to 2mS PWM and input tri-state, (input), times.

    Note! Since the BS2 is a 5V part, as I understand it, the resistors would need to be adjusted a bit.

    Duane J
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2013-01-08 10:54
    ... but I would think you could do it the old fashioned way with a software wait function...

    'Too much interpreter overhead to get the required precision.

    -Phil
  • Duane C. JohnsonDuane C. Johnson Posts: 955
    edited 2013-01-08 14:47
    Is there a thorough general specification for Analog RC Servos?

    I have look at quite a few of the manufacturers websites and not found a full spec for the PWM input pin.
    Sure, they describe the timing requirements. but I need more.

    What I want is the input pin electrical requirements.
    1. Voltage input min/max of the pulses? (There is a vague suggestion it is 3V to 5V in Wikipedia.)
    2. What is the input impedance or resistance?

    Duane J
  • jmgjmg Posts: 15,173
    edited 2013-01-08 19:13
    Two standard Hobby servos, each with independent position control

    You need to define the signals more than this. - and add a Temperature and Voltage span for good measure.
    Some circuits may be 'simple', but very temperature/device param dependent.

    Reliable often matters more than saving one fractional-cent resistor, or 3c transistor.
  • Beau SchwabeBeau Schwabe Posts: 6,566
    edited 2013-01-08 20:02
    Servo Specs:

    500us - 2500us active position pulse with a 20ms (+/- 2ms) Period between pulses.

    LOW = < 0.8V
    HIGH = > 2V

    Input impedance on the signal line to the servo might be as low as 1k
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2013-01-08 20:23
    jmg wrote:
    You need to define the signals more than this. - and add a Temperature and Voltage span for good measure.
    Some circuits may be 'simple', but very temperature/device param dependent.

    Reliable often matters more than saving one fractional-cent resistor, or 3c transistor.

    jmg,

    Are you planning to enter the challenge or just to critique its premises?

    -Phil
  • jmgjmg Posts: 15,173
    edited 2013-01-08 22:39
    jmg,

    Are you planning to enter the challenge or just to critique its premises?

    -Phil

    Did you not read the whole thread ? - I already gave a suggestion way back in #2

    If you want a part number to add to that, try the PUMD9 (et al) One, (or two), of those
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2013-01-08 23:30
    jmg wrote:
    Did you not read the whole thread ? - I already gave a suggestion way back in #2

    My apologies. I had overlooked the detailed circuit embedded in those broad brushstrokes. :)

    Here's my entry:

    attachment.php?attachmentid=98539&d=1357716228

    The outputs may need pull-down resistors for servos with high input impedance.

    -Phil
    267 x 340 - 2K
  • Duane C. JohnsonDuane C. Johnson Posts: 955
    edited 2013-01-09 00:18
    jmg wrote: »
    I already gave a suggestion way back in #2

    If you want a part number to add to that, try the PUMD9 (et al) One, (or two), of those
    Here is the spec:
    The NXP PUMD9
    There are a number of manufacturers that make things like this with various combinations of resister and transistor values, Rohm comes to mind.

    Duane J
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2013-01-10 17:01
    'Figured out how to use the tri-state technique with a BASIC Stamp. The SEROUT command has an OPEN mode, and both NORMAL and INVERTED polarity. Bit-time resolution for the BS2 is 1 usec. You could just send a start bit that long, but that extends the time between pulses by a lot. I decided to use a start bit and three data bits, which changes the pulse-width resolution to 4 usec -- a tradeoff for sure, but it leaves more time in the 20 msec interval to do other stuff. Anyway, here's my test program for the BS2:
    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    
    SERVO PIN 0
    
    us VAR Word
    
    DO
      us = 1500
      GOSUB pulslo
      us = 1000
      GOSUB pulshi
      PAUSE 10
    LOOP
    
    pulslo:
      SEROUT SERVO, us >> 2 + 32748, [$f8]
      RETURN
    
    pulshi:
      SEROUT SERVO, us >> 2 + 49132, [$f8]
      RETURN
    

    Here's a scope trace, where the output drives a 4.7K-4.7K voltage divider:

    attachment.php?attachmentid=98578&d=1357866085

    -Phil
    640 x 480 - 11K
Sign In or Register to comment.