Home
Prox / RFID
Verichips
Ladder Logic
[interfacing] †
Tube Joints
Key Code From Photo
SolveSpace (3d CAD)
SketchFlat (2d CAD)
Photographs
Miscellany
Resume / Consulting
Contact Me

LDmicro Forum - Acelerar e desacelerar um motor de passo

(you are viewing a thread; or go back to list of threads)

Acelerar e desacelerar um motor de passo (by Marcio A)
Gostaria de saber como aumentar e reduzir a velocidade de um motor de passo.
estou usando 16F628A
Fri Apr 23 2010, 22:30:38
(no subject) (by jp_)
I wonder how to increase and reduce the speed of a stepper motor.
I'm using 16F628A

Olá Marcio,
vai ser dificil encontrar uma resposta em português mas se eu poder ajudar...
Primeiro tens que nos dizer que tipo de motor de passo estás a usar 2 polos ou 4 polos, o hardware é diferente e o programa também.

Hello Marcio,
will be difficult to find a response in Portuguese but if I can help ...
First you have to tell us what kind of stepper motor you are using two poles or four poles, the hardware is different and the program too.
Tue Apr 27 2010, 05:26:17
(no subject) (by Marcio A L)
Amigo obrigado por responder eu utilizo um motor de 4 polos.
O que eu desejo realmente é conseguir acelerar ou reduzir a velocidade de um pulso.
O motor de passo foi um exemplo que utilizei.
O que eu desejo é pressionar um botão para acelerar e pressionar outro para reduzir.
se o amigo puder me ajudar.

Agradeço
Wed Apr 28 2010, 07:10:24
(no subject) (by Jonathan Westhues)
See the attached example.

The program accepts two sets of inputs. Xfaster and Xslower determine the speed, and could go to pushbuttons. A rising edge on Xfaster increases the stepper speed by one unit, and a rising edge on Xslower decreases it by one unit.

The maximum possible speed is 1/Tcycle steps per second; so with a 10 ms cycle time, for example, that's 100 steps per second. The minimum possible speed is zero. I chose arbitrarily to represent the maximum speed as 20, and the minimum as 0.

Xforward and Xreverse determine the direction of the motion. If both are false (or both are true) then the motor is stopped.

Every cycle, an accumulator is incremented by the speed. If the accumulator is greater than 20, then we take a step in the requested direction. So if the speed=20, then we always take that step. If speed=10, then we take the step every other cycle. If speed=19, then we almost always take the step, but we skip 1/20 of the cycles.

Note that this introduces phase noise (or, equivalently, jitter) on the motion of the stepper motor. If you're ramping the motor to run faster than the pull-in speed (i.e., run faster than you could starting from a dead stop), then this is unacceptable. In that case, it would be better to set your maximum step rate to something much less than 1/Tcycle, and choose a faster cycle time to compensate. This helps because the jitter is not as great when the step period is long compared to the cycle time.

(This is a fundamental problem with any system that tries to synthesize a frequency f_out by dividing down some other frequency f_in that is not an integer multiple of f_out. Such a system is often called a "direct digital synthesizer", or a DDS, and they all generate phase noise in varying amounts. In general, the closer f_out is to f_in, the greater the phase noise.)

(Our system divides f_in by either m or (m+1), and alternates between those short and long periods so that the frequency, on average, is correct over time. So if speed=19/20 = 0.95, then the period is 1.05 cycle times, and we alternate between a period of 1 and 2, and we have jitter in the period of 2:1. If speed = 3/20 = 0.15, then the period is 6.67, and we alternate between periods of 6 and 7, and the jitter is just 7:6, or approximately 1.2:1; one fifth as much.)

The stepper motor has two windings, spaced ninety degrees apart. (Or they would be, if the stepper motor made one revolution per step. In fact, a typical stepper motor requires many steps to make a full revolution, so there is some integer scale factor between electrical and mechanical phase.) To drive them, we should apply currents that are also ninety degrees apart in phase, like

I_0(t) = I*cos(omega*t)
I_90(t) = I*cos(omega*t + 90 degrees)

We approximate that as the sequence (I_0, I_90) = (1, 1), (1, -1), (-1, -1), (-1, 1), (1, 1), ... This is a quadrature sequence, or a 2-bit Gray code. A half-stepping or micro-stepping controller would approximate the ideal sine waves more closely, but this is good enough.

The program assumes a unipolar stepper motor. This is a motor where each of the two windings is center-tapped. So there's three wires per winding, so this is a six-wire stepper. In some cases, the manufacturer will tie the two center taps together, and call it a five-wire stepper; but that doesn't change anything for us.

We apply our positive voltage rail to the center taps of the coils. Then by grounding the left side of the coil, we can make current flow one way, and by grounding the right side, we can make current flow the other way. So we place four low-side switches--like n-FETs, or NPN transistors on those lines. The Ycoil... outputs are designed to drive those low-side switches.

The same program could be used with bipolar (no center tap on the windings) motors; it would just be necessary to make those output signals drive whatever H-bridge you were using.
Sat May 1 2010, 14:19:50, download attachment stepper-motor.ld
Post a reply to this comment:
Your Name:
Your Email:
Subject:
(no HTML tags; use plain text, and hit Enter for a line break)
Attached file (if you want, 5 MB max):