Stepper motor headache

Go To Last Post
10 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I thought I had my brightest idea ever in this field...
I made a fairly simple windows program to calculate the ideal PWM pulses for driving the transistors directly, whitout the need of any current limiting/reference resistors.
The whole shebang (calculated sine values for all 8 fractional steps) is dumped to SRAM through a serial link, so I don't have to reprogram the chip when I make adjustments.
Utilizing four of the six PWM's in the mega48 chip, I naiveley beleived that the ideal pulse output shape would be a perfect SINE / COSINE wave, so I made a program that calculated all the steps in a 1/8 microstepping wave.
What I found, was the program, and the pulse width came out as perfect as I had planned, but feeding this directly to the gates on my power HEXMOS transistors didn't work as expected.

The general results I have come up whit, is that the pulsewidth is by far a linear function to current going through the motor windings.
Going from 10% to 50% duty cycle(??) is bareley noticeable, while going from maybe 65% to 70% is really major.
This is also different for different motors.

If I could find the power/duty curve, I think I should be able to tailor the PWM pattern to each motor, but it's a bit tedious...

Should I discard the whole idea of using this direct approach (wich would waste very little energy as heat, and have many other obvious benefits) and start working on some sort of feedback system, or are there some common "rules" for the pwm/current ratio I could implement into my design?

Right now, I'm working on a math function that takes the square root of the sine/cosine output to try to get closer to the actual values I need, but I doubt it would work as I want it to...

The turn on/turn off times of the transistors, and the current-buildup time in the coils in the motors also come into play, and until now, I hadn't really given it that much thought...

Btw.. I'm running the Mega48 at 20MHz, and running the timers in 8bit PWM.
Earlier attempts whit a Mega8@8MHz resulted in audible whining from the motors... And it was this nasty very high TV frequency whine that would make you go nuts in a few minutes...

Please.. just share your thoughts on my efforts on making strong, yet simple stepper driver whit as little external components as possible...
Right now, it's the uC, 4 transistors and the Xtal oscilator (and filter caps scattered here and there). The rest is pure software, wich doesn't cost anything to mass produce :P

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, to generalize, making a good stepper driver circuit is much more than controlling voltage. I'd suggest You take a look at some of the driver ICs that are out there, just to get an understanding of the problem area. And do read the NJR app notes on steppers. They are not easyli navigated to, but You ought to get a hold on them by:

Going to http://www.njr.co.jp/index_e.htm, then
in the Product Information menu select Semiconductor Products Information, and then
click Stepper Motor (in the midle of the page) and then
click eg. NJM3770A

Now the App Notes are on the right. Mandatory readings are
- Stepper Motor Basics
- Drive Circuit Basics
The latter will try to explain what goes on in the windings of a stepper, what "forces" are involved etc.

Her's some scattered thoughts:

Would You believe that putting a R in series with the motor winding can actually make the motor stronger? Study the principle of LR driving!

Are You interested in getting a strong motor drive with as few components as possible, but can take other "costs", or is motor strength versus power consumption something that factors in? If so, do study the principle of "chopper driving"!

Many NJM driver ICs are for bi-polar motors, but don't discard the appnotes if You are using uni-polars. The basic principles holds for both motor types!

In essence the voltage over a winding is of little interest. The thing to control and/or maximize is current. It is current that generates the magnetic field in the motor, not voltage.

If Your BOM is complete above I do miss the freewheeling diodes. If You select not to implement those I suggest You keep a large stock of transistors and maybe uC's also as the back EMF from the windings will smash the transistors to pieces when they are switching.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi
Johan is right.
It seems you didn´t calculate that your motor circuit (and the relation of voltage to current) changes while the motor is turning.
It changes with speed and with torque and....
It´s not a "static" L-R-combination where L and R is constant!

