Shop OBEX P1 Docs P2 Docs Learn Events
active servo after program ends — Parallax Forums

active servo after program ends

ToddHToddH Posts: 34
edited 2005-01-28 19:36 in Robotics
I am building a BoE-Bot and thought it would be fun to attach a camera on to it. I bought a pan/tilt kit from here:
www.lynxmotion.com/Category.aspx?CategoryID=61

It came with 2 HiTec hs-422 servos.

I used my "testservo.bs2" program that I create in my "What is a microcontroller?" lesson (chapter 4 I believe).

I connected one servo to servo plug 14 and the second servo to servo plug 15. Attached is my program. I pretty much have both servos sweep left to right. The odd thing is that after the program ends, one of the servos always steps little by little to the right - as if its getting a quick shot of PULSOUT 15, 1000, but over and over. I wondered if it was the servo pin I was using, so I switched them. No matter what, its always the same servo - no matter what pin I plug it into.

I used a parallax standard servo and got what I thought was "normal" behavior. The second HiTech hs-422 servo behaves fine as well.

Does anyone have any idea why the servo would behave like this after the program has finished running?

Comments

  • ToddHToddH Posts: 34
    edited 2005-01-28 02:39
    Okay,

    I simplified my program for clarity. Again, after the program completes, 1 of my servos pulses to the right like it continues to get a PULSOUT 15, 1000 command. Is something wrong with the servo or me? lol

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}

    counter VAR Word

    DEBUG "Straight Ahead", CR

    FOR counter = 1 TO 100
    PULSOUT 15, 750
    PAUSE 20
    NEXT

    END
  • edited 2005-01-28 02:40
    Try this instead:

    LOW tiltServo
    LOW panServo

    STOP

    With END, the BASIC Stamp goes into sleep (low power) mode. The I/O pins switch to input for 18 ms every 2.3 seconds, which may have something to do with the stray servo motion. STOP will keep the I/O pins LOW, at the price of a little more power. It's still a small fraction of the power the servos would consume if you ended the program by delivering pulses to the servos in an endless loop to make them hold a given position.
  • ToddHToddH Posts: 34
    edited 2005-01-28 02:47
    Andy,

    The STOP worked like a champ. You are the best. Where else can I get the author of the text book that I'm going through answer my questions in such a timely manner - if at all!

    I still scratch my head a little. Why would 1 servo out of 3 behave like that? Any clue?

    Todd
  • edited 2005-01-28 17:38
    Thanks Todd,

    Yeah, I'm glad STOP worked because it would have been quite a head-scratcher otherwise.

    When an I/O pin is an input, the voltage it is easily affected by nearby voltages or electric fields. For example, you can set all the I/O pins to INPUT, then display their states using DEBUG HOME, BIN16 INS: PAUSE 100 inside a loop. Putting your hand near I/O pin sockets (or the BASIC Stamp) will cause some of the I/O pins to change state. Sometimes a pull-up resistor will cause an adjacent I/O pin that was reporting low to report high, likewise with setting an adjacent pin HIGH or LOW, but not always.

    Anyhow, during those 18 ms of input that occur every 2.3 seconds, "something" is pulling up lightly on that one servo signal line, and the servo is interpreting it as a control pulse. It might be a servo manufacturing variation, like maybe there's some flux that wasn't washed off the printed circuit board inside the servo. The flux could be behaving like a pull-up resistor to a nearby Vdd connection. It could also be one of those phantom influences exerted by something nearby the I/O line as it travels from the Interpreter chip pin on the BASIC Stamp to the servo input.

    Although you can try rearranging the servo connections to have a better guess as to whether it's in the servo or inherent to the I/O connection, the main thing to keep in mind is that these things can be remedied by other measures. Changing END to STOP was one example. Another would be a pulldown resistor. By connecting a 10 k resistor from Vss to the I/O line, you can go back to using END, because when the BASIC Stamp spends its 18 ms as an input, the servo control line is pulled down by the resistor.
  • ToddHToddH Posts: 34
    edited 2005-01-28 19:36
    Just for the education factor I'll give the 10k resistor a shot. Oh, and I took my BoE-Bot to work - even though I work in an IT shop they all thought I was a geek. Then again, they all wanted to know how they could get their own - lol
Sign In or Register to comment.