Shop OBEX P1 Docs P2 Docs Learn Events
Weird reset problem — Parallax Forums

Weird reset problem

JBWolfJBWolf Posts: 405
edited 2013-02-07 15:17 in Propeller 1
Hello,
I am having a weird problem with pin outputs causing some kind of reset.
I am using 2x unipolar stepper motors connected to a single ULN2803 (4 wires for each motor). The ULN2803 is connected directly to the prop with 8 wires.
The 8 pins connected to the ULN2803 are set for output using dira[1..8]~~
I am using half-stepping output on those pins with a DAT array: %0001, %0011, %0010, %0110, %0100, %1100, %1000, %1001.

Both motors work fine, I have used this exact method before with no problem on other projects... but this one has some kind of glitch.
If i move motor #1 via tact switch input, it moves in both directions no problem.
If i move motor #2 via tact switch input, it moves in both directions no problem.
BUT, if I quickly switch between pressing the button to move motor #1 and the button to move motor #2, it causes all the output pins to pause and go low for about 2 seconds then re-establishes their programming.
It only happens when I switch between moving the 2 different motors quickly. I cannot make the problem repeat itself accurately (specific button press combo or number of times), it seems to do this somewhat randomly, but always happens.
This affects every pin which something is attached to. I have an Xbee attached, a relay for powering an external device and several LED's on other pins as well... all of these do the 2sec reset when the motor glitch happens, then resume normal activity.

I am using an XBee transmitter and receiver... the prop with transmitter has the buttons to move the motor and the prop with receiver has the motors... I can see the transmitter still sending data during the 2sec reset on the receiver prop, the receiver xbee receive led turns off during this reset.
The XBee receiver is running in one cog and everything else is running in another cog (motors, relay, led's)... so only 2 cogs are used.

Any idea why this is happening? I have never had this trouble before.
The main power input (5v) powers both the prop and the 2 motors, I have capacitors on the 5v input and 3.3v side.... this is definitely something with the prop on the receiver side.
Please help!
Thanks

Comments

  • MagIO2MagIO2 Posts: 2,243
    edited 2013-02-03 13:08
    Sounds to me like there is either some kind of shortcut in case both motors are active, or both motors simply need too much current which makes supply voltage to drop below the voltage needed to run the Propeller properly.
  • Mike GreenMike Green Posts: 23,101
    edited 2013-02-03 13:09
    It's some kind of power glitch or noise pulse that's causing the Propeller to reset. This is not unusual with rapid switching of motors on and off. The ULN2803 has built-in snubber diodes, so the absence of these diodes across the motor windings is probably not the issue. You may have a ground loop (see the Wikipedia article on this) or the switching noise may be coupling back through the power supply somehow. It's really impossible to tell without a lot more information. Remember that motors trying to change their speed or direction rapidly take a lot more current than with small changes in their motion.
  • JBWolfJBWolf Posts: 405
    edited 2013-02-03 13:12
    I can seem to get this to happen most times on the 4th movement change.. i.e. - up, down, up, down, *2-sec reset*. movement changes are done in about 1/2sec intervals
    this does not reset the whole propeller... just all pins set to output (no pins are set to input).

    input power is 5v @ 1A
    I will try a high amperage supply and let you know
  • MagIO2MagIO2 Posts: 2,243
    edited 2013-02-03 13:32
    Saying: "just all pins set to output" is a nice piece of information you should have given before!
    This sounds more like a bug in your software, because a propeller switches all pins to input during a reset!

    AND I think it's a bad idea to give it more power if your code is buggy.
  • JBWolfJBWolf Posts: 405
    edited 2013-02-03 13:33
    I didnt mean all 40 pins... just that I'm only about 13 pins to power devices (led's, relay, ULN) as opposed to buttons or other input devices.

    ok I added an LM2940 with heatsink and changed the power supply to 6v @ 2.5A.
    This did fix the problem... silly me.
    Motors are rated at 500ma... I programmed it so only one at a time could be running, but apparently they were a little hungrier than I thought.

    I can switch between buttons all I want and no reset :)
    Thanks!
  • JBWolfJBWolf Posts: 405
    edited 2013-02-03 13:38
    Small off-topic question:
    Along with the PE kit came two 3mm LED's I dont know what they are.... they are completely black and I cannot see through them even if held to bright light. are these IR LED's?
  • Mike GreenMike Green Posts: 23,101
    edited 2013-02-03 15:05
    One may be an IR LED and the other an IR phototransistor. Check the documentation.
  • JBWolfJBWolf Posts: 405
    edited 2013-02-03 15:29
    Thats the thing, it does not show in the book as part of the PE kit.
    Looking through the shop I cannot find this part in the accessories or components category.
    I looked through all results of searches for "IR LED" and "IR transmitter"... nothing like it.
    The phototransistor and IR transmitter in the shop have clear casing.
    Maybe a discontinued part? Wish I could figure out what they are.
  • RaymanRayman Posts: 14,665
    edited 2013-02-04 09:05
    I too think you have a power problem. I've seen this before and some advice I got was to use a seperate power supply for the motors.
    That's really the only sure fire solution...
  • lardomlardom Posts: 1,659
    edited 2013-02-07 06:59
    I'm also working on a project with two unipolar steppers and a ULN2803. I've tested them at 6V, 9V and 12V. I can control the motors differentially in either direction. The difference might be that I use separate cogs.
  • BigFootBigFoot Posts: 259
    edited 2013-02-07 07:34
    It might not have anything to do with your board. The rapid switching of the motors could be causing the PC to send
    out false RTS pulses reseting your Prop chip through the USB cable. Does this still happen when the programming
    cable is disconnected ?
  • Mark_TMark_T Posts: 1,981
    edited 2013-02-07 15:17
    The main power input (5v) powers both the prop and the 2 motors,

    Well that's always going to be problematic - when the motors take large current spikes the supply drops and the chip resets or
    malfunctions. Unless the 5V supply can happily handle the combined phase currents of both motors and you have good decoupling
    near the ULN2803 I wouldn't expect this setup to work reliably. An added issue with the 2803 is the darlington stages take time
    to turn off which may mean the supply is driving three phases simultaneously for a while after you switch phases (rather than
    one or two).

    A stop gap solution is to add more 3V3 decoupling to protect that rail when the 5V rail drops, but in general sharing a supply
    between motor and digital electronics is best avoided (or over-engineered). Putting a scope on the supplies would be very
    useful to confirm/deny this hypothesis.
Sign In or Register to comment.