Cannot increase speed of stepper motor using PWM

Hello,

I'm running a 125 oz in stepper using G214 (Geckodrive) which is running fine, except max RPM I get is pretty slow - like maybe 50 rpm. I'm using a program that does this:

digitalWrite(stepPin,HIGH);
digitalWrite(stepPin,LOW);

Which is looped, and won't go any faster obviously... I'm sure the motor and drive can handle a lot more, any tips? Thanks

Shawn

edit: btw, running full step mode (400 pulses per rev)

Consult the manual for the motor driver.

Those two statements alone, if looped, would be executed around a hundred thousand times per second, so that is NOT your problem.

According to Marcus at Gecko the Arduino is the problem. Not getting a high enough frequency coming out. Recommended using a blink command or otherwise going deeper into the Arduino.

According to the DMM the step pulse is 400 hz. Would be happy to get output of couple thousand times a second.

Just ran the very simple sketch on my Uno, each hi-lo period is just over 10 microseconds on my scope, which comes out to a little over 96,000 steps per second. I don't know of any hobby type steppers that can respond to that high of a rate.
However...
Because digitalWrite() has some overhead that slows it down you can toggle that pin directly. There is a library, FastGPIO by Pololu which will let you do that. You will find it under Manage Library.

Cannot increase speed of stepper motor using PWM

Stepper motors don’t use PWM, at least not to control the speed. You can use PWM for microstepping (making fractions of a step).

You control the speed of a stepper motor by how fast you step it. The motor itself also has limitations and it depends on the load (including the inertia). In some applications you may have to start slow and accelerate (and decelerate in a similar way).

According to Marcus at Gecko the Arduino is the problem. Not getting a high enough frequency coming out. Recommended using a blink command or otherwise going deeper into the Arduino.

The Arduino can send-out pulses WAY faster than a stepper motor can go.

You need some timing in your code to tell the motor how fast to step.

I don’t know anything about the driver you’re using, but there are two coils in a stepper motor so usually it takes two Arduino outputs to sequence the coils and step the motor one direction or the other. (Your code only uses one step pin.)

According to the DMM the step pulse is 400 hz

Maybe your meter isn’t telling you the truth, or maybe you didn’t show us your whole program? You don’t show any timing or anything that would “slow-down” your program.

There is an [u]Stepper Motor Library[/u].

P.S.

According to Marcus at Gecko the Arduino is the problem.

Actually, he’s probably right… It’s not the driver or the motor… it’s the Arduino … including the firmware. :wink:

According to Marcus at Gecko the Arduino is the problem. .......

Total and absolute rubbish. Marcus is an idiot.

The problem is the voltage you are driving the motor's coils with. Your motor driver might stop you from applying a voltage sufficiently high enough.

the voltage I drive the motor coils has nothing to do with it. The G214 takes 2 pins - step and direction. Spoke on the phone and he predicted a 400 hz output on the step in which is shown on the meter. Looks like the pins will have to be driven manually. the G214 is a stepper driver that does all the stepper logic and driving and stepper library probably won't work for it from what I've seen. There is no timing in my code; its a high low pulse that goes as fast as the arduino will allow which internally maybe a lot but obviously the output pins are being slowed down. Will try pulsing the pins using other commands ("hacking") arduino

the voltage I drive the motor coils has nothing to do with it.

Yes it has everything to do with it. Coils are inductive, it takes time to "charge up" the coils. If the voltage is not high enough then their is not enough time before the next coil is turned on. So there is not enough torque to drive the motor under the load, which can be just the rototor. It is called the self stall load.

Anyway you come here asking questions and refuse to believe what someone with over 50 years in electronics is telling you, over some spotty Herbert who can only get a job serving in a shop.

Have some modesty man.

obviously the output pins are being slowed down

No, they aren't.

Have a look at these links. Try the code - it works. if the motor does not move with that code then there is a wiring problem or a power problem.

Stepper Motor Basics
Simple Stepper Code

When you get it working slowly you can alter the value of millisBetweenSteps to try different speeds.

Also look at the AccelStepper library.

