I am trying to utilize a stepper motor in combination with an arduino uno to move a carriage down a set of rails, similar to how a 3D printer functions. My current issue involves the movement of the stepper motor, when I use the code below the motor makes sound but takes no steps. As such I tested the wiring of my setup by using the second block of code.
The second block of code works and the stepper motor steps forward, but instead of continuously stepping forward it then steps backward an equal amount. The motor also stops stepping and begins to just make noise if the "myStepper.step( VALUE )" VALUE exceeds five.
#include <ezButton.h>
const int BUTTON_PIN = 5; // Start Stop Button
int lastState = HIGH;
int currentState;
int i = 0;
int ii = 0;
// motor code
#include <Stepper.h>
const int StepsPerRev = 200; // NEMA 14 has a step angle of 1.8 which = 200 steps/rev
// rail length = 340mm
// each step is 0.003969mm linearly
const int StepsPerRail = 200; // required steps to travel rail length is 85664, subtracted a few for tolerance
const int Step = 1; // steps motor one step
Stepper myStepper(StepsPerRail, 8,9,10,11);
void setup() {
pinMode(BUTTON_PIN, INPUT_PULLUP); // start/stop button setup
myStepper.setSpeed(550);
pinMode(8,OUTPUT);
Serial.begin(9600);
}
void loop() {
for (int i = 0; i<=500; i++){ //500 is the number of times motor will complete one rail length
Serial.println("clockwise");
for (int ii = 0; i<=StepsPerRail; ii++){ // This loop performs every function at each indiividual step down rail
// Travel Down Rail CW:
myStepper.step(StepsPerRail);
int adc = analogRead(A0); // initializes current variable
float voltage = adc*5/1023.0; // creates voltage variable
float current = (voltage - 2.5)/0.66; // creates current variable
// logic statement to moniter current values
//if (current < 0.15) {
// current = 20;
//}
//Serial.print("Current : "); // displays current reading
Serial.println(current); // displays current reading
delay(1000); // delay in between readings
// Travel up Rail CW:
myStepper.step(-StepsPerRail);
Serial.println(current); // displays current reading
delay(1000); // delay in between readings
}
}
}
#include <Stepper.h>
const int stepsPerRevolution = 200; // change this to fit the number of steps per revolution
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);
void setup() {
// initialize the serial port:
Serial.begin(9600);
}
void loop() {
// step one step:
myStepper.step(5);
delay(500);
}
Is that L293 getting hot and shutting down. What are the specs of the stepper motor? Please post a data sheet. If the data sheet lists more than one motor, please indicate the exact one that you have.
A basic mistake is running motor currents through a breadboard. The conducting rails are designed for such currents, only logic signals or LED currents like 20 mA.
I used breakboard when i was doing perlistic pomp set. I had 15 pumps plugged in and on at the same time, each one was drawing 0,15A and breakboard was barerly warm (i had over 2a on power line on breakboard).
Problem lays mostly in added resistance (my guess). All pomps had bigger flowrate when i changed to normal connection and i was forced to calibrate them again
Maybe it's worth mentioning that I used uno's 5V as input, not output (so 2A wasn't flowing thru arduino, it would propobly destroy it quickly)
According to the SN75441 data sheet the absolute maximum current for the chip is 1A. The motor coil resistance is 2.8 Ohms and the motor supply is 5V so the motor current is 1.8A, substantially more than the 1A (max) of the chip.
That depends on where you set the coil current limit. You must set the coil current limit on the driver. Your stepper can go up to 2A, but you do not have to set it to max. Set the coil current limit to the lowest current that gives you the required performance without missing steps. Lower coil current will make the motor and driver run cooler and last longer.
The A4988 is good for 1A without heat sink and 1.5A with heat sink and fan cooling. The DRV8825 is good for 1.5A with no heat sink and 2A with a heat sink and fan cooling. Both of those drivers need minimum 8V motor supply voltage. Higher supply voltage, up to the max for the driver, will allow more speed and torque.
I think yes, at least almost all of them. Project i wrote about was made on the cheapest breakboard - from beggining part of 'slots' for cables were lose and I trashed it after two projects because project that was wired correctly didn't worked and shaking was fixing it.. I had two of them, second one looked the same but wasn't that bad (still i don't recommend buying them, it's better to buy one 'premium' one and have it for years)
U don't need a lot of metal to transfer 1A over short distance, look how thin jump wires are. Cables are hold by piece of metal and it just can't be made with less material then that because it wouldn't have enough force.
But maybe some of them use shitty metal with very high resistance? It could work like using resistor as heater, so even small loads will have massive loses. I didn't had one like this, but with random factories who knows, maybe they exists
No but good pressure by the contacts. Else heating quickly destroys them.
Telling 1 Amp is okey will not help members.
Where is the 1 A rating documented?
I apologize if this is a stupid question, but if I use one of those drivers would I still be able to power the unit with an arduino Uno? To my knowledge the maximum output of the Uno is 5V.