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;
(...)
}
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...
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...
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?
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
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.
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.
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.