Shop OBEX P1 Docs P2 Docs Learn Events
How to avoid BS2 startup chaos? — Parallax Forums

How to avoid BS2 startup chaos?

RichardFRichardF Posts: 168
edited 2008-05-07 13:27 in BASIC Stamp
My application (submersible ROV) uses output pulses from a BS2 to four HB25 motor controllers, which then control four motors with propellers attached. System works fine except I don't like what happens when I download a minor change to the program. During download, spurious pulses are being sent from the BS2 to the HB25's (they are random and never the same) causing some of the ·motors to go nuts and settle in a fixed state (sometimes high RPM, sometimes low RPM, sometimes forward, sometimes reversed) that is frankly irritating and a little dangerous. Once the program download is complete, I·then can do a reset (power OFF/ON) and everything is back to normal and under control of the program (motors off until told to run).·I don't understand what is happening here so I can't attempt a fix. Any suggestions would be greatly appreciated.
Thanks,
Richard

Comments

  • allanlane5allanlane5 Posts: 3,815
    edited 2008-04-25 13:08
    I'm going to assume that during programming, all I/O pins are put in an input (and therefore 'floating') state. In this state, 60 Hz noise will appear on these lines. It's quite likekly this 60 Hz noise is triggering the HB25's.

    Is it possible to turn off the HB25 power, without turning off the BS2 power?

    It's also possible a 10 Kohm pullup (or pull-down) resistor would kill the noise sufficiently to not trigger the HB25's, while still allowing the BS2 to control the HB-25's during normal use.
  • Mike GreenMike Green Posts: 23,101
    edited 2008-04-25 13:11
    Sounds like some kind of "noise" coupling from the programming lines to the output lines. During programming, the I/O pins are all in a high impedance state which makes this easier. Try pulldown resistors from the HB25 I/O pins to ground. A 1K resistor would add a 5mA load which should help.
  • stamptrolstamptrol Posts: 1,731
    edited 2008-04-25 17:23
    Richard,

    I have noted the same behaviour and am a bit paranoid about motors running away. I guess working around 30,000 HP motors, you get that way.

    Anyway, what I do is add a relay in series with one motor lead. It has to be a relay that can handle the full load current of the motor.

    When the Stamp starts up, the relay coil is de-energized. The HB-25 gets powered up as per normal and will take its signal pin high when its ready. I then take the signal pin low and send one or more serout's to put the hb-25 in the "off" condition. This is pretty much as per the sample code for the hb-25.

    Finally, I energize the relay which allows the hb-25 to deliver power to the motor.

    Since doing things this way, I haven't had a problem.

    Cheers,

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tom Sisk

    http://www.siskconsult.com
    ·
  • RichardFRichardF Posts: 168
    edited 2008-04-25 21:09
    This is the startup code I am using for the HB25's, which is pretty much what Tom suggested. I am going to give the pull-down resistors a try as suggested by Allen and Mike. By the way, I do my programming right nest to a 100 watt,60 Hz lamp! Hmmmm.
    Richard

    'Initialize
    MtrDir = 0: Mtr12Spd = 0: Mtr34Spd = 0: LVcmd = 0
    LOW Mtr1: LOW Mtr2: LOW Mtr3: LOW Mtr4 'output pins to HB-25's
    PULSOUT Mtr1,750:PULSOUT Mtr2,750 'stop pulse to HB-25's
    PULSOUT Mtr3,750:PULSOUT Mtr4,750
  • Bill ChennaultBill Chennault Posts: 1,198
    edited 2008-04-26 02:37
    All--

    This BS2/HB-25 problem sounds exactly like the one I have in Ugly Buster, my skid steer robot. Like Richard, I am not using pulldown resistors on the BS2/HB-25 control lines.

    Perhaps we have the same problem.

    --Bill

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    You are what you write.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-04-28 22:32
    Allan had the right idea originally…When the BASIC Stamps are programmed or identified the module is actually reset. When reset the BASIC Stamp I/O pins become inputs until the program initializes the I/O lines. During the time they are inputs the internal pull-up on the HB-25 will pull them high. Since they are normally held low what is happening is that the brief time they are inputs (during reset) is being interpreted as a pulse. To minimize this we disallowed pulses outside a normal servo pulse width however I can see where rare situations could still cause this. One possible solution is to put a small delay of ~2 ms before the I/O lines are initialized. Since that is outside the max pulse width it may cause the HB-25 to ignore the pulse altogether. I hope this helps. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • RichardFRichardF Posts: 168
    edited 2008-05-07 10:14
    To all who helped, thanks. Problem solved with 10K pulldown resistor on HB-25 input.
    Richard
  • allanlane5allanlane5 Posts: 3,815
    edited 2008-05-07 13:27
    I just love it when simple solutions work. Well done.
Sign In or Register to comment.