Thing-O-Matic: MBI Stepper Motor Analysis

After pondering the stepper motor data collected there and the driver data there, plus running some experiments with different motors, I’ve concluded that the MBI stepper motors aren’t appropriate for the Thing-O-Matic. This post summarizes my doodles and provides some background and justification for what I’ve been doing…

During the next week or two I’ll continue writing up the results of installing better stepper motors in my TOM, plus some mods required to take advantage of the improved performance. I’ll do a wrapup of the new motors when everything’s settled down and I (think I) understand what’s going on.

The ideal situation

This diagram from page 15 of the Allegro A3977 datasheet shows how the current varies in each winding during the course of 32 microsteps. The motors have 200 full steps/rev and 1600 microsteps/rev, so this diagram repeats 50 times during the course of one complete shaft rotation.

Allegro A3977 microstepping current waveforms
Allegro A3977 microstepping current waveforms

The peak current of each waveform corresponds to the REF pot setting on the MBI driver board:

current in amperes = (REF pot voltage) / 2

That peak current must not exceed the motor’s rated Maximum Current, because the winding resistance dissipates that much power as heat. The maximum temperature occurs deep in the windings, far from the metal part of the armature, so blowing air on the motor helps, but does not cure, an overtemperature problem.

The driver adjusts the current in each winding to generate an approximation of a sinusoid waveform for each microstep. Because the motor torque varies directly with the winding current, the REF pot sets the maximum torque available from the motor.

The A3977 driver controls the current by switching the MOSFETs on and off: on = increasing current, off = decreasing current. You can fiddle with the rates of increase and decrease, but those are all in the nature of fine tuning. What’s important is that the A3977 shuts off the winding current when it exceeds the product of the REF pot setting and the sinusoidal value for the microstep, then turns it back on when it falls below a somewhat lower level.

Therefore, the current isn’t actually constant: the whine you hear when the motors are standing still is an audible harmonic or sub-harmonic of the switching frequency. That’s not a bug, it’s a feature!

At the microsteps corresponding to the peaks of each sinusoidal waveform, one winding carries the maximum current and the other winding carries zero current. There are 200 such positions, each corresponding to one full motor step. At those points, the armature holds the rotor in position with the much-quoted Holding Torque.

For all other microsteps, the A3977 controls the Pythagorean sum of the two currents to equal the maximum current setting. The two currents pull the rotor toward two adjacent full-step positions, with the actual (nominal) rotor position determined by a bit of trig.

The power dissipation in the motor at every microstep is therefore:

(peak current)2 x (winding resistance)

All that applies to the DC situation with the motor halted at a particular microstep. In order to turn the rotor, the drive must change the winding currents to the values for the next microstep.

The motor windings are basically inductors with energy stored in their magnetic field, so the current cannot change instantly. The ratio of the inductance (L) and the total circuit resistance (R) is the time constant, abbreviated with a Greek tau (τ):

τ = L/R

The current change from one microstep to the next requires 3 time constants to settle within 5% of the final value and 5 time constants to settle within 1%. Those are characteristics of the exponential function and have nothing to do with the particular circuit; once you know the time constant, you know what’s going to happen.

The voltage applied to the motor winding determines the final value of the current that you use with the time constant. Microstepping drivers expect to apply a voltage far higher than the winding’s rated voltage, then limit the current to the winding’s rated value: the current never reaches the “final value”, but that’s still what you use in the computation. If the supply voltage equals the winding’s rated voltage, then the final value is simply the winding’s rated current.

The MBI Situation

The MBI motors (all of them, XYZ and Stepstruder) in a Thing-O-Matic do not operate like that. I’ll use the XY motors as examples, but feel free to run the same analysis on the others.

To summarize the datasheet values:

  • Inductance L = 44 mH
  • Resistance = 35 Ω
  • Rated voltage = 14 V
  • Rated current = 400 mA

The motors operate from a +12 V supply, so the maximum winding current will be at most 12 / 35 = 340 mA. The actual power supply voltage seems to around 11.5 V with the heaters running, the A3977 MOSFETs (inside the chip) have a total on-state resistance of about 800 mΩ, and I’ll assume another ohm of wiring resistance along the way. All that reduces the actual maximum current to around 300 mA; I’ll use that, because it’s within 10% off the actual value.