Klaus
********************************
Look at: www.megausb.de (German)
********************************

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Seems like there's no "quick and dirty" way to make a decent stepper driver, unless some sofisticated software is sitting in the MCU...
Basically, I have just unipolar motors...
The reason for not wanting too many external components, is that I don't have them...
I basically have what I've scavenged over the years.
Mostly, this consists of big stuff, like switching transistors from powersupplies (buch of IRFP250's and other stuff)Large (and not so large) steppers from copiers and printers...
Basically, I see what I have, and what I can make from it...
The biggest steppers come up to about 1Kg when put on my kitchen scales, but I have no clue to the torque...
If I could just limit the part-count to stuff I have, it would be really nice, as getting brand new stuff usually is quite expensive... No such thing as digikey or radioshack in this country...
I have bought a set of standard 1/4W resistors in the E12 series, but beyond that, it's scavenged stuff...
There's no such ting as a free lunch, but enough scraps could make a satisfying meal...

I'll go right into the app-notes....

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

No such thing as digikey or radioshack in this country

No but I assume DigiKey ships to Norway as they ship to Sweden. And Mouser. And Jameco.

And there are more nearby suppliers (eg. Elfa in Sweden) but I suspect that what You win on lower shipping You will loose on prices.

There are quite nice driver ICs both for bipolar and unipolar motors. At least up to 2 amps per winding or so. And many unipolars (all?) can be wired up as bipolars.

If You have a part number on Your motor You might get more info if You let Google search out the net for it.

And please believe me when I say You will need the freewheeling diodes (some driver ICs have them built in).

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ehm.. Freewheeling diodes..?
Those are not the zener diodes built into the switching transistor?

I think I'll set up a test, and map the current for each duty cycle value for a few of the motors I have, and see if I can find a pattern to it...
The current flow in the windings seems to increase as an inverse square function to time...Maybe there's a pattern to be found, and inplemented into the sine calculations...
0.5 amps may be 73% duty while 1.0 amp would be 85%
I don't know...
I have a several chopping type integrated drivers from sanyo, but they make alot of ugly whining noise, and only alow full-step control, wich gives very un-smooth operation, and low top speed...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This is what happends: When You "close" the transistor switch a current is applied to the motor winding. This builds up a magnetic field around the winding. When You open the transistor switch the magnetic field is still there, and now it generates a current in the winding. This will "hit" Your transistor and it will be beaten hard by it, and fail sooner or later.

Search out these forums for "freewheeling diode" and "back EMF" and the like and You will find several threads on the phenomenon, problem and the solution. Same problem occurs for any switched inductive load, eg. a relay, a solenoid... And I suspect that its not only semiconductor switches, eg. transistors, but also many mechanical switches that are unable to cope with this problem.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
The current flow in the windings seems to increase as an inverse square function to time

I suppose it does look a bit like that, but it's an exponential. The current rises with time according to this equation:

I=(V/R)(1-exp(-tR/L))

Where R is the DC resistance on Ohms, L is the inductance in Henrys, t in seconds. The value L/R is the time constant. Every T seconds, the current rises about 69% from where it was before towards the maximum. So in T1, the current reaches 69%; in T2, it reaches (69%+(69% of 31%)) or 90%; in T3 it reaches (90%+(69% of 10%)) or 97%; etc. The figure 69%, 0.69, is log_to_base_e(2). To make the time constant shorter, increase R with a series resistor.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

To make the time constant shorter, increase R with a series resistor.

Which is what I called LR driving above.

Please read the "Drive Circuit Basics" appnote! For me, it was one f a few really big "eye openers" (I'm originally/professionally a software guy, just fiddling about with electronics as a hobby).

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well...
I've been reading up on the app notes...
lots of interresting stuff!!

I also completed the measurements I planned to do on amp/duty-cycle
To get the measurements as accurate as possible, I used 2 transistors, where the drains were connected to A and /A respectiveley, so that the reverse EMF could discharge through /A and the second transistor.

When I came close to the max rating for the motor coil, the transistor got extremely hot... I think the switch-on time on these suckers are too slow...

Plotted the results for two of the motors in this graph I attached here...

Attachment(s):