Building a Better Bipolar Stepper Motor Driver

A few years ago I started building stepper motor drivers.  First it was a simple unipolar driver.  My motors wouldn't rotate faster than 1 to 2 rps.  So I learned about inductance and using a higher drive voltage and current limiting resistors.  But these dump heat like crazy. So I learned about chopping, or PWM drivers that apply a very high voltage and vary the duty cycle to avoid frying the motors. 

After building a few more designs I was beginning to dispair.  Despite doing everything "correctly" I was still having troubles.  My motors would hit about 4 or 5 rps and then stutter and stop.  So I learned about back-emf, resonance and micro-stepping.  But even that only helped so much. 

I was using a PIC chip to translate step and direction into the phases needed to energize the bipolar motor.  A monolithic chip between the PIC and the H-Bridge/motor would monitor the current and handle the required PWM of the applied voltage.  But still the performance was disappointing.

Commercial units like Gecko Drives could accomplish apparant miracles but nothing I could build was even close.  Then I stumbled across a reference design by Microchip. Intent on selling dsPICs they had no reluctance to share a marvelous design for a bipolar stepper motor design.  Their board was too complicated for me since it was meant to demonstrate virtually every possible operating mode whereas I just wanted a simple bipolar driver.

In the end I borrowed ideas from their design and rolled my own.  My board uses a dsPIC33, two quad op amps, and a venerable L298N for the H-Bridge.  The dsPIC monitors the currents in the two motor phases and, using a PI (proportional Integral) loop adjusts the duty cycle of the PWM voltage.  It does this at 40KHz.  It takes two 10bit A/D samples and calculates the new duty cycle for each phase 40,000 times a second. I was impressed. The design implements 4 microsteps per full step or 16 steps for a full electrical cycle.  Because of the L298N I've set a limit of about 1.7A per phase and a max input voltage of about 40V (although I haven't tested above 24V).

Using this design, plus a salvaged 24V DELL power brick I've spun low voltage bipolar motors (you need about a factor of 5 or better for the applied voltage) at up to 40Hz.  In the attached video, I'm using a 20V supply and the one motor hits about 31 rps, and the other larger motor hits just shy of 29 rps.  I have three of these drivers coupled with another 20V brick running my home built CNC.  There the motors push the three axis around via an 18 thread per inch screw at about 13.5 rps yielding a linear movement of 45 inchs per minute.  With a higher voltage supply I think it could do better but frankly the CNC wouldn't stand the additional strain.

Finally something I can smile about.

My web site contains more details, full schematics, PCB layout, gerber files, and source code plus a programmable hex file.

Enjoy.

Dr. Iguana

https://www.youtube.com/watch?v=8_iJ-XGpFvs

Great design, thanks for

Great design, thanks for releasing the schematics !

persistance wins in the end

I enjoyed the informative way you presented your experience. Thanks for sharing.

Need Schematic

Hy… Following you for last few days, and fianlly found your website. I am a hobbist and want to make a stepper driver to run stepper motors. Can you please share teh schematics of your board?