Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Stepper motor usually starts at power-up moving one step backwards.

Status
Not open for further replies.

d123

Advanced Member level 5
Advanced Member level 5
Joined
Jun 7, 2015
Messages
2,505
Helped
494
Reputation
992
Reaction score
525
Trophy points
1,393
Location
Spain
Activity points
27,148
Hi,

Any ideas why a bipolar stepper motor at power-up often takes one step CCW? It shouldn't - it should be four CW and four CCW.

It's on a breadboard. The supply and power is the same and it's nominally 5V. Every IC is decoupled. It's a slow signal from a 555 (~1 Hz) into a CD4017 which has a POR and whose output pins are used to drive an L293D to generate the four forwards/CW and then four backwards/CCW signals.

I even tried using another 4017 to skip the first cycle of steps after power-up and enable the L293 at the start of the second cycle, but it still does the CCW step very often.

When the circuit was only four steps CW, it still did it.

I would find it easier to understand the problem if it sometimes did an extra step CW at power-up, not the CCW step at power-up. I have as yet to use my black and white LCD oscilloscope with its jerky small screen to see what's happening at start-up on different pins, admittedly.

Once it gets past the power-up glitch it does what it should (four forwards, four backwards, repeat forever). It happens randomly. I'm only asking as I assume it shouldn't start-up like that and stepper motors don't do that normally.

I've just thought, whilst writing this question - Do I need to put pull-down resistors on the L293 input pins, is that a probable cause? The enable pins do have 100k pull-downs. I'd been thinking it was something to do with the breadboard or something else but that makes more sense.
 

We need to see a schematic but quite likely the problem is just the motor being powered up from a random position and being pulled by the coils as they go from 'dead' to powered up.

Brian.
 
We need to see a schematic but quite likely the problem is just the motor being powered up from a random position and being pulled by the coils as they go from 'dead' to powered up.

Brian.
Hi Brian,

Could you elaborate on that, please? I thought that (in a simple circuit) the motor would start stepping from where it was last positioned.

I tried adding pull-down resistors on the L293D input pins and it made no difference. However, after leaving it unpowered all night, this morning it didn't start with the one step backwards glitch for the first three or four power-ups.