The MBI-recommended REV voltage setting of 1.5 V sets a 750 mA output current. However, there’s no magic involved: the motors cannot draw more than 300 mA in a Thing-O-Matic, no matter what the REF trimpot may call for.

With the REF trimpot set to 750 mA and the maximum current limited to 300 mA by the circuit, the A3977 cannot produce the correct current for most of the microsteps. Whenever the microstep current exceeds 300 mA, the A3977 cannot make that happen.

This diagram shows the actual winding current in the MBI motors for each of the 32 microsteps in four full motor steps:

Allegro A3977 waveform - current saturation
Allegro A3977 waveform – current saturation

The 100% level corresponds to the 750 mA set by the REF trimpot and, as above, the nice sinusoids show the target current for each microstep. The red line shows the actual current for each microstep, none of which can exceed the 300 mA limit. That limit corresponds to 300/750 = 40% of the maximum, just slightly over the 38.3% for the second microstep in each sequence.

The pink zones mark the microsteps where both windings become current-limited to 300 mA. During those microsteps, the current in the windings doesn’t change and the motor cannot move. Of the 32 microsteps in each group of four full steps, the motor can move during only 16.

The horrible sounds you hear from an MBI motor happen as the rotor encounters those pink zones: the rotor literally jams to a stop when both windings limit at 300 mA, remains immobile while the currents remain steady, then jerks across the 4 microsteps in the pink zone when the current in one winding drops below 300 mA. This is obviously not conducive to smooth motion or high torque.

Try this: reduce REF to, say, 400 mV to limit the peak current to 200 mA. Run the motor slowly, because it won’t have much torque, and listen. Set REF back to 1.5 V, run it at the same speed, and listen.

The power dissipation for all the microsteps in the pink rectangles is:

2 x (300 mA)2 x 35 = 6.4 W

The factor of 2 comes from the fact that both windings carry 300 mA in that condition.

The motor’s rated maximum power is:

(400 mA)2 x 35 = 5.6 W

There’s no factor of 2 because the rating applies to one winding carrying the rated current.

During the other microsteps the power drops slightly, with the best case when one winding carries zero current:

(300 mA)2 x 35 = 3.2 W

That’s why MBI motors overheat: they operate at the ragged edge of their power limit while tucked inside a thermally insulating plywood box. If the motor stops on a microstep inside those pink zones, it’ll dissipate 6.4/5.6 = 114% of its rated power.

Changing the current between microsteps also poses a problem. The time constant for the MBI XY motors is:

τ = 44 mH / 35 Ω = 1.3 ms

That means the current settles within 5% in 4 ms and 1% in 6 ms.

Stock Thing-O-Matics move at about 30 mm/s. The motor pulley has 17 teeth and the belt has teeth on a 2 mm pitch, so the motor must turn at 1 rev/s to move the stage at 34 mm/s. With 1600 microsteps/rev, each microstep takes 625 µs, which is half the time constant.

I think you can see where this is going…

The microsteps outside the pink zones could have active current limiting, because the A3977 has some voltage headroom. The first microstep has a current limit 20% of the 750 mA maximum (set by the trimpot = what you want) = 150 mA.

The current starts rising toward the actual 300 mA maximum (set by the supply voltage and winding resistance = what you get) and after 625 µs it reaches:

300 mA × (1 - e-0.5) = 120 mA

So the current doesn’t quite reach the target and the A3977 doesn’t get a chance to do active current limiting.

The next microstep has a 38% current limit that sets a target of 285 mA, marginally below the 300 mA limit set by the winding resistance. The A3977 continues to apply the full supply voltage, so the winding doesn’t notice anything’s changed and the current continues to rise. At the end of the second microstep the current has reached:

300 mA × (1 - e-1) = 190 mA

Which is about 2/3 of the target and the A3977 still doesn’t do active current limiting.

The full analysis is messier than that, but what you see is pretty close. I won’t go into what happens when the A3977 is trying to reduce the winding current, but a similar analysis applies.

Also, when the motor rotates slower the microsteps last longer and the current can get closer to the target value. Print at 15 mm/s to get microsteps about 1 time constant long; that’s still short, but it’s better.

