Tuesday, November 13, 2018

The schematic of stepper driver and power circuit

The schematic is complete. For most motors, the diodes can be usual rectifier types rated at 1A (i.e. 1N4004). Fast rectifier types are usually a better choice. If you're using N-FETs with included protection diodes, there is no need for external diodes. Also, with FET transistors, the gate can be connected directly to Arduino pin, without 1k resistors. Those resistors are required if you use bipolar transistors instead of FETs. Yes, you can use NPN transistors. Darlington transistors are recommended. Just make sure the transistor can handle load current (drain-source current, collector-emitter current) and it can be fully switched on by Arduino (gate threshold voltage, DC gain).

The resistor connected between OUT and ADJ pins of LM317 step driver controls the constant current. For 2.4 ohms, the current is 1.25/2.4 = 0.5A. Use a correct wattage resistor (2-3W). Replace the resistor with a suitable value for the motor rated current. The voltage at LM317 input cannot exceed 35V.


All it needs now is the software. Rotating a stepper is very simple, that's why I wrote my own code instead of using a library. To simplify the code I didn't use standard digitalWrite routines. I wrote directly to the port. First the port must be set as output in setup() with DDRB = 0x3F;. This sets digital pins 8 to 11 as outputs. Check Arduino Port Manipulation page.

The coils must be energized in a specific order: a half of one coil (A), then a half of the other (B). Pulses should then energize the remaining coil halves (C half of the first coil, then D half of the other coil). The order determines direction. Just remember: you should not energize in a sequence one half of a coil, then the other half of the same coil. The motor will make a step in one direction and one step backwards. It doesn't harm the motor though. A-B-C-D and A-D-C-B are valid sequences, but A-C-B-D is not.

Because you can power 4 coils, there are actually 3 ways of doing it. You can use wave drive. Each of the 4 coils is powered sequentially so that only one coil is powered an any time. This results in less power consumption and less torque. Below is the pulse train and the code used to generate it.

void waveDrive(unsigned int numSteps, unsigned int stepDelay = 5) {
  for (unsigned int i = 0; i < numSteps; i++) {
    PORTB = B00000001;
    delay(stepDelay);
    PORTB = B00000010;
    delay(stepDelay);
    PORTB = B00000100;
    delay(stepDelay);
    PORTB = B00001000;
    delay(stepDelay);
  }
}

The motor can be rotated in half drive mode too. In this mode a pulse is kept high when the next starts. Half of the time, two adjacent coils are energized, resulting in higher torque. When both adjacent coils are on, the axis turns one half of the step, resulting in a smoother rotation. With the same delay, pulse width increases, meaning you can use lower step delays.

Unipolar stepper half drive


void halfDrive(unsigned int numSteps, unsigned int stepDelay = 5) {
  for (unsigned int i = 0; i < numSteps; i++) {
    PORTB = B00000001;
    delay(stepDelay);
    PORTB = B00000011;
    delay(stepDelay);
    PORTB = B00000010;
    delay(stepDelay);
    PORTB = B00000110;
    delay(stepDelay);
    PORTB = B00000100;
    delay(stepDelay);
    PORTB = B00001100;
    delay(stepDelay);
    PORTB = B00001000;
    delay(stepDelay);
    PORTB = B00001001;
    delay(stepDelay);
  }
}

The third way is called full drive. Two adjacent coils are on at the same time, resulting in highest torque possible.


Unipolar stepper full drive



void fullDrive(unsigned int numSteps, unsigned int stepDelay = 5) {
  for (unsigned int i = 0; i < numSteps; i++) {
    PORTB = B00000011;
    delay(stepDelay);
    PORTB = B00000110;
    delay(stepDelay);
    PORTB = B00001100;
    delay(stepDelay);
    PORTB = B00001001;
    delay(stepDelay);
  }
}


These are basic and lightweight functions for driving a stepper. The numSteps argument is a multiple of 4 steps. That is, for numSteps=1, the motor will make 4 steps. For the common 1.8 degree stepper motor, 200 steps/turn motors, set numSteps to 50 to make a full rotation. These functions do not support changing direction.

Saturday, November 10, 2018

Understanding of resonance essential for solving vibration problems

It's no secret that severe vibration can destroy bearings, ruin shafts and potentially disrupt production. What's less well known is that resonant machine components and supporting structures can magnify even small vibration problems enough to damage connected equipment or cause catastrophic machine failure. To solve a vibration issue quickly and avoid such undesirable outcomes, an important first step is to determine if the source of the increased vibration is resonance in the rotating equipment or in a supporting structure.

Understanding of resonance essential for solving vibration problems


Structural resonance: Structural resonance refers to excessive vibrations of non-rotating components, usually machine parts or supporting structures. Due to the complexity of these components, it is the more common resonant condition and usually occurs at or near the rotating speed of the machine. Even slight vibratory forces from residual unbalance and misalignment effects of the machine can excite the resonant base structure, resulting in severe vibration.

