I'm pulling my hair out. I have been working on a project on and off for a few months and am still at the very beginning. At this point, I would just love to see my stepper motor just spin once. Let me tell you what supplies I am using and how everything is set up.
Uno R3 board
SainSmart L293D Motor Drive Shield For UNO R3
Stepper Motor - NEMA 14
My motor is a 4 lead bi-polar stepper motor. Here is the diagram I got with it:
I have the red wire into M1, blue and black into grd, and green into M2. I think this may be where my issue is but I have tried every combination with the same results.
I have also included the AccelStepper.h and AFMotor.h library. I am trying to run the basic stepper example included in Arduino..
/*
Stepper Motor Control - speed control
This program drives a unipolar or bipolar stepper motor.
The motor is attached to digital pins 8 - 11 of the Arduino.
A potentiometer is connected to analog input 0.
The motor will rotate in a clockwise direction. The higher the potentiometer value,
the faster the motor speed. Because setSpeed() sets the delay between steps,
you may notice the motor is less responsive to changes in the sensor value at
low speeds.
Created 30 Nov. 2009
Modified 28 Oct 2010
by Tom Igoe
*/
#include <Stepper.h>
#include <AccelStepper.h>
#include <AFMotor.h>
const int stepsPerRevolution = 200; // change this to fit the number of steps per revolution
// for your motor
// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8,9,10,11);
int stepCount = 0; // number of steps the motor has taken
void setup() {
// nothing to do inside the setup
}
void loop() {
// read the sensor value:
int sensorReading = analogRead(A0);
// map it to a range from 0 to 100:
int motorSpeed = map(sensorReading, 0, 1023, 0, 100);
// set the motor speed:
if (motorSpeed > 0) {
myStepper.setSpeed(motorSpeed);
// step 1/100 of a revolution:
myStepper.step(stepsPerRevolution/100);
}
}
At this point I am so frustrated and can't figure this out. I keep reading books, different articles, tutorials, and nothing is getting my motor to spin once. If anyone has any suggestions please do not hesitate to let me know, I could really use the help!
This link is to the Adafruit site. Seems to be the same board. There is a section on connecting a stepper. Your present wiring is wrong. None of the motor wires go to ground.
This link is to the Adafruit site. Seems to be the same board. There is a section on connecting a stepper. Your present wiring is wrong. None of the motor wires go to ground.
Thank you! I assumed it was the wiring that was the issue. I'll give this a shot and report back!
3rd Edit - I got it to work!!! kind of. When I run sketches that are already made the only one that works is the constant speed sketch within the AFMotor libraries. When I run anything that is premade within the Arduino software I do not get any feedback from the motor. The same can be said when I run sketches within the AFmotor libraries that runs random speeds or a set number of moves forward and back-words.
Exactly which stepper motor do you have? Most bipolar motors are simply not
suitable to drive from a motor shield (they need chopper drivers), many people
keep trying this without asking for advice before buying motors - a low
impedance bipolar stepper motor is not one you can power from a L298 or L293
based H-bridge motor shield.
MarkT:
Exactly which stepper motor do you have? Most bipolar motors are simply not
suitable to drive from a motor shield (they need chopper drivers), many people
keep trying this without asking for advice before buying motors - a low
impedance bipolar stepper motor is not one you can power from a L298 or L293
based H-bridge motor shield.
I have this motor right here.. https://www.inventables.com/technologies/stepper-motor-nema-14
I made a thread a few months ago and took feedback from a few members in the community; this setup is what they recommended I get.
The motor has 2.7 ohm windings and will not work with the L293D driver board. You did not get good advice. How are you trying to power this motor (hopefully not the Arduino 5V)?
You need a chopper driver like the A4988 or DRV8825 from Pololu Pololu - Stepper Motor Drivers, set for 1 ampere/winding and a decent power supply, like 12V 2 amps or so.
Jrnation109:
I have this motor right here.. https://www.inventables.com/technologies/stepper-motor-nema-14
I made a thread a few months ago and took feedback from a few members in the community; this setup is what they recommended I get.
They should also have recommended Pololu A4988 driver boards or similar.
[ edit: found it - you were explicitly recommended the EasyDriver board, which is a bipolar
stepper driver akin to the A4988 Polulu one, although the discussion varied over various
different kinds of motors and so on. ]