Stepper motor problem
Kurt Finnie
Posts: 21
I'm having trouble with stepper motor code that previously worked.
I'm using a Proto board, UNL2003A Darlington array, Mitsubi 12v 100 ohm 5-lead unipolar stepper motor (purchased from Parallax) and 12v 1A linear regulated power supply (wall wort).
The schematic shows the basic full-stepping code.
I have proven:
Connectivity at all junctions where I should have it.
+12v and the red stepper motor wire are attached to Common pin 10 on the Darlington array.
The Darlington ground pin is attached to VSS on the proto board.
The P0-P3 pins toggle high, then low, when measured between I/O pin and VSS.
The stepper motor wires are black, orange, brown, and yellow and are attached (in order) to P0.. P3.
The voltage between the amplified side pins and VSS is 0.6v. I believe that proves the pins sinked... allowing flow.
I replaced the proto board with a development board, swapped Darlington arrays, stepper motors, power supplies and used different I/O pins... without success.
What am I missing here?
What should I try?
How do I know the Darlington arrays are/aren't fried... and how would that happen. I understand the Darlington has built-in resistors to protect from over-current.
An observation: If I remove the red stepper motor common wire and measure voltage between +12v and VSS, I get 16.2v. How is that happening.
Full-stepping is just fine for my application and I have plenty of pins to do everything else I need.
I'm using a Proto board, UNL2003A Darlington array, Mitsubi 12v 100 ohm 5-lead unipolar stepper motor (purchased from Parallax) and 12v 1A linear regulated power supply (wall wort).
The schematic shows the basic full-stepping code.
'test4 'This test uses a program that worked previously with the same unipolar Mitsumi 5-lead 'stepper motor (purchased from Parallax), 12 volt 1A linear regulated power supply, 'ULN2003 darlington array and propeller proto board. ' PPB Darlington Motor ' P3 -> ULN2003.1, ULN2003.14 -> Phase 4 (yellow) ' P2 -> ULN2003.2, ULN2003.13 -> Phase 3 (brown) ' P1 -> ULN2003.3, ULN2003.12 -> Phase 2 (orange) ' P0 -> ULN2003.4, ULN2003.11 -> Phase 1 (black) ' VSS -> ULN2003.9, ULN2003.10 -> (red) and +12v CON _CLKMODE = XTAL1 + PLL16X _XINFREQ = 5_000_000 VAR long stpIdx 'loop counter, step pointer PUB Main dira[0..3]~~ 'make pins outputs outa[0..3]~ 'make pins low repeat 'Turns stepper at a fast rate indefinitely stepFwd waitcnt(clkfreq/10 + cnt) ' pause(1000) ' repeat 12 'Turns stepper in reverse direction at a slower rate ' stepRev ' waitcnt(clkfreq/5 + cnt) PRI stepFwd stpIdx := ++stpIdx // 4 ' point to next step outa[0..3] := Steps[stpIdx] ' update outputs PRI stepRev stpIdx := (stpIdx + 3) // 4 ' point to previous step outa[0..3] := Steps[stpIdx] ' update outputs PRI pause(ms) | c c := cnt ' sync with system counter repeat until (ms-- == 0) ' repeat while time left waitcnt(c += clkfreq / 1000) ' wait 1 ms DAT Steps byte %0011, %0110, %1100, %1001 'Full step
I have proven:
Connectivity at all junctions where I should have it.
+12v and the red stepper motor wire are attached to Common pin 10 on the Darlington array.
The Darlington ground pin is attached to VSS on the proto board.
The P0-P3 pins toggle high, then low, when measured between I/O pin and VSS.
The stepper motor wires are black, orange, brown, and yellow and are attached (in order) to P0.. P3.
The voltage between the amplified side pins and VSS is 0.6v. I believe that proves the pins sinked... allowing flow.
I replaced the proto board with a development board, swapped Darlington arrays, stepper motors, power supplies and used different I/O pins... without success.
What am I missing here?
What should I try?
How do I know the Darlington arrays are/aren't fried... and how would that happen. I understand the Darlington has built-in resistors to protect from over-current.
An observation: If I remove the red stepper motor common wire and measure voltage between +12v and VSS, I get 16.2v. How is that happening.
Full-stepping is just fine for my application and I have plenty of pins to do everything else I need.
Comments
The 16V means the supply is not a linear regulated 12V supply, probably just raw smoothed or poorly regulated SMPS?
Have you checked the motor pinout and the voltage of the supply under load?
Additionally, is any of the coils energized while running your code?
My Darlingtons have 18 pins (bought from Parallax), so ground is 9 and common is 10.
The voltage measurement from the power supply output wires is steady at 12.0 volts.
Idbruce,
So I connect the Darlington ground (pin 9) to -12v as well as to VSS?
How do I properly determine if any of the coils are energized? I'd guess not, because I can rotate the shaft and there is no change in torque.
It never seemed right that -12v was never identified as part of the circuit.
Yes.
If it does not spin freely.
I'll connect the ground and fire up the code again.
BTW, where in IN do you live?. Although I live in Knoxville, TN, I cruise through and around your state a dozen times a year.
The stepper is in motion... but it toggles one step forward and one step back x number of repeats. It's like the index isn't indexing.
But at least it is in motion now!
I do not know which manufacturer made your ULN2003, but according to ST Microelectronics, you have that chip wired incorrectly.
' P3 -> ULN2003.1, ULN2003.18 -> Phase 4 (yellow)
' P2 -> ULN2003.2, ULN2003.17 -> Phase 3 (brown)
' P1 -> ULN2003.3, ULN2003.16 -> Phase 2 (orange)
' P0 -> ULN2003.4, ULN2003.15 -> Phase 1 (black)
' VSS -> ULN2003.9, ULN2003.10 -> (red) and +12v
instead of
' P3 -> ULN2003.1, ULN2003.14 -> Phase 4 (yellow)
' P2 -> ULN2003.2, ULN2003.13 -> Phase 3 (brown)
' P1 -> ULN2003.3, ULN2003.12 -> Phase 2 (orange)
' P0 -> ULN2003.4, ULN2003.11 -> Phase 1 (black)
' VSS -> ULN2003.9, ULN2003.10 -> (red) and +12v
It's wired right but my documentation is wrong. Under magnification and a lot of light, I determined the chip is a UNL2803A.
The leads are wired to the lower pins of the Darlington, starting with VSS, P0, P1, P2 and P3.
' P3 -> ULN2003.5, ULN2003.14 -> Phase 4 (yellow)
' P2 -> ULN2003.6, ULN2003.13 -> Phase 3 (brown)
' P1 -> ULN2003.7, ULN2003.12 -> Phase 2 (orange)
' P0 -> ULN2003.8, ULN2003.11 -> Phase 1 (black)
' VSS and -12v -> ULN2003.9, ULN2003.10 -> (red) and +12v
I tried changing the order in the Dat section but that didn't do anything.
I don't see anything wrong with the code for StepFwd, StepRev or StpIdx.
I suspect this is where having an oscilloscope would be useful, or four led's, to prove
which circuits are powered up at any given time.
I'll slow the cycle rate to 5 seconds or so, so that I can check the voltage on each pin before the next cycle. This should prove whether the Darlington array is damaged.
In the meantime, I'll order more Darlington array chips.
This code has not been tested, but I think it should work, providing the Prop and IC chip are okay.
In the code I provided, the incrementor and decrementor really should be moved to the end of the repeat loops in the functions.
The code in your post and my initial code have all turned illegible.
Is there some way to make it legible again?
I am assuming you mean uneditable. If so, I had that same problem also, but I do not know how to fix it. I have attached a copy of the code with the incrementor and decrementor placed appropriately.
I solved the problem. The darlingtons are fried!
To prove that, I extended the cycle time to one step in 20 seconds and used an external timer to let me know when the next step occurred. That gave me enough time to get voltage measurements on all four pins and to document it before the next step. The code works just fine. Measuring from the amplified side of the darlington to VSS, I found that the P0 remained high throughout. I substituted the other darlington that I had been using, and found that P2 remained low throughout. I wasn't so disciplined a week or so ago and can understand that I zapped them somehow.
I've ordered new chips and a few new proto boards and hope to move on shortly.
I want to thank you for identifying the ground problem. I'm at a loss to understand how I got this stepper, two others and two other linear steppers moving at various speeds and directions without previously having this ground.
Similarly, I don't understand how the code listing turned to jibberish, but it's now legible again and I see from your code that you are accomplishing the same thing but using a different approach. Thanks for all.
I've got one other question on my mind but it's off-topic so I'll start another thread.
Kurt