Go Down

### Topic: Steppermotor library or arduino limitations? (Read 2550 times)previous topic - next topic

#### kkuula

##### Jan 07, 2012, 08:01 pm
Im wondering how fast i can drive a stepper motor with arduino? My test bed contains arduino uno, L298N based dual H-birdge and various bibolar steppermotors.

Am I doing something wrong because in not gettin more than about 1000 steps/sec? First I used steppermotor libary and I thought that library ads some extra complexity to stepping but when exploring that library I found that library isnt complex at all. Then I decided to do same whitout library but that library wont simplify much by doing same things other way. I ended up somewhere same limit about 1000 steps/sec.

Whith that speed cant get enough rpms to my project. Im asking what kind of stepping speeds is possible with arduino when using 4 wire bibolar steppermotor?

#1
##### Jan 07, 2012, 10:18 pm
Get a proper chopper driver chip (built-in phase current control) and increase the supply voltage.

#### dc42

#2
##### Jan 07, 2012, 11:57 pmLast Edit: Jan 07, 2012, 11:58 pm by dc42 Reason: 1
Two issues you need to be aware of when running stepper motors at high speed:

1. You need to increase the speed gradually, not try to go from 0 to 1000 steps/sec or more immediately.

2. At high speeds, the current doesn't have time to build up or decay in the windings because of their inductance. The best solution is a higher voltage supply and a chopper driver chip as madworm suggests (e.g. the L297, which partners well with the L298 - see http://www.technologicalarts.com/myfiles/data/AN470.pdf). If you only need a little more speed, then you can try doubling the supply voltage and putting a resistor in series with each stepper motor winding, where the value of the resistor is equal to the resistance of the winding (this is of course an inefficient way to drive high-power stepper motors). Or you can increase the supply voltage and pwm the windings yourself, although you risk damaging the stepper and/or the L298 if you get it wrong.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

#### kf2qd

#3
##### Jan 08, 2012, 02:21 am
1000 steps / sec ... For full stepping that is 300 rpm, half stepping is 150 rpm, Pretty good speed for a stepper.

#### kkuula

#4
##### Jan 08, 2012, 08:40 am
Ok. Because Im not familiar with stepper motors i wondered low rpms compared to other type of dc motors.  I done some testing and max steps/sec rises almost directly proportional to input voltage.I think In this case speed was limited by motor and/or motordriver and powersource. Of course had to be carefull to not exceed motor and driver max values.

Im interested in what kind of stepping speeds Arduino is capable of? Stepper library itself is quite lightweight, timerinterrupt driven an basicly doin only dosen of digital io writes. Dont know might that be significantly faster in pure avr platform without arduino?

Knowing HWs capapilities might save lot of lab time.

#### sbright33

#5
##### Jan 09, 2012, 07:43 pm
http://www.aliexpress.com/fm-store/315419/211153727-497598231/DC-5V-Gear-Stepper-Motor-4-Phase-Reduction-Step-Motor-Mini-Step-Motor-for-PIC-MCU.html

Can I full step to increase the RPM?
When I step 5.625/64 what is that called?

#### kf2qd

#6
##### Jan 09, 2012, 08:00 pm
It would look like your final number is 4096 steps per revolution of the output shaft.

5.625 degrees = 64 steps. 64 steps / rev * 64:1 gear ratio = 4096 steps. Every 4096 steps fed to the motor should give you 1 rotation of the output shaft.

Steppers are not used as much for rotational speed as for positioning. If you are looking for a fast rotation you should use a DC motor, but you won't have position control.

#### drone

#7
##### Jan 10, 2012, 03:40 pmLast Edit: Jan 10, 2012, 03:43 pm by drone Reason: 1
I have had no issue -sending step signals- at 5,000 steps/second with easing (quadratic or linear), and 10,000 steps/second without easing.  Of course, I have no motors on-hand that can come close to that speed at the 12V I tend to work with.  The primary difference was that instead of using digitalWrite(), I fixed my pins in hardware and used the pin register directly, and used timerone to drive the stepping asynchronously so that I could do other things.  The motion is a little different in that the minimum off-period between steps is fixed (i.e. one cycle of the timer), but to get asynchronous stepping (so I can do other stuff), was more valuable than trying to achieve off periods smaller than the interrupt period.

Of course, it only supports a single motor, so you'd slow down a bit supporting more motors, but for an example of how to do it up to 10,000 steps/second see: http://openmoco.org/docs/OMLibraries/class_o_m_motor.html  The source code can be downloaded from http://openmoco.svn.sourceforge.net/viewvc/openmoco/OpenMocoComponents/nanoMoCo/trunk/Libraries/OMMotor/

It is possible to get quite fast code if you profile your solution and test where the slow parts are.

If you're not able to go faster than 1,000 steps/second, it's likely not a code problem and you should be running a proper chopping driver with the correct voltage and current for your application.

!c

#### kkuula

#8
##### Jan 12, 2012, 08:59 am
That was my first time with stepper motors and by increasing source voltage igot quite easily 3-5000 steps/sec wit random motor. I think motor or L298N based controller was limitin factor. I Measured that arduino is capable of somewere 7-10KHz what is quite alot!

Go Up