Hi, let me forst apologise if this is an exceptionally easy fix, I am very new to this.
I am trying to control a Nema 17 Stepper Motor with an Arduino Uno.
My setup is a L298P Motor shield Attached to an Arduino Uno
The Stepper is a 17HS3417 Oukeda Nema 17 Stepper Motor
I have a 12v 7 amp Power supply attached to the VMS and Gnd of the Motor Shield and the 4 Wires from the Nema attached to Motor A and Motor B of the Shield.
I have attempted to use the sampel stepper One.Revolution code that is build into the Arduino IDE.
When I upload thew code, the stepper seems to make a buzzing noise as if it is trying to move but it does not move, I have attempted a variety of 'samplke codes' and they all result in the stepper buzzing and almost moving but no actual movement.
Things I have tried:
-Buzzed out the 4 cables from the Nema to make sure ther pair are correct
-Swapped out for a new Nema 17
Swapped the Motor controller for a L298 Motor Driver
Swapped the 4 wires to the nema in all possible combinations for Motor A and Motor B on the driver board
Swapped tor Nema for a standard DC motor (it spins as expected with the sample code)
So I think it is safe to assume the wiring is correct and its a code thing seeing as the only wiring to change is the 4 wires from the Nema and I have tried all possible combinations of the 4.
Welcome! Post an annotated schematic, not a frizzy showing exactly how you have wired it. It sounds like a hardware problem to me. Now looking at the code you did not post I see where your code is trying to drive a Nema 17 induction motor that has 9 leads. When you post your code and schematic be sure the schematic shows all connections, power, ground and power sources.
Attached is my attempt at a schematic. (Apologies if it is not professional,)
There is only the one power and ground source as the Hat has a jumper that provides power to the Arduino.
I didn't attach thew code as it is the default sample code in the Arduino IDE and thought that might be redundant, but here it is.
/*
Stepper Motor Control - one revolution
This program drives a unipolar or bipolar stepper motor.
The motor is attached to digital pins 8 - 11 of the Arduino.
The motor should revolve one revolution in one direction, then
one revolution in the other direction.
Created 11 Mar. 2007
Modified 30 Nov. 2009
by Tom Igoe
*/
#include <Stepper.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);
void setup() {
// set the speed at 60 rpm:
myStepper.setSpeed(60);
// initialize the serial port:
Serial.begin(9600);
}
void loop() {
// step one revolution in one direction:
Serial.println("clockwise");
myStepper.step(stepsPerRevolution);
delay(500);
// step one revolution in the other direction:
Serial.println("counterclockwise");
myStepper.step(-stepsPerRevolution);
delay(500);
}
Got a datasheet for that 17HS3417 motor.
Nema 17 is only a mechanical specification (1.7" mounting plate).
17HS motors are usually low impedance (~3 Ohms/1.7A).
The L298 is totally unsuitable for those kind of motors.
You need a current controlling driver with these kind of motors, like the DRV8825.
And a proper accelerating library like Mobatools or AccelStepper.
Leo..
Wow, that article was incredibly helpful, have no idea how I didn't stumble upon it in my searches.
It basically confirmed what had been mentioned above. using AccelStepper I can get the stepper to work but as the driver board is really not rated for it, any force on it and it skips steps. But at least it works enough for me to now order the right driver board and I can continue programming the rest of the features while I wait.
Thanks so much for the post, I was pulling my hair out.
In what way.
That shield is based around an inefficient old brushed DC motor driver.
The same dinosaur L298 chip as you use now.
Which is not suitable for most modern stepper motors.
That shield only sort off works with high impedance (30 Ohm) motors, not meant for torque at higher speeds.
What you need to buy depends on the coil resistance of the motor you have.
Leo..