If the motor stops on a microstep outside the pink zones, then the two winding currents will eventually exceed the values for that microstep and the A3977 will begin active current limiting: that’s when you hear the chopper whine. However, if the motor stops on a microstep inside the zones, then it’s dead silent: the currents never reach the level where the A3977 can apply active current limiting.

Because torque is proportional to current, the motor never delivers its rated torque in any microstep while it’s turning. The motor datasheet includes this torque-speed curve:

Cupcake TOM Stepper Torque Curve
Cupcake TOM Stepper Torque Curve

The much-quoted Holding Torque is irrelevant. That measures the motor’s ability to hold its position with an external torque applied to the shaft. Unlike CNC milling machines, 3D printers do not impose torques on the XY motors due to forces from a cutting tool.

What’s important is the bottom curve showing the pull-in torque: the torque available to accelerate the load from a dead stop to the speed shown along the bottom, given in full-step pulses per second.

At 1 rev/sec the motor sees 200 full steps/sec, at which speed the pull-in torque is about 12 mN·m. However, that’s at the 400 mA full rated current applied from a 24 V source through a current-limiting driver. Because the maximum torque depends on the current and the resistance limits the maximum current to 300 mA, the maximum pull-in torque scales to 9 mN·n.

I’ll grant the possibility that there’s a misprint and Kysan simply dropped a zero. Pull-in torque around 150 mM·m seems more common with short NEMA 17 motors, but the data sheet is what the data sheet is. The motors behave as though they have no mojo, which leads me to believe the printed word.

Anyhow, that torque assumes the driver applies the proper winding current in each microstep, which, as you’ve just seen, doesn’t happen. Oddly, the MBI motors provide the highest torque in the pink zones, where the Pythagorean sum of the resistance-limited winding currents is:

√(2 x 300 mA2) = 420 mA

So the motors run in a crippled full-step mode that produces more-or-less the rated torque only when the motor isn’t moving, while dissipating too much power. When the motor is moving, the current never reaches the proper level.

The measurements I made when I had the printer apart indicate that the X and Y stages require far more torque than the MBI motors can provide, even if they were driven correctly. The fact that they work at all has more to do with good luck and spec tolerances than anything else.

The inadequate torque also answers the question of whether a higher power supply voltage will improve things: no, not much. A 24 V supply (as specified in the datasheet!) will permit operation at the rated current with correct microstepping, but that torque is still far too low.

I don’t have any inside knowledge, but I think what happened is that these motors date back to the Cupcake printer, which used a simple H-bridge without active current limiting. For that type of driver, the rated voltage of the winding must equal the supply voltage, because the winding resistance provides the current limiting.

Using A3977 drivers seemed like a simple upgrade to produce the Thing-O-Matic, but a microstepping driver must apply a voltage much higher than the winding’s rated voltage in order to get fast current changes and apply active current limiting. The old motors simply aren’t suited for the new drivers.

Tomorrow: what better motors can do for a Thing-O-Matic.

I’m certain I’ve made at least one error in what you’ve just read; comments, criticisms, and corrections are welcome. However, before you comment, RTFM for the A3977 driver, the MBI stepper motors, and any other hardware you’re proposing. Run the numbers first, OK?

Update:  A reader suggests a rule of thumb relating voltage to inductance …

Marris Friemannis of Gecko drive fame quotes this rule of thumb (http://www.mechmate.com/forums/showthread.php?t=1618)

Drive Supply Voltage = 32 * √mH Inductance of the motor

So in case of 44mH motor, correct voltage would be in excess of 200V, which I choose read as “the motor is junk” :)

In the stuff 3D printers use, single digit mH values at 24V seem to work fine.

