Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Controlling stepper motor speed (microstepping)

Status
Not open for further replies.

Eight

Member level 2
Joined
Mar 8, 2013
Messages
53
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
2,084
Hello,

I am curious about something. Recently I bought a small bipolar stepper motor and a driver that supports microstepping. This driver has 4 outputs (2 outputs and 2 inputs actually) that can be directly connected to a bipolar stepper. It can also take digital input via simple IO pins - three of them are used to configure microstepping, one is for configuring direction, and the last one is used for steps. For each rising edge the driver will increment its step index by one, so technically we can use a PWM generator to control the rotation speed. I am going to use an atmega microcontroller to generate PWM, and control the rest of the IO pins. This means I have control over microstepping as well as the PWM frequency.

My question is how to finetune/optimize the motor rotation. Depending on the required speed, what settings should I use? Should I simply use a certain frequency with no microstepping enabled, or should I double the PWM frequency, and enable 1/2 microstepping? Should I quadruple the frequency, and use 1/4 microstepping? What about other slower/faster speeds? Is there any cookbook approach to calculating the parameters for a given speed? I hear it's best to use no microstepping for high rotation speeds. The stepper motor is going to be used to drive a small peristaltic pump.

Thanks for any help!

EDIT: This is the driver: https://www.pololu.com/product/2133
 

No, you can't "use PWM generator to control rotation speed". Since PWM is a CONSTANT FREQUENCY, if you use the PWM output you will get a CONSTANT SPEED. That's not what you want. Remember, PWM varies the duty cycle, not the frequency.

As far as the rest of your questions, there no way to answer them-it all depends on the dynamics of your system-there's no cookbook approach. Microstepping will give you smoother performance and may help to minimize resonance problems. However, for high speeds you will need a higher input step rate than if you use full step mode. You can accelerate using microstepping and then switch to full-step when you are at constant speed.
 

Thanks for the input.

What you say is true for normal and fast PWM. However Atmega microcontrollers also have the ability to change a timer's upper bound under certain PWM modes i.e. CTC or Phase-correct PWM. This means we can directly influence the outgoing PWM frequency rather than duty cycle. So I can easily change that TOP register and slowly fade the frequency in or out. The thing about microstepping was that I heard it lowers the torque. I'm unsure what torque my pump requires, as I haven't assembled the device yet, but I am programming the controller in advance. My worry was exactly about resonance - at low speeds I will get pulsating instead of steady flow, if I don't use microstepping.
 

PWM is pulse width modulation. You are talking about a variable frequency pulse generator. Strictly speaking it hasn't to do with PWM.
 

Yeah, sorry about that. The datasheet refers to it as PWM, so I kept the term. Setting the PWM to "Phase and frequenty correct" PWM (type 9), and the output compare mode to 1 (toggle) will generate a pulsed output that is equivalent to that of a PWM with 50% duty cycle. The frequency can be easily changed by editing the TOP variable (OCR1A) of the timer1. See page 136 in the atmega328 datasheed here: http://www.atmel.com/Images/doc8161.pdf


I'll do some experimenting then. I'll use a 20 MHz crystal and a 64 prescaler.
Without microstepping this should give me the slowest rotation speed for a 200-step stepper motor:

RPM = (Xtal_Frequency * 60) / (2 * Prescaler * Microstepping * TOP * 200)
RPM = (20000000 * 60) / (2 * 64 * 1 * 65536 * 200) = 0.715255737
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top