(Cough, cough, ...antiquated children's circuit that not even children make because they can write MCU code...) Some additional information is that with or without U4 and the first cycle delay it does the same thing. The 555 is an LMC555, not a TLC555. On the breadboard, there are temporary visual indicator LEDs with 4k99 resistors on the outputs of: the 555, U2 Q0, Q1, Q2, Q3, and U4 Q0, Q1 - they make troubleshooting quicker but are not on the schematic to avoid a cluttered picture.
Frankly, I'm not sure I've even got the stepper motor coil connections the right way round as the datasheet says nothing, I only know that coil 1 and coil 2 each measure around 43 Ohms. The datasheet is attached, and the motor is the 15M020D-1B (18º) one. The circuit does what I want it to - four forwards and four backwards - but I'm really not sure that that means the motor is wired correctly and looking at my simplistic implementation after everything I've read about driving these motors I wonder that it does anything useful at all.

The circuit only needs to power up once and then would remain powered for hours or maybe days, but it annoys me that it does that glitch because then it doesn't start in the right position.

stepper motor circuit.JPG
 

Attachments

  • Bipolar Stepper 18 degrees 5V 125mA pmmotorscommercialseries.pdf
    122.2 KB · Views: 185

Hi,

Maybe you misunderstand a stepper operation principle.
It is no "single step forward" or "single step backward",
but it is a sequence of 4 fixed positions to make the motor move fwd/bwd
Running positions 1-2-3-4-1-2-3-4 will move the motor forward
Running 4-3-2-1-4-3-2-1-... will move the motor backward

a standard stepper motor has 4 fixed "positions" when powered (full step)
1: A+
2: B+
3: A-
4: B-
then it continues:
1: A+
2: B+
3: A-
4: B-
1: A+
2: B+
3: A-
4: B-
.. and so on

the 4 step sequence is repeated many times per revolution. eg 50 x 4 steps = 200 steps per revolution.

Now it depends on the position_before_powering up and the how the coils are powerd at the beginning.

example:
Maybe the motor before power up is in position "4" and you power up with "A+" = position "1"
Then the motor will move one step back.

If you want to avoid this
* you need to save (non volatile) the last position of the motor (before power down)
* you need to ensure that the motor does not move during power down
* you need to power up the stepper driver with the last saved position.

Klaus
 
  • Like
Reactions: d123

    d123

    Points: 2
    Helpful Answer Positive Rating
Hi Klaus,

I don't really understand your explanation of running positions and the detail you provide, but that's me and a mental block or something or being incredibly thick with what I'm supposed to do to drive these motors, not because of your kind description. I re-read a bit about full-step drive after reading your reply, did something unrelated, then had another go.

'Maybe you misunderstand a stepper operation principle.' - I think so. No matter how many times I have read this stuff and looked at desired waveforms in tutorials and app notes it doesn't go into my head, I think: I'm left with assorted descriptions of a sequence of inputs to apply to the coil drivers and timing diagrams of overlapping waveforms and still confused. I assume that only driving one coil at a time is the 'lower torque' thing, so the motor steps but can only carry a smaller burden/load than if I followed e.g. (table in second picture) 1a + 2a = forwards, because my sloppy circuit is driving 1a then 2a then 1b then 2b = forwards, forwards, forwards, forwards, also because the breadboard circuit is using about 65mA per coil, not 125mA as the motor should according to the datasheet. The below pictures are from an app note and an online tutorial to explain stepper motor driving mind fog syndrome:

stepper fullstep signals.JPG


bipolar drive sequence.JPG


As it's only a silly circuit, my attitude is, who cares so long as it works as I don't want to get obsessed with this one, I unfortunately don't have the time nor the inclination right now, I just want to make it work. Unrelated, an interesting measurement (for people like me): the two breadboard 'ground' rails where all the ICs are measure 115mV relative to the other ground rails and the power supply's input ground point. ...'Ground', '0V', etc...

And, lastly, thanks for:

Maybe the motor before power up is in position "4" and you power up with "A+" = position "1"
Then the motor will move one step back.


That was the problem, it would appear. I was deliberately turning it off at random steps in the 0, 1, 2, 3, 4, 3, 2, 1, 0 sequence to see if although turned off at e.g. #3 forwards or at #2 backwards, when turned back on again it always started doing 4 steps forward first (and then the four backwards). But if I've understood you correctly, it won't, so the glitch is to be expected. Since then, ensuring I turn it off when it is back at position 0 (for the exhaustive test of turning it off and on again ten times just now) means it always starts in the right direction - CW, so thank you very much. Problem solved, great.
 

Thats the nice aspect of processors is you can effect power sequencing.
Most come up with outputs preconfigured as HiZ inputs, so pull-ups or
pull-dwns insure the startup state of control outputs. Note thats only
partially true because most also have a undefined region where output
state is undefined, but fortunately that is at fairly low enough voltages
that their Vout state is well below threshold of downstream load device
thresholds.

CD4017 does not give you that luxury w/o adding power sequencing
to design.


Regards, Dana.
 
  • Like
Reactions: d123

    d123

    Points: 2
    Helpful Answer Positive Rating
Actually the stepper motor moves in steps that you can think as a sine wave (peaks at 2 and valleys at 0; no negative values just to fix ideas). The valleys are the stable points and are well defined in terms of the coil and rotor placements. To move from one valley to the next, you need to climb a hill and this is done in four steps: coil A on (climbs the hill half way), then coil B on (both coils on is needed to reach the top of the peak), then coil A off (the half way point on the other side) and the coil B off (you have now reached the next valley).

To move backwards, just interchange A and B.

The stable positions are defined in terms of the magnetics and you can feel them (if you turn a stepper by hand) only because of residual magnetism (or mechanical design). If you power off the motor in some undetermined state, it may move 1/2 step or 1/4 step forward or backward when you power it on next time (and reach a stable start point). It may do so when you power it off (the rotor becomes free) and if you do not want to lose a step you must apply brake and never fully power off the motor.

Best way to prevent loss of steps is to always stop the motor at the end of a full cycle (when the rotor is in a stable valley) or save the status of the last pulse sequence (that is potentially unreliable).
 
  • Like
Reactions: d123

    d123

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top