23 thoughts on “Thing-O-Matic: MBI Stepper Motor Analysis

  1. Interesting research. I’m trying to run Gen4 electronics on my old cupcake with the “original” motors and having all sorts of issues with the z axis just not wanting to work. I think you’re on to something, as mine will stall/work in a regular cycle while lifting the Z but not while dropping it. If I give it a tiny nudge as it’s going up, everything works just fine.

    This weekend I’ll put the original controllers back on and see what happens.

    1. put the original controllers back on

      Those should work better than the A3977 drivers, simply because they’re not trying to do anything fancy: just switch the +12 V supply to the windings and be done with it.

      Now, the motors remain grossly underpowered, but …

  2. One other question, as I’m still learning about steppers and such — would disabling microstepping change anything, or are there constants that would make the graphs look the same but with less resolution?

    1. would disabling microstepping change anything

      Nope, the fundamental problems is that the motor doesn’t produce enough torque. The high winding resistance and inductance clobber the speed, but that’s just icing on the cake.

      Each full step is 8 times longer, so the current would have time to rise to the target values, but the driver still couldn’t apply current limiting and the motor would still overheat.

  3. Bravo! I’ve had DC-motor power curves drilled into me by a college professor and I’ve been trying to extrapolate that to my TOM’s steppers for a while now. Two months ago I experimented with currents and maximum usable speeds, and I was surprised that increasing current resulted in absolutely no improvement in missed steps at faster speeds. Your math explains that perfectly.

    Regarding the whine- I realized it was just the chopping frequency that PWM is a Good Thing, but aren’t most motor controllers designed to put the switching frequency out of the audible range? (I know some higher-powered DC speed controllers [~30 amps] are in the audible range to reduce losses in the FETs, but I’d be surprised if a 1 amp controller had to care.) Do you know if any combination of values on RC1 and RC2 will run the MBI stepper drivers at an inaudible frequency? And more importantly, would that be reasonable per the datasheet?

    The other thing that confuses me is that while the driver is chopping on and off, wouldn’t the inductive load of the motor result in a basically smooth current anyways? (Most speed controllers have a diode across the driver to allow that current to flow past the driver, I believe.) If not, could we put some electrical filtering on the driver to smooth the multi-kHz noise without impairing the 50Hz sinusoid?

    1. aren’t most motor controllers designed to put the switching frequency out of the audible range?

      If you have control over the whole system, you can build that into the design, but a generic controller paired with a generic motor doesn’t have that freedom. The L/R time constant determines the overall rise & fall times of the current, with the frequency controlled by the upper & lower current limits set by the chopper.

      wouldn’t the inductive load of the motor result in a basically smooth current anyways?

      That’s what the REF pot controls: the average value of the winding current. The A3977 turns the MOSFETs on when the current is below that level and off when it’s above, with the upper and lower switching points as described in the datasheet, so the chopper frequency is largely independent of the average current.

      Which is why the chopper frequency is so much higher than the L/R time constant: the current varies over a very small range. The waveform is more-or-less triangular around the average value set by the REF trimpot: you’re hearing the fundamental frequency.

      any combination of values on RC1 and RC2

      Those do fine tuning on the fall time of the average current between microsteps, but don’t affect the chopper frequency within microsteps. That’s part of the analysis that I skipped over… because most drivers don’t have those adjustments.

      electrical filtering on the driver

      Nope, you can’t get there from here. A chopper drive depends on fast current transitions to create the proper microstep current, which is exactly what a low-pass filter kills off.

      In any event, the reason they use chopper drives is power efficiency: the MOSFETs are either on or off, so they dissipate very little power. A low-pass filter must put the energy from those transitions somewhere, but you don’t want to dissipate it in a resistor…

  4. FWIW, I’ve measured the temperature of the MBI MK6 stepper at up to 60 C, and it has heatsinks on all 4 sides of the coil. It’s disappointing that they don’t seem to be running the numbers.

    1. up to 60 C

      That’s a bit on the toasty side for a stepper with forced air cooling. Similar Minebea steppers are rated for an 80 C rise over a 50 C environment, which would give you a 130 C motor. So, in principle, that MK6 is (probably) within specs!

      As soon as I saw the fan on the MK6 I knew something was wrong, but I didn’t have any numbers to go on. Now, we do: it’s dissipating far too much power while producing not nearly enough torque.

      I think you could build a direct-drive stepper extruder with a much smaller motor that would run quietly and smoothly at room temperature, but I’m sufficiently happy with a geared extruder to put that very much on the back, uh, burner.

      It’s disappointing that they don’t seem to be running the numbers.

      I think the TOM is the best DIY printer concept currently available, but MBI’s implementation leaves a lot to be desired. Hence my last four months of effort; I now have a TOM that’s pretty much what their description said it would be. Apart from the ABP, of course.

      The high end of the DIY 3D printer market has collided with the low end of the CNC milling machine market. Producing the next generation of 3D printers will require far more actual engineering than went into the TOM and IMO introducing another printer with oversights similar to the TOM’s won’t be survivable.

      But, then, I’m an engineer… [grin]

      FWIW, I like the Ultimaker: the guide rods have adjustments, the bearings aren’t overconstrained, and the moving mass is much lighter. The DIY makers seem to really like laser-cut plywood, but that’s just not going to work for the next generation of printers: the necessary thermal stability and repeatability just isn’t there. I want to be proven wrong… wood is great stuff.

  5. I know this is now an old post but for anybody coming here on their own adventure to a working makerbot I stole the above math using the newer steppers from makerbot (May 2011). The makerbot website has a broken link for the full data sheet and I couldn’t find any moon motors data sheets that matched the numbers that Makerbot gives but here is what we have:
    V = 4.83 V
    I = 0.83 A
    R = 5.75 Ohm
    H = 0.0093H (9.4mH)
    Peak possible current (without the driver acting IAW it’s limits) gives 2 amps, so the full range of microstep currents should be achievable, with the motor voltage of 4.8 under the supply voltage of 12ish volts. That said this now means that a mis-set stepper drive can push more than twice the design current through the stepper so more care when setting up might be in order.

    Only the static Torque is listed so no way to know how it will compare speed wise to the fastest Cephalopods.

    R/L gives a time constant of 1.6us though which to me means there will be the same problem of lagging current as the driver tries to step the motor against the inductive load. So not rushing out to retrofit my cupcake just yet.

    Was hoping for an easy fix so happy to be proven wrong with what I’ve done here, though apart from the electrical side these look to hit the same shaft size problem as Ed has described elsewhere.

    1. the same problem of lagging current

      Remember that the current must only reach the target for the microstep, which is a small fraction of the final current determined by (supply voltage) – (IR drop). I haven’t run the numbers, but we batted the technique around in the comments for several other posts.

      Unless something surprising pops up, it looks like a standard stepper and should work fine.

      1. Well as directed by the Makerbot shop site fired a question at the support desk about refitting with the new motors and got this response:

        “Thanks for getting in touch about the motors! However, I would not recommend this as an upgrade: the new motors are basically a drop-in replacement with no difference in performance. Most likely you wouldn’t see any difference.”

        Which apart from anything else leaves the question of replacing or adapting the existing pulleys to the larger shafts unanswered.

        1. Most likely you wouldn’t see any difference

          That’s true under the strictest possible interpretation of “difference”. Given a printer properly set up so that it doesn’t overtax the motors, you wouldn’t see any difference: it would continue to print correctly with exactly the same settings, modulo quibbling about the REF setting that controls motor current.

          But it certainly ignores the whole point of a motor upgrade, which is that you can get much better and much more stable operation with motors that operate correctly with the microstepping drivers.

          You may choose to not print much faster, because the mechanical stability of the stages won’t allow it, but being able to move the stages at 100 mm/s definitely reduces problems with ooze and stringing.

          replacing or adapting the existing pulleys

          Most folks don’t have a set of number-gauge drills, so enlarging the holes in the hub would be challenging. It Would Be Nice If MBI also offered a set of motor pulleys for 5 mm shafts, but that’s in the nature of fine tuning; I expect that’ll happen when they incorporate the new motors in a future printer and have plenty of those hubs in stock.

  6. WOW! This was what I was asking you about in Mar/Apr when I’d just started to try and understand your electronic world.

    As a reminder: I was having problems with my bot and at the time you told me to get used to the noise. I’d mentioned a quieter Denford and you told me of your noisy Shurline. All during this time I had the suspicion that the motors were not correctly tuned and were clipping the curves. The motors were not getting the correct setting values through the controllers. I could not evaluate, nor determine correct values since I did not have any of the knowledge nor equipment to learn and test properly. If you have seen recently that MBI has also drastically changed some of their controller settings. [“NEW – 2001 MBI Electronics Settings”]

    I was banging my head and here 3 months later the world turns to the better course. Agghhhh!!!!

    Anyway – I enjoy your stuff — Thanks for your curiosity, knowledge, ability and generosity.

    Regards,

    Brian.

    1. I had the suspicion that the motors were not correctly tuned

      As with pretty much everything I’ve done on / to / with this Thing-O-Matic, I started with the assumption that everything was OK. Troubling events eventually force me to run the numbers and then whap upside the head: something else to tweak.

      MBI has also drastically changed some of their controller settings

      Mmmm, what a coincidence… [grin]

      Thanks for the good words; it’s been a fun ride!

  7. Say Ed, Now a question —- RC values. Should these be measured without power and in Ohms? I’ve seen from circuit designs and designers comments that these are an Ohm value not to have power and measured in Volts. I ask this because MBI still lists them as a (V) volt value. I’d spoken and emailed them but, have not gotten a satisfactory answer.

    Best to you,

    Brian.

    1. MBI still lists them as a (V) volt value

      Because that’s the easiest thing to measure!

      The RC1 and RC2 voltages comes from whatever current the internal circuitry of the A2977 chip applies to those external resistances, so they’re a bit harder to define. Those trimpots are in series with another resistor and the test point is the chip pin; I suppose voltage is easiest, although it’s not really a meaningful number.

      For those two, the resistance is pretty much linearly proportional to the trimpot rotation: fully CCW is max resistance = 47 K, fully CW is close to zero, half way in between is about 23.5 K. Add in 12 K for the series resistor, plug the sum into the equation in the datasheet, and you’ll know long the “fast decay” part of the transition between microsteps lasts… for whatever good that does you. Frankly, I think it doesn’t matter.

      The PFD and REF values come from the trimpot wipers and the trimpots go between +5 V (with a 12 K series resistor) and Ground, so the voltage you’ll see should be stable. Both of those set thresholds in the A3977 chip, so a voltage is actually meaningful.

      Reading the chip datasheet a few times while pondering the board schematic should make things a bit more obvious. Ohm’s Law is your friend… except when you’re not dealing with resistors, of course.

  8. Ed – I forget how to open a discussion with you.

    I’d like to ask about PC PSUs. I’m playing to make a lab PSU. I goofed around with the 110V/220 switch because my son wanted to use it for an on/off. Now, the PSU doesn’t work. I had only disconnected the blue and brown wire from the 110/220 switch to test which orientation made the PSU 110 or 220. Right – I don’t know what I am doing – yet. I did test the PSU after connecting the green&black wire jumper before I messed with the 110/220 switch and the PS worked. I also – duh – forgot to mark the two wires to the switch for orientation. I reconnected in both orientations but, not sure if my solder job was bad or if I blew it up. Neither connection orientation worked. I do have power beyond the plug and to the first (coil?) circuit board at 120V. Note: This is not a proprietary PSU like a Dell. My son is setting up a Dell on his own and working it’s different wiring. So, we are becoming familiar with that.

    Any pointers, knowledge, links to fixing rather than other’s instructions on setting up a PC PSU as a lab PS?

    In other words – Would you help me make this work? Please. I am interested if I have to rewind or test/remove components. And I know there are many, many supplies so I am selfishly asking you for some extra experience, thought and brain cycles. Maybe asking too much..?..

    The unit is from a 13 year old small Compaq – PSU is a Delta Electronics 150W max. Model DPS-145PB-100 Rev C. S/N R2D9940436670

    1. I also – duh – forgot to mark the two wires to the switch for orientation.

      I’ve carried a tiny digital camera in my pocket for the last few years and have long since lost track of the number of times it’s saved my bacon. I take pictures of everything I dismantle: you never know what you’ll forget and a picture makes all the difference.

      When it’s all back together, you just delete the pictures; take ’em again the next time you open it up.

      if I have to rewind or test/remove components

      Most likely, there’s a blown fuse right where the AC power wires enter the PCB; follow the traces and you’ll find it. With any luck, it’ll be marked F1 on the silkscreen. They’re typically not replaceable (“No user serviceable components inside”) and will look something like a small resistor without markings. You can hotwire a blown fuse with one strand from a stranded wire, but you really want an actual fuse in there; the trick will be figuring out the appropriate value and getting a replacement.

      some extra experience

      This isn’t what you want to hear, but my experience says that if it’s not the fuse, then you’ve just gained all the experience you can expect. Use that power supply as a parts donor for other projects, pick up another old supply, and move on. Fixing such a thing by remote control simply isn’t a productive use of anybody’s time. Trust me on this one, please.

  9. OK – if fuse – fix. If not – replace with other junk – move on. Say Thank You – either way and hack/make another day.

Comments are closed.