Stepper motor issue with 180 degrees

Hi,

So, I have situation like: my stepper motor is working fine when it need to do 360 degrees or 540 or 720 degrees and so on, but if it need to do only 180 degrees, it starts to lose steps, or show strange behavior.

  • M35SP-9T stepper motor;
  • L298N driver for arduino (that red thing from ebay)
  • arduino nano

Some fragments form my code for reference:

#define STEPS 48  // stepper steps count for 360 deg [360/7.5 = 48]
#include <Stepper.h>

Stepper stepper(STEPS, 9, 10, 11, 12);

(...)

int TimelapseProgram(){

(...)

  stepper.setSpeed(576);
  stepper.step(StepsCount); 

//if StepsCount=48 or 72 or 96... - working good; 
//if StepsCount=24 - something is wrong;

(...)
}

Video with the code file:
https://drive.google.com/open?id=0ByDcPWWcDN3oODZsclc4dU5ZVnc

So, I can't understand what could be wrong. Can anybody help me with this?

Thank you.

EDIT:
motor datasheet:
http://www.mitsumi.co.jp/latest/Catalog/pdf/motor_m35sp_9_e.pdf
driver:
http://www.ebay.com/itm/Stepper-Motor-Drive-Controller-Board-Module-L298N-Dual-H-Bridge-for-Arduino-/331838126046?hash=item4d4317f7de:g:IEkAAOSw1DtXGlDY
power supply:
~10V, 1.5 A
in a future planning to use rechargeable battery 12V 7.2Ah Pb CSB

DGTMtLapseSoftware.ino (9.98 KB)

can your stepper really handle 576 rotations per minute or are you pushing it to limits?

Actually I don't know this. Earlier those setting was stepper.setSpeed(200), but the result was the same, so I just looking in experimental way for best setup parameters, but obviously I am doing something not right...
p.s. that relay meant for camera shooter control.

well try to slow it down, not make it go faster.. Do you have the right power for your motor?

what type of camera do you want to drive? are you trying to automate pressing on the shutter button? many cameras have "dumb" wired remote controls to focus and trigger (two wires to join). it's 100% easier and faster to handle it that way

This will be Motorized Timelapse Slider. Long story - short: Arduino will trigger stepper motor and camera shooter. So everything would be fine as it is right now (360 degrees per turn (stepper.step(48);)), but I want to have ability to get more "steps" when camera will be sliding on the rail, what will give me more photos in same distance, that mean I need that my motor would be able work nicely with 180 degrees per turn (stepper.step(24);). And I can't (don't know how) find any useful info in google, way stepper motor having trouble with 180 degrees, no matter what speed parameters will I give...

p.s. the right power.. I was able to find this datasheet: http://www.mitsumi.co.jp/latest/Catalog/pdf/motor_m35sp_9_e.pdf

And currently I am giving only 10-15 V for motor power supply, you think I should give it more?

You need to post a complete program. If stepper.step(48); works properly it is hard to imagine why stepper.step(24); will not.

Post a link to the datasheet for the stepper motor you are using and a link to the datasheet for the stepper motor driver you are using.

Also tell us what motor power supply you are using (volts and amps).

...R
Stepper Motor Basics
Simple Stepper Code

Video to have better understand what I am talking about. Even in this one it is possible to see that stepper is losing steps, what will have negative impact working with this gear...

https://goo.gl/photos/hj8JLRJKaWZCmMRUA

All what you explain feels right for a continuous rotation servo.

when you do

Stepper stepper(STEPS, 9, 10, 11, 12);

you create a new instance of the Stepper class named stepper with STEPS (=48) being the number of steps in one revolution of your motor (which is correct for a 7.5° per step servo - but not very precise)

When you call

stepper.setSpeed(200)

you register a speed value of 200 turns per minute and when you say

stepper.step(24)

the motor will attempt to perform 24 steps (so a half turn) of the motor, at 200 RPM so it would take (60/200) * (24 / 48) = 0,15 seconds.

You cannot set the angle of a continuous rotation servo, you just asks the servo to take steps at a certain speed in two directions or stop it.

Question is do you have a continuous rotation servo or a 180° or 360° limited servo? Are you getting confused by a gear box that would change the visible steps?

PS: seen the video - how heavy is your camera going to be ? do you expect those little plastic gears to be able to reliably move a DSLR or is that for a go-pro?

I have uploaded all my code together with video:

https://drive.google.com/open?id=0ByDcPWWcDN3oODZsclc4dU5ZVnc

please upload code here..

File with code uploaded :slight_smile:
TimelapseProgram() function is having issues when StepsCount = 24

J-M-L,
I will use DSLR camera and I have tested with camera attached as well. It worked perfectly. I even created my first timelapse video with this gear. But when I spotted that stepper motor having issues, can't sleep well anymore :slight_smile:

From the datasheet that is a current-controlled unipolar stepper, so there's no easy way to
drive it properly. Its expecting 400mA drive and supply of 24V plus unipolar chopper drive.

Alternatively you could drive it at 5V and keep it in spec (the windings are 13 ohm), but the
top speed will be 5 times less.

You claim to be using a 10V supply, so you have twice the current and thus 4 times the
heat dissipation in the motor than it is rated for.

Perhaps you should investigate if you can isolate the coils from each other and use a
standard bipolar chopper driver like a DRV8825.

Your video shows a poorly aligned set of gears that will have a cyclically varying mechanical
load on the motor which seems to be borne out by the behaviour. The motor is rated for
a pull-out torque of 0.02Nm, even with that gearing its probably about 0.15Nm to the sprocket.
In particular the sprocket is wobbling about its axis, this needs fixing.

Datasheet: http://www.mitsumi.co.jp/latest/Catalog/pdf/motor_m35sp_9_e.pdf

So, how to explain that stepper.step(48); works good, but stepper.step(24); having issues?

So I figured out the problem.
Since this project is time lapse slider for DSLR, there will be a lot of long delays between stepper.step(StepsCount) command, due to this my motor gets very hot and battery will drain very quickly. To avoid this, every time after stepper.step(StepsCount); I turned off stepper control pins:
digitalWrite(9, LOW);
digitalWrite(10, LOW);
digitalWrite(11, LOW);
digitalWrite(12, LOW);
Due to this when stepper.step(StepsCount); StepsCount is only 24, my motor started to show strange behaviour, if I delete those 4 lines, everything working smoothly. But this is not suitable for me, because, as I mentioned, my motor stays active and this leads to overheating and fast battery drain.

Will continue with finding optimum solution for this case and let you know.

Rather than saving power by writing all the pins LOW and thereby upsetting the progression of steps I reckon you should use a relay to turn off the power for the motor.

,,,R

Actually this is a very good idea, thank you! Will try to do this :slight_smile:

Hi Denisas!

I think the point is current flowing through the motor. I had similar issues with my bipolar stepper. The motor missed steps and didn't work properly until I set correct motor current at driver PCB (DRV8825). So the reason of overheating and battery drain is big current flowing through the motor.

Look at MarkT's post at 1st page.