I am a bit confused. Currently, I am working on a project that uses Arduino Uno, an EasyDriver, and a stepper motor. The stepper motor is attached to a metal plate that will cover a camera lens at certain times.
When I would first run the code, the stepper motor would turn just fine, as it was supposed to. A few days later it seemed to be fighting to rotate and now, it doesn't seem to respond at all. I did change the code a bit so in order to make sure it wasn't an issue with the code I ran other people's test codes for stepper motors controlled by an Arduino. Still nothing happened/I got no response from the stepper motor.
Is it normal for a stepper motor to just go bad? I know it's wired correctly because, like I said, it worked before and I have not touched the circuitry. Any suggestions would be greatly appreciated.
Which motor? What power supply are you using to the EasyDriver? Have you checked it is
adequate for the load? Have you measured its voltage when in use for instance?
Stepper motors have nothing to go wrong - after years of use a bearing might sieze up if you
are very unlucky. One loose connection in the motor wiring however and you may fry the
EasyDriver though, the motor is highly inductive so you have to ensure solid connections and
never unplug it when the driver is powered up (that's a classic way to blow a motor driver)
The motor is a Mercury Motor SM-42BYG011-25 16/2011. Originally when it turned it was only hooked up to the computer via USB and worked fine. Also, I have not measured its voltage while it is in use.
I haven't unplugged it directly while it was powered on, it's a pretty simple set up (not mine originally).
The usual advice. Post your code. And tell us what power supply you are using for the motor (volts and amps).
I have some of those motors. Try this simple stepper code. However the Easydriver defaults to microstepping and my code assumes full steps so you may need to increase the number of steps in the code.
That's a 12V motor, so you'll need 18V or more to drive it properly from a chopper driver - you haven't
said what voltage your power supply for the thing was...
Let me clarify, when this motor first functioned properly I used no external source (just plugged the Arduino into the computer via USB). All was fine. Then it seemingly began to weaken, after several weeks so I figured it would be good to use an external source. The external source I used has the following specs:
center positive
output:12V dc and 600 mA
After using this power supply, still nothing happened. Could I have made it worse or fried something? Why would it have worked before on just USB power and now seems to be struggling?
I tried your example code (the corrected version which you posted) and nothing happened when I compiled the code. Is there something I could be missing?
Thank you again for your advice and patience everyone.
babycoder:
Let me clarify, when this motor first functioned properly I used no external source (just plugged the Arduino into the computer via USB). All was fine. Then it seemingly began to weaken, after several weeks so I figured it would be good to use an external source. The external source I used has the following specs:
center positive
output:12V dc and 600 mA
Before looking at the code I need to clarify this.
It sounds as if you are saying that the Arduino and the motor were powered from the computer USB connection.
I find that very hard to believe. It may well have caused damage to the Arduino.
Then it sounds like you disconnected the Arduino from the USB connection and powered the motor and the Arduino with a 12v supply plugged into the Arduino barrel jack.
If neither of these interpretations is correct, please provide a better description of both situations. The best thing, by far, would be to make pencil drawings showing all the connections and post photos of the drawings.
I think these attached drawings will be much clearer! Is it possible that I should re-solder? Some connections could have come loose although they don't seem it. I haven't changed the wiring from when this actually worked, so I'm not sure my problem lies in the wiring.
Perhaps the issue lies in the code? I'm not sure. Hopefully these drawings give you a better overall picture of what I have going on.
Sorry for the confusion/annoyance, I just figured I'd provide a key in case too many things in the drawing got cluttered. Also, I could not get it all in one picture without it being super small, so I took several.
M+ is the power input to the Easy Driver. RAW is like the VIN pin/raw input voltage.
I am using a 12 V, 600 mA power supply. Before, this external power supply seemed unnecessary as everything once functioned properly with only the Arduino Uno connected to the computer via USB.