Post a link to the datasheet for your stepper motor and give details (volts and amps) of your power supply.

...R

(shs125, non-work account)

Sorry not trying to be rude here but some are flat out wrong.

Look up the G214. It is not like easy stepper or other cheapo drives. My drive and motor are working fine. My frequency counter is showing 400 pulses/sec coming out of the Arduino step pin, which has corresponded to 2 RPM per sec (not the RPM I originally gave but its still slow).

My first encounter with steppers was 10 years ago when I built a CNC machine and have been working with them all that time. I bought the G214 for my employer because of resonance frequency circuitry.

The voltage has nothing to do with it because voltage is the problem of the drive, not logic. The logic end is not putting out the necessary frequency to get RPM. If I had an issue with ramping up and maintaining a high RPM it might be solved by higher voltage but the Arduino is simply not putting out the steps fast enough...

2 revs per sec not RPM sorry unable to make corrections

Can you post more of the code? I posted earlier that when I ran just those two lines you have posted I was getting over 96,000 pulses per second on my scope, yet you say you are only getting 400. There has got to be something in your code that is getting in the way. Are you using a lot of interrupts? Any blocking delays?

Maybe the drive is in microstepping mode.

Anyway you come here asking questions and refuse to believe what someone with over 50 years in electronics is telling you, over some spotty Herbert who can only get a job serving in a shop.

Wonderful abuse!

(and probably deserved)

It made me chuckle, anyway.

Allan

ps shouldn't it be a 'spotty Muldoon'?

Hi,

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

What are you using as a power supply for the stepper motor?
Can you post a lin to specs/data of the stepper motor?

Thanks.. Tom... :slight_smile:

Hi,
How have you set these switches up?
GekkCurrentSet.jpg
and
GekkStepSet.jpg

Thanks… Tom… :slight_smile:

tog1:
Look up the G214.

How are we going to do that when you have not posted a link to its datasheet?

It is not like easy stepper or other cheapo drives.

What is different about it? (Apart from handling higher currents and being more expensive)

...R

shouldn't it be a 'spotty Muldoon'?

I think not. Spotty Muldoon was a specific unseen friend of E.L. Wisty who was a character created created by the late comedian Peter Cook. He was the archetypal dirty old man in a long raincoat.

Where as spotty Herbert I think dates back to the War. The spotty bit makes a reference to an adolescent youth covered in spots. And the Herbert is a general mild derogatory universal name.
A messy Herbert is a name that implies a unkempt untidy individual, normally small children much used by my parents in the 1950s.

Getting back to this particular Herbert. Their is no doubt that the voltage applied to a stepping motor will affect the top speed it can be moved at. That is physics and is indisputable. I think the OP is dismissing this because his hardware is fixed and he knows little about it. Still it would be good to know the voltage feeding the driver and the resistance of the coils.

It is clearly a nonsense to say the code he posted is not capable of more than 400Hz but until complete code is posted that shows the problem we can only speculate what he is seeing. Suffice to say that there is no way it is a limitation of the Arduino itself.

Anyway time to drag this one out again Post your code

The data sheet of the driver can be found here on a link here http://www.geckodrive.com/featured-products/g214-55.html

Things that caught my eye are:-
High Power Operation: Up to 80VDC and 7A with motors from NEMA 8 - 42 - again i wonder what voltage the motor is being driven at.

Multiple Resolution Options: Fourteen selectable resolutions, from half step to 256 microstep, in both binary and decimal. - If the drive is being set to 256 microsteps per step then for a 200 step per revolution motor you would need a 51.2 kHz signal for one revolution per second. So two revolutions per second would a 102.4 kHz signal. Using the digitalWrite function will go faster than this but not much. This speed can be increased 20 to 30 times, if the digitalWrite function calls were replaced by direct port access techniques.Port access

FULLSTEP Reporting: Optoisolated Full-Step output sends a pulse out at every full step location on the motor - I wonder if this is the place where the alleged 400 Hz is being measured?

Again we see an OP not capable of describing his situation leading us all on a merry dance by describing something that simply can not exist.