Rotor critical speed: A hybrid step motor critical speed exists when a machine's rotating element is the resonant component and its speed matches the natural frequency of the rotor. This is common with centrifugal pumps, gas and steam turbines, and large, two-pole electric motors. While the result is similar to structural resonance (high vibration at a certain operating speed), a rotor critical speed is a more complex phenomenon.

It is important to properly distinguish between structural resonance and rotor critical speed. The term "critical speed" (without the word "rotor") is somewhat ambiguous. Technically, a critical speed could be either a structural resonance or a rotor critical speed. For the sake of clarity it's best to avoid using that term. The simple term "resonance" can be applied to both conditions to avoid confusion.

Friday, November 2, 2018

H-bridge circuit of stepping motor

As simple in construction as a bipolar 12v stepper motor is as complicated control circuits can be. However of-the-shelf ICs or complete electronic modules for controlling stepper motors, with costs not exceeding a few dollars, are available. Generally, in order to reverse the flow of current through a winding, i.e. reversing polarity, a H-bridge circuit is required for each winding. In order to better understand the inner working of such a system such circuitry is also used in our example. The circuits are powered by a 12 VDC source but a 24 VDC power source can also be used. The power transistors are BD139 NPN with their respective PNP BD140 complements, supporting up to 1,5 A current.

In addition to the simple H-bridge circuit, a protection circuit is added in order to prevent short-circuits when both bits controlling the H-bridge are 1, thus preventing high values of current flowing through the power transistors. Transistors used in this section are BC639 NPN, together with 1 KOhm resistors.

H-bridge circuit of stepping motor

Q1, Q2 – BD140 power transistors;

• Q3, Q4 – BD139 power transistors;

• Q5, Q6 – BC639 transistors;

• All resistors have 1 KOhm ratings.

If the first data bit is 1 and the other 0, Q3 will conduct suppling ground to Q2 which will also conduct and the motor will turn in one direction. Conversely, if the sequence is 01, Q4 and Q1 will conduct, allowing for reverse polarity and thus reverse current flow through the winding. If there would be no protection circuitry, if the sequence would be 11, all four transistors, Q1-Q4, will conduct and creating a short circuit. Due to the high current they will burn out.

See more:




Thursday, November 1, 2018

What is the precision required for Stepper Motor

ocuser is precise tool – it must allow to adjust imaging train position with high accuracy. But what is the exact accuracy? Well, it depends – mainly on focal ratio of instrument. There is a quality called Critical Focus Zone that, simply saying, describes the distance where the image is sharp. You can see in the table below how CFZ varies depending on telescope focal ratio:

Saturday, October 27, 2018

The Structure and Principle of the Number of Stator Phases

1.Single phase stepper motor
The single phase stepper motor is winding a loop coil on a coils framework, giving it a positive and negative alternating current, and each switching current takes a step in a fixed direction. Because the magnetic conductance of the rotor magnetic path become bigger to change the rotation direction, the single phase stepping motor can only move in one direction, so a single phase stepper motor just only moves in a one direction. In order to ensure the fixed rotation direction, the magnetic conductance takes many measures, for example, to make the stator air pole wider than the rotor, and the working air gap between the stator and rotor is not uniform, and the direction of rotation is in the direction of small reluctance.

The Classification, Structure and Principle of the Number of Stator Phases

2.Two phase stepper motor
The simplest structure of the two phase stepper motor is that Nr=1, Generally ,the number of the stator magnetic pole is a multiplier of 4, at least 4. The rotor is a two pole rotor with one at N pole and one at S pole.

3.Three phase stepper motor
The stepper motor, of which does not use permanent magnet on its rotor, is very early used on three phase stepper motor. In 1986, a Japan servo company developed a stepping motor with permanent magnet and stator magnetic pole with gear, the matching of stator and rotor pitch can achieve higher angular resolution and torque. The main pole number of the stator winding of the three phase stepping motor is multiples of three, so the stator main pole number of the three phase stepping motor is 3, 6, 9, 12 and so on.


4.Four phase stepper motor
According to the formula θs=180°/PNr, if Nr=50, θs=0.9°,then P=4,that is four phase stepper motor. Because of the even phase of the four phase step motor, the power pipe of the driving circuit is 16, the number of the main pole of the stator is 16, all of which are two times of the two phase stepper motor, so the drive structure is complicated and the cost is high, so it is only used for special purpose.

5.Most of stepper motors sold on market are are five phases
The stator structure and drive circuit are simpler than the four phase stepper motor, but more complex than the two phase and three phase stepper motors and the cost is high.


Friday, October 19, 2018

HOW TO READ INPUT VALUE FROM STEPPER MOTOR ENCODER

You will need :
Motor with encoder
Arduino board ( I used arduino Uno)
Computer
Battery or DC voltage supply
Encoder library , download from https://www.pjrc.com/teensy/td_libs_Encoder.html or from the zip file attached
( A little experiment I did with multimeter :
power the encoder with 2 AA battery, attach multimeter GND cable to GND of the battery , and multimeter RED cable to the C1 or C2 output of the encoder.
As you turn the motor slowly, you can see that the output voltage of C1 and C2 change from 0V to 3V.
If you have 2 multimeter, attach C1 and C2 each to a multimeter, then turn the multimeter slowly you can see the value of multimeter change from 3V-3V, 0V-3V,0V-0V,3V-3V, which is the pulse according the background theory).

Step 1: Wiring
Picture of Wiring
The DC motor with encoder has 6 wires :
2 wires to power the motor (Often labeled as : M1, M2 , motor power ...)
2 wires to power the stepper motor with encoder (often labeled GND and 3.3V)
2 wires to send signal of position to the microcontroller (Arduino) (labeled as encoder output or C1 & C2)
First you will connect 2 wires to power the encoder to Arduino Gnd And Vcc 3.3V (in my version of encoder motor, the encoder led turn on when I connected the wire power)
Then connect 2 wires signal of the encoder to 2 pins with interrupt of Arduino , (which is pin 2 and 3 of the Arduino Uno)
You can turn the motor by hand or connect 2 motor wires to the battery to rotate the motor.
Note : normal pin will still work at low speed when you turning the motor by hand, however, when you run the motor with the battery and the motor rotates at high speed, the encoder will misread the position of the motor, result in duplication while reading. Using interrupt pin with the library prevent the encoder from making this mistake (in my experiment it was quite accurate when read the motor with interrupt pin, the only time it make a mistake is in the end when I stop the motor and the motor slowing down, that time the reading was duplicate for a few position).

Step 2: Upload the Code:
After the installed the library, you can open File/Example/Encoder/Basic to run the code , or copy paste this code in :

/* Encoder Library - Basic Example
 * http://www.pjrc.com/teensy/td_libs_Encoder.html

 * This example code is in the public domain.
 */
#include 
// Change these two numbers to the pins connected to your encoder.
//   Best Performance: both pins have interrupt capability
//   Good Performance: only the first pin has interrupt capability
//   Low Performance:  neither pin has interrupt capability
Encoder myEnc(2,3);
//   avoid using pins with LEDs attached
void setup() {
  Serial.begin(9600);
  Serial.println("Basic Encoder Test:");
}
long oldPosition  = -999;
void loop() {
  long newPosition = myEnc.read();
  if (newPosition != oldPosition) {
    oldPosition = newPosition;
    Serial.println(newPosition);
  }
}

Step 3: Results
Picture of Results
After successful with all above step, turn on the serial monitor :
And first turn the motor with your hand to see that the position is slightly change
Then run the motor with battery to see that position reading change rapidly as the motor run fast.
I hope you find this helpful. Thanks for reading. If You have any question about stepper motor, you can visit our website :oyostepper.com for help.

Saturday, October 13, 2018

Practice on Controlling a Stepping Motor

In our article about stepper motors we have presented this type of electric motors, how they operate and what makes them highly compatible with digital control systems. Now we will talk about how to control such a motor together with a simple example, involving a H-bridge electronic circuit and simple scripting. In our implementation we have used a bipolar 23 stepper motor, however minor changes in control sequences are required for other types of stepper motors.

Practice on Controlling a Stepping Motor


To summarize, the electromagnetic coils are located on the stator of the stepper motor, while permanent magnets, equal in pair numbers, are located on the rotor. A more detailed discussion about stepper motors can be found in our dedicated article, but making a long story short, like any DC motor, these motors rotate when the coils are energized however, if the coils are continuously energized in the same way, the movement will stop when opposite magnetic poles are aligned, e.g. S-pole on coil aligned with N-pole on rotor permanent magnet.

Practice on Controlling a Stepping Motor

Electromagnetic coils found in a bipolar nema 17 stepper motor are arranged as independent windings, each of them corresponding to one phase. Usually such stepper motors have 6 terminals, 5 if the common wires of the two windings are internally connected, and the terminals can be identified by measuring the resistance between terminals using a multimeter.

Practice on Controlling a Stepping Motor


In short, if resistance of a coil, between its two end terminal has a certain value, the resistance between the common lead and any of its terminals must a value divided by 2. In 5-lead motors, coil terminals can be determined by touching each two wires together. When the rotor shaft becomes harder to turn it means that the two connected wires belong to the same winding.

See more:



How to enhance the control capability of linear guide rails?

1.Brief of linear guide rail A linear guide rail is a mechanical component used in linear motion systems to guide and support a moving carr...