Shop OBEX P1 Docs P2 Docs Learn Events
Floating servo control voltage causing a twitch? — Parallax Forums

Floating servo control voltage causing a twitch?

SteveWoodroughSteveWoodrough Posts: 190
edited 2008-05-14 02:28 in BASIC Stamp
Am I doing something stupid?· In order to prevent servo twitch I have to drive the stamp pin out HIGH.· Will I burn something out or use up too much current, etc. or is that just the way things need to be done?

Here's the scenario:

I'm trying to control an RC car ESC like a servo.· Once initialized, the ESC and the stamp work well together.· The trick is getting the ESC initialized.· The whatever the ESC "see's"· when the ESC set button is pressed is the Neutral or stopped speed.· This ESC likes 750 PULSOUT from the stamp.· To accomplish this, for the first few seconds after the STAMP "boots up " I send a 750 PULSOUT to the ESC.· After that period the ESC would be "ARMED" but a strange thing would happen.· Every 2.5 or so seconds the ESC would jolt the motor for a very short burst (~1/16 second).·

What I found was that if I did not drive the control pin HIGH (LOW had no effect) the ESC would jolt the motor for about 1/16 second every 2.5 or so seconds.·· This is not unique to the ESC.· I got the EXACT same response using my STAMP servos.· The servos too would jump at the same rate and frequency.· If the output pin is driven HIGH the servos did not twitch.

Is setting the pin HIGH when "not in use" the "proper" solution?

THANKS GUYS!!!

Attached is the stripped down code

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2008-05-13 05:34
    Put a DO : LOOP before the END statement and the problem should go away.

    Now the explanation: When the BASIC Stamp executes an END, it goes to sleep, reawakening every 2.3 seconds. When it does this, the pins tristate momentarily, which is what causes the glitch on your servo pin. The infinite loop just keeps the Stamp awake, preventing the sleep/wake cycle.

    -Phil
  • SteveWoodroughSteveWoodrough Posts: 190
    edited 2008-05-14 01:37
    Thanks Phil, worked as advertised.·

    Next question:
    When working with signals that can trigger big events, like running an RC car ESC, is it a good idea to let the pin value float or would I be better off drving the pin value either HIGH or LOW? If I let the pin voltage float (I'm assuming it does) do I run the risk of a stray signal sending an unwanted command (blip)?

    ·
  • Mike GreenMike Green Posts: 23,101
    edited 2008-05-14 01:45
    It's never a good idea to let the input to a gate or other CMOS logic float.· These are very susceptible to noise.· You can either drive the I/O pin high or low or you can use a pullup (to +5V) or pulldown (to ground) resistor to provide a default voltage.· A value of 10K works well.
  • SteveWoodroughSteveWoodrough Posts: 190
    edited 2008-05-14 02:26
    So if I want the NO SIGNAL state to be ground (seems safer) I should put a 10K resistor from PIN 13 to to VSS?
  • allanlane5allanlane5 Posts: 3,815
    edited 2008-05-14 02:28
    Yes, exactly. A 10 Kohm resistor from Pin13 ("signal") to Vss (ground) will hold the signal 'low' when the BS2 is in reset or being programmed.
Sign In or Register to comment.