Stepper Motor Controller

 See also Stepper Motor

The stepper motor and its controller is one of the most central components of our automated manufacturing tools, which in turn are one of the most central components of the GVCS.

Details
Luckily, there are a number of off-the-shelf options available which can be purchased and used immediately. Unfortunately, these are somewhat expensive, they won't be standardized among the community, and we're going to need quite a few of them. The RepRap, laser cutter, torchtable, cnc machine, circuit maker, and pick and place machine could need up to 3 each or more. Since we're building a mini factory, we'll likely need them in other applications as well.

It is essential that the community thoroughly understand stepper motors - their uses, limitations, and ways to maximize performance. Moving things precisely is a skill we need to get very good at.

To that end, at a minimum, we need to standardize on an off-the-shelf system in the near term, and create one or perhaps more of our own motor controllers that will suit our needs in the longer term.

Below is the wikipedia entry for stepper motors as well as tons of info on the RepRap page.

http://en.wikipedia.org/wiki/Stepper_motor

This is a goldmine for drivers: http://reprap.org/wiki/StepperMotor#Stepper_drivers

Team/contributors
Please list your name here if you are working on this at all.

=Off-the-shelf options=
 * 5 axis version of controller brain (minus power handling) - can this be used with any power-handling system? -
 * An up to .75A brawn module from Sparkfun -
 * Any advantage cf. open source RepRap stepper controllers?
 * This does offer USB connection, and is open source -
 * 3 axis, 3A kit on eBay, $200 -


 * CNC Stepper Motor Controller at.
 * Rugged motor driver. 2.9 Amps. Only $23.

Turnkey systems

 * 2-axis, 4A, 24V system -

=Technical background information= In this section, we gather together the knowledge of stepper motor controllers and stepper motors.

Education
Here all the information is listed to bring you up-to-speed on stepper motors and stepper motor controllers.

Overview

 * Overview of stepper motor and driver technology: http://www.ams2000.com/pdf/step101.pdf
 * Good resource with links, explanations, and physics: http://www.cs.uiowa.edu/~jones/step/

Motor driver circuits (must read)
Must-read info on motor driving circuits. Basic, and current limiting.

Stepper motor sizes

 * Nema 23 motors are about 6x6x8 cm size - and require _______ amps for driving.
 * Xylotex says body length is 3"

Electromechanical operation

 * Good diagrams here showing the inside of a stepper motor.
 * Choose motor type and number of leads, and it generates an image of the motor . Not in English.
 * Stepper motor disassembled. http://www.ducttapeeng.com/smd/smd1.htm

Microstepping
The link below explains microstepping in detail. Basically, a stepper motor has about 200 little poles inside it. It is moved by alternating the magnetic field in such a way that the motor moves from one pole to the next, or steps, hence the name. This is sort of a 'digital' mechanical action - discrete jumps in position. With microstepping, instead of the field turning completely off on one pole and moving to the next, the field is on both adjacent poles at the same time, creating a 'tug of war' between the poles. The microstep angle is proportional to the ratio of current in each adjacent pole. If the currents are equal, the rotor pole will go halfway between the stator poles. If one pole has 75% of the current and the other has 25% of the current, it will go proportionally to the one with higher current, a quarter step. This can be thought of as an 'analog' mechanical action, so microstepping as you can see can give you better accuracy but may not be as trivial to implement. My explanation is simplified, the below link explains it properly.

A note about microstepping though is that it's sole function isn't always to increase resolution. It will cut down on motor vibration, noise, and wear when it is used to drive the motor through smooth rotations, because instead of one pole snapping to the next in quick succession, one pole gradually transitions to the next in the microstep increments you are using. Using quarter steps for example would give you four little gaps to snap to, as opposed to one big step.

http://www.zaber.com/wiki/Tutorials/Microstepping

MIT Motor control lab
A laboratory assignment from MIT opencourseware where they take an audrino board and control a motor. 

Digi-Key/STMicroelectronics 72 slide tutorial on small motor drivers (must read)
Great practical tutorial on building motor controllers. Discusses different power classes of motors, different ICs available (STMicroelectronics ICs) and what different architectures for motor controllers can be used and when they should be used. Must read. 

A modern design example
Here we will detail the operation of a common design for modern stepper motor controllers. We hope to fully understand this design and either base our design off of it or take it's essential features and create a new design.

High-level architecture
Insert picture of overall architecture showing the control computer, the indexer, the power supply, and the driving circuit.

Indexer
Discuss indexer functionality and implementation.

Driver circuitry
In this section we focus on what seems to be the most common modern design for stepper motor controllers, the chopper circuit. From Wikipedia:

"Modern stepper controllers drive the motor with much higher voltages than the motor nameplate rated voltage, and limit current through chopping. The usual setup is to have a positioning controller, known as an indexer, sending step and direction pulses to a separate higher voltage drive circuit which is responsible for commutation and current limiting"

=Components and chips= In this section critical relevant electronic components are listed, including suppliers. The purpose is to aggregate a list of key components so that a design can be built around the best, lowest cost, components.

Microcontrollers
I'd recommend, hands down, going with Atmel AVR microcontrollers. They've got a huge support community, eg, Arduino.

Motor driver chips and H-bridges
This section is loosely for ICs that are designed to drive motors. Some are just simply H-bridges with protection circuitry, others include things like PWM.

Allegro A3959 Extremely interesting chip. Up to ±3A output current built in sense and PWM. Its $5.91 at Digikey for a DIP package, and as low as $2.76 for a surface mount package. The DIP package is only $4.98 at Newark.

National Semiconductor LM298 (obsolete) Commonly used with stepper motors. $8.32 at Digikey

National Semiconductor LMD18245T Commonly used with stepper motors. $20.09 at Digikey. $18.25 at Newark.

STMICROELECTRONICS - L298N IC MOTOR DRVR FULL BRIDGE 2A MULTIWATT15 $2.78 at Newark

ALLEGRO SANKEN - SLA7026M IC, MOTOR CTRL/DRVR, STEPPER, 3A, SIP-18 $7.08 at Newark

=Open source projects=
 * RepRap 3D printer http://reprap.org/wiki/StepperMotor
 * Tons of info, meta source
 * An AVR-Based Microstepping Bipolar Chopper Stepper Motor Driver (STMD) http://www.avrstmd.com/
 * Cerebral Meltdown motor controller

=OSE controller=

System requirements
This is the requirements section for the OSE motor controller, as a system. These requirements will dictate the design, as well as the off-the-shelf system chosen.

Functionality List what functions the system needs to have.

Performance List the performance (torque, accuracy, etc) the system needs.

Manufacturability List important manufacturability details - minimum feature size on circuit board, for example.
 * The first version should be design to be constructed on a breadboard.

Motor compatibility Will this system be compatible with only one motor? One type of motor (unipolar, bipolar)? What size motor (current rating)?

Cost How critical is the cost? Do we need to have two designs - one low-cost design for driving a single motor, and a higher cost design for driving 3 - 4 motors?

Ease of construction and ease of use Does the system need to be designed for construction and use by a layman with absolutely no electronics experience?

Size Does the controller have a size requirement? Any other physical requirements?

Other requirements

Already an OSE controller?
There appears to be some work already being done, although somewhat loosely or perhaps incidental work. Need to investigate. http://opencapitalist.org/content/4-axis-motor-controller

Brainstorming
Please sign you name by putting four tildas (~) in a row.

Power supply
What if we used power supply units from PCs? They're pretty high current and they can be placed in series for 12 volt, 24 volt, 36 volt, etc, systems. They've got 5 volt taps to run the microcontroller off of. They're ubiquitous and either free or cheap. Jason 00:46, 23 May 2011 (PDT)
 * Wiring diagrams . Notice both +12V and -12V rails available. Jason 13:57, 23 May 2011 (PDT)
 * Here is a table of the common supply currents from here . It appears that the -12V line doesn't have enough current to be used, however, the 3.3V, 5V, and 12V each have a generous amount of current. Jason 09:56, 25 May 2011 (PDT)
 * Perhaps two PSUs can be used, one as the positive rail, one as the negative rail. Investigation is needed. Jason 10:14, 25 May 2011 (PDT)

Crazy idea - combine inverter and motor controller circuits onto one
It seems to me that the high cost of both motor controllers and inverters are some pricy power electronics components. What if we could reuse those expensive power electronics components to make a single circuit that can either be an inverter or motor controller? An inverter takes DC power from batteries and creates an AC signal. However, when running motors, you don't need that functionality, because you're taking DC power and running motors with it. So, potentially, with a single expensive piece of power electronics, you could combine inverter and motor controlling capabilities for just a little more than supporting just a single function. Discuss. Jason 03:32, 23 May 2011 (PDT)

Vacuum tubes
http://openfarmtech.org/forum/discussion/220/making-vacuum-tubes

We have need of some power electronics, which include inverters and motor controllers. The primary cost of these circuits are the power electronic components. While we could definitely look at what it would take to make some of these semiconductor components, another option would be to look into what it would take to make vacuum tubes. This could potentially cut out those $20 mosfets we will need, and all the other components should be inexpensive in comparison. We aren't creating perfect audio here, or trying to make a communications system. We're simply powering stuff. Maybe its feasible. Jason 12:03, 23 May 2011 (PDT)

Software/firmware
The software is essentially a separate project from the hardware. From what I understand, there are essentially two forms the software can take: either implementing a very basic 'step' function only into the microcontroller, and controlling everything else from the PC side, or doing most of the control from within the microcontroller. Some functionality that can be in either are:
 * acceleration/deceleration
 * automatically microstepping depending on the motor speed, to allow for smooth movement
 * accounting for motor resonances and damping them
 * in general modeling the system it's driven load as closely as possible to allow accurate open-loop operation at decent performance

I think there are quite a few more parameters to deal with. In the end, we will probably be essentially designing this thing to interface with EMC2, which has many of these features. We may need a dedicated linux box for each table. Or should we design the system to connect to a network? Perhaps it should interface with something like a beagleboard?

I think in any case, the controller firmware should have both the option to run in two modes: one just being a simple step mode controlled externally, and the other being a highly integrated control within the microcontroller requiring only high-level commands externally. The microcontroller can then be flashed to operate with a specific motor or system, and the external software just gives it high-level commands which are fairly generic across pieces of hardware its controlling.

Requirements
Software requirements to go here.

Hardware/circuit
The hardware needs to be optimized rather closely with the usage scenario to save costs. It may be possible to have several different circuit designs that run essentially the same firmware, so that the design which is the minimum needed can generally be used. It may even be possible to have several circuit configurations all work on the same PCB, with certain parts not loaded depending on the desired operation.

Requirements
Hardware requirements to go here.

Design proposal
Proposed design to go here.

Version 0.0
Version 0.0 will simply be an agreed upon off-the-shelf system suitable for most RepLab needs. This will standardize the hardware people are using, either for those who can't yet build their own system, or for those who don't wish to mess with the electronics. The chosen system should have a controller which is compatible with motors we build in the future, and motors which are compatible with the controller we build in the future.

In addition, the microcontroller should ideally be the same as the microcontroller used in the open source design. This will allow the software to be developed and tested completely independently of the hardware.

Version 0.0
This section needs to be filled in asap. Careful considerations must be made, however, to make sure the chosen off-the-shelf system is compatible with the open source version of the system. A re-programmable AVR based system would be ideal.