How to put load or termination of stepper driver leads (if motor not connected)

Discussion in 'The Projects Forum' started by Carbon Amped, Dec 30, 2009.

  1. Carbon Amped

    Thread Starter New Member

    Dec 30, 2009
    10
    0
    Hi,

    I am trying to hack a remote/wireless PTZ camera. I plan to use the stepper driver signals on the receiver as logic inputs to a microcontroller. But I want to disconnect the panning motor. ( I am guessing it is a stepper )

    My set-up. The motor is 12V, 5-wire. The pulses out of the driver are not clean square waves (scope set-up issue?), but that’s ok. I wired the 4 coil leads to the inputs to a LM339 quad comparator. I have success getting clean 5V squarewave on comparator outputs, but only when I leave the motor connected. When I disconnect the motor, I get somewhat unstable signals (1 chnl clean but long pulse, other chnl jitters).

    Is there someway I should terminate these driver wires or use a dummy-load in place of the ‘disconnected’ motor?

    Other info. All input pins of LM339 are used. I only can probe 2 outputs at a time (2 ch oscilloscope). The 5th stepper wire is constant 12V, but going nowhere. On the LM339, I have 100-ohm resistors in series to the V- input pins, and I use 2.2K pull-up resistors from the four output pins to 5V+ Vcc. The camera receiver and the comparator/breadboard have separate power supplies, their grounds are connected. When I did get ‘clean’ 5V pulses out, they were 7.5ms High and 12.5ms Low and of course have a phase relationship.
     
  2. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Sounds like the stepper motor may be a unipolar type. Those use one or two wires to source current to the center of two windings, and the controller sinks current from the ends of the windings at appropriate times.

    Try connecting the driver outputs to 12v using 1.2k 1/4W resistors, one per output. Connect your comparator + inputs directly to the driver outputs. Connect all of the comparator - inputs to either 5v, or a voltage divider made from two equal resistors (1k-20k in size) across the 12v supply and ground.
     
  3. Carbon Amped

    Thread Starter New Member

    Dec 30, 2009
    10
    0
    Thx, Sgt.
    On the 1st point, I'll take a look at that (it's late, and not sinking in yet). Yes possibly unipolar. The '5th wire' is two strands in one connector. That is a steady +12V, so I will try connecting to that with the 1.2Kohm R. Let me know if that's not right.

    On the 2nd point, I played with a 10K Pot on one of the inputs... just to see where a good threshold might be. Seems it was not too critical. Simply using +5v as a reference level seems okay. I can reduce it easily as you suggested. BTW, I chose to connect driver output to comparator V- instead (to get a non-inverting output).

    It seems the LM339 is quite robust... accepts a wide range of my 'trial and error'. The LED did not fair so well. RIP yellow LED (2009 - 2009).
     
  4. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    You will need four separate 1.2k Ohm resistors, one per driver output. Connect one end of each resistor to a driver output. Connect all four of the other ends together to +12v.

    No, the threshold isn't critical. However, keep it at least 2v below the LM339's +supply, as the LM339 won't recognize inputs that are too high in voltage.

    If your LM339 is powered by +5v, then you'll need to connect the 1.2k resistors to +5v instead of +12v, and you'll need to use that 10k pot set to output somewhere around 1v to 3v on it's wiper terminal.

    They'll take a small amount of abuse. LED's won't take much.

    Note that the LM339 outputs won't sink more than about 6mA current. Choose your pull-up resistors as Vsupply/4.5mA, and use the result or next higher resistor value.
     
    Last edited: Dec 31, 2009
  5. Carbon Amped

    Thread Starter New Member

    Dec 30, 2009
    10
    0
    Thanks for clarifying. I will get to this either this year or next year. :rolleyes: Toward the weekend.
    Happy New Year!

    Is that true? As I had it set up so far, the comparator will see +12V levels at one of the paired inputs already. And the other input of the pair, sees whatever reference volts, eg. 5V. And so a comparator output goes high when stepper driver hands it anything over the 5V on that input pair. I think the LM339 can take up to 30 volts or so on the inputs. I thought the LM339 could have Vcc and Vin at entirely different levels. (that's why I tried it... gives me conversion to TTL levels out and cleans-up the wave shape in the process.)

    Anyway, I think I would stick with your original suggestion... connecting the 4 driver leads to comparator inputs: for each, use a 1.2K ohm connected to the 12V wire from the driver circuit. (and I interpret that I will also connect each of those 4 leads through a 100 ohm R to LM339 inputs). Unless I'm missing something here.

    In any case, I'll change the pull-up resistors on the outputs from 2.2k I have now... to ~1K. ("Vsupply/4.5mA")

    Ref: LM339 datasheet. http://www.fairchildsemi.com/ds/LM%2FLM339.pdf
     
    Last edited: Dec 31, 2009
  6. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    I wouldn't have suggested what I did unless I thought it were necessary and appropriate.

    If you operate the 339 with inputs outside of the range of its' supply rails, you will have problems.
     
  7. Carbon Amped

    Thread Starter New Member

    Dec 30, 2009
    10
    0
    Okay. Good to know regarding max Input volts relative to Vcc. So that got me searching, trying to understand things. So I found some things about "staying within the supply rails" and "beyond-the-rail comparators".

    Then I found this:
    http://www.electronicfied.com/sci.electronics.design/LM339_comparator_input_levels_4315.html
    Now there is some back-and-forth debate on that issue, but if that (quoted statement) is true it would simplify things for me.

    What do you think on the above?

    Either way, I can adapt my design (I can easily get 5V, 7.4V, or 12V for the 339's Vcc). I want 5V outputs and if I have to drop output through a voltage divider, so be it. Or as you suggested I could bring the driver circuit voltage level down before comparing. But it would be great to keep 5V Vcc and accept ~12V pulses on inputs (and just make sure my 'reference input' is lowered).

    Thx. Later.
     
  8. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    If the comparator is not specifically rated for "over the top" operation, I would not recommend allowing the inputs to exceed the range of the supply rails. Linear Technology makes some comparators that are specified for operation with the inputs exceeding the +V rail. The LM339 does not fall into this category.

    If you wish to use the 1.2k pull-up resistors to 12v for the drivers, and use 12v for the 339's Vcc, and use 1k or higher pull-up resistors to 5v on the outputs of the 339, that would work just fine. You would be within the design limits of the 339, and get your desired 0v-5v output.

    That is the way I would do it.

    If you must use 5v for the 339's Vcc, then you must keep it's inputs limited to the 339's rails. This means the driver's pull-ups must go to the 5v rail instead of 12v. Either that, or you must clamp the inputs to the 5v level using diodes.

    As far as the debate, have a look at the National Semiconductor datasheet for the LM139/239/339/2904. "Differential input voltage range equal to the power supply voltage", "Input common-mode voltage range includes GND"
    If you dig further, you'll find that the range is limited to between 0v to +V-1.5v.

    This is why I suggested 1v to 3v reference for a Vcc of 5v. I knew it was within the specifications. 3v=5v-2, which is a 0.5v margin.

    If you continue searching for arguments supporting operation of this comparator with inputs outside of the recommended ranges, you will undoubtedly find them. However, that will not make their assertions correct.

    The ultimate authority on such matters would be the manufacturer's own datasheet, coupled with a correct interpretation of that datasheet. If there is an ambiguity in the datasheet, it must be clarified by the manufacturer.

    I do not see such an ambiguity in National Semiconductor's datasheet for this device.

    If you follow my recommendations, it should work. If you follow the recommendations of someone else, ask them why it doesn't work.

    I am not on here to argue with the Internet, only to help a few n00b's along their electronics learning path.
     
    Last edited: Jan 1, 2010
  9. Carbon Amped

    Thread Starter New Member

    Dec 30, 2009
    10
    0
    Thx.
    I've waded through it. Some makes sense, some data is bumping up against 'my brain diode'. :)

    I did see notes 6 and 8... which seem to point to some flexibility. http://www.national.com/ds/LM/LM339.pdf
    By "other voltage... remains..." it seems they mean 'voltage on other Input for that channel'. If so, this could be useful alternative if I get stuck somehow.

    I also found this tidbit in Natl Semi knowledgebase. http://www.national.com/kbase/category/Amplifiers.html#6
    So now I understand a little better what you were saying here:
    I like that as a way of simplifying. Thanks for outlining that solution. As a consequence though, I think that will push me to making a separate daughter board for the 339 to mate it to the camera board. I'll have to verify the stability of the +12V available there.

    Off to work on schematics now. Cheers.
     
  10. Carbon Amped

    Thread Starter New Member

    Dec 30, 2009
    10
    0
    Have a schematic now, which seems will be very easy and workable solution.

    That said, I may be able to play around with the pull-up config and eliminate the LM339 entirely. (reason I chose it in the first place was to get 12V jittery pulses down to 5V clean square pulses -- and it may have just been my breadboard and scope setup). But now that its there, maybe the 339 stays. Its all learning.

    It'll be a couple days before I get to it again. Thanks again.
     
    Last edited: Jan 5, 2010
  11. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    You could indeed try just pulling the outputs of the stepper driver to the 5v using the same 1.2k resistors and see what you get.
     
  12. Carbon Amped

    Thread Starter New Member

    Dec 30, 2009
    10
    0
    Okay. With the LM339 out of the picture temporarily, I connected each of the 4 driver wires to 1.2k pull-up resistors, and then joined the 4 resistors to positive supply voltage (tried +12V, and also tested +6V). Again, this is with the stepper motor itself not connected.

    Results on oscilloscope: Nice clean square pulses. They drop from pull-up voltage down to about 0.2V above ground. However, timing for all four driver pulses is same. That is, I lose the phase relationship. [Edit: maybe not a circuit problem -- see follow-on post]

    Thought I'd post results now as I think bringing the comparator back in would not help anything.

    Any other ideas? (to terminate or load the driver channels so I can keep the motor disconnected).

    Thanks.
     
    Last edited: Jan 13, 2010
  13. Carbon Amped

    Thread Starter New Member

    Dec 30, 2009
    10
    0
    I went back at it after a break.

    I changed the oscilloscope 'A' Trigger settings to 'Chnl 1' (was on 'Normal' previously). And was able to see some offset now. And the relationship for pairs of driver signals does change for Left and Right joystick.

    However, I don't know if I am inducing that offset by scope trigger setting, or am legitimately detecting phase.

    (in this testing, 'Chop' setting did not help to show phase relationship (trig. on 'Norm') --- but if I recall, before with comparator outputs the 'Chop' setting helped to display a stable pair of traces.)

    Anyway, if you see something obvious here I appreciate the pointers. OTW, I'll just keep testing.
     
  14. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    I don't know either.

    Why don't you try triggering from one of the outputs, and then look at the other three outputs with the other channel?

    Decrease your time/div setting to help show if there is a difference.
     
  15. Carbon Amped

    Thread Starter New Member

    Dec 30, 2009
    10
    0
    Had another try at the O'scope, so some results. This time I got to see the phasing after trying a few things. The short-story is operator sloppiness or unfamiliar with scope... earlier.
    I put the 'A'-Trig to Wire #1 of the 4 driver leads. Then probed each of the other 3 driver wires on chnl 1, one at a time. I'm guessing all timing reference on display is with t0 at far left. So then I've noted pulse timings and phasing relative to that (moving joystick L & R of course). If you need the details, let me know... I take pictures or write it out.

    After that exercise, I went back and repeated the basic approach... probing the 4 driver wires in pairs using Chnl 1 & 2. So this time I was a little more patient with the scope... tweaked some settings, and did get the phase relationship to display. (the setup here is just the 1.2K pullups, no LM339. Scope: 2V/div and trace 2msec/div).

    With +12V applied to the pullups (what you intended/advised), I get a nice, stable delta between HIGH and LOW. Thanks once again.

    I tried using +5V with those pullups and found some problems with that of course. What I'm thinking is skip the comparator. And/or maybe use some 5.1V zener diodes to enforce TTL levels going to μC Inputs. Will have to reread earlier suggestions.
     
Loading...