Hi everyone! This is our first post… we are two unexperiences guys trying to move 5 steppers Nema 17 with a ArduinoMega 2560 controlled by a webcam programed in processing with serial comunication… We knew it wasnt going to be easy but this is getting hard for us…
Nowadays we are trying to controlled just one [/url] Nema17(42SHD0001)12 V 0.4A. Feeded with a 12V 1A transformer conected throug a capacitor of 100 microfarads and controlled by a DRV8852. The driver has a SMD R100 resistance. Acording to the manual of the driver we have adjusted the potenciometer following the next ecuation:
Vref=Imax5Rs
in our case:
Rs= R100 (SMD calculator says 0.1ohm)
Imax= 0,4 A
Vref=0,14 V
Is it a problem of the current?
We have tried a few very simple codes with and without Accel.stepper library. This is the one that works better but not smooth at all… It roughtly does some steps foward and backwards
Here is the Code:
#include <AccelStepper.h>
#define STEPPER1_DIR_PIN 9
#define STEPPER1_STEP_PIN 8
// The Y stepper pins
// Define the steppers and the pins
AccelStepper stepper1(AccelStepper::DRIVER, STEPPER1_STEP_PIN, STEPPER1_DIR_PIN);
void setup()
{
stepper1.setMaxSpeed(100.0);
stepper1.setAcceleration(200.0);
stepper1.moveTo(100);
}
void loop()
{
// Change direction at the limits
if (stepper1.distanceToGo() == 0)
stepper1.moveTo(-stepper1.currentPosition());
stepper1.run();
}
Are you powering that motor through the Arduino? That’s going to eventually make smoke. The stepper needs it’s own power supply. The regulator on the Arduino board can’t handle that sort of current.
thanks for the answers! we are not powering the motor through the mega. We have already checked your complete guide of stepper motors Robin2 and the DRV8825 Pololu info but we are almost sure it is a circuit problem..
Do you know any reliable example?
It will be easier to help when you are using an example I am familiar with.
Make a simple pencil drawing showing all the connections and post a photo of the drawing. It is not possible to understand your connections reliably from a photo of the hardware.
This
This is the one that works better but not smooth at all.
does not describe what happens sufficiently clearly
the motor is getting stucked, after recieving violent pulses and the stepper is heating up. as we can see in the video
both motors in the video are wired independently sharing the ground and the power supply. For the video we used the code already posted just for one motor.
Our apollogices robin2, we had it already..
Here is the video of the Nema17 with your Basic stepper code
It seems for us it is hardware problem... probably related to the motor driver...
Thank you Robin2! Its working properly!! Looks like the DRV8825 of the first video is burned… wish we contacted you before… Here is the last video
Our wiring diagram is the same as the Alternative minimal wiring diagram of the official Pololu website with the mentioned 12V 1A power supply and a 16V 100uf capacitor
Here is the code adapted to the 200 stepsperrevolution of our Nema17
// testing a stepper motor with a Pololu A4988 driver board or equivalent
// on an Uno the onboard led will flash with each step
// this version uses delay() to manage timing
byte directionPin = 7;
byte stepPin = 6;
int numberOfSteps = 200;
byte ledPin = 13;
int pulseWidthMicros = 20; // microseconds
int millisbetweenSteps = 250; // milliseconds - or try 1000 for slower steps
void setup() {
Serial.begin(9600);
Serial.println("Starting StepperTest");
digitalWrite(ledPin, LOW);
delay(2000);
pinMode(directionPin, OUTPUT);
pinMode(stepPin, OUTPUT);
pinMode(ledPin, OUTPUT);
digitalWrite(directionPin, HIGH);
for(int n = 0; n < numberOfSteps; n++) {
digitalWrite(stepPin, HIGH);
delayMicroseconds(pulseWidthMicros); // this line is probably unnecessary
digitalWrite(stepPin, LOW);
delay(millisbetweenSteps);
digitalWrite(ledPin, !digitalRead(ledPin));
}
delay(3000);
digitalWrite(directionPin, LOW);
for(int n = 0; n < numberOfSteps; n++) {
digitalWrite(stepPin, HIGH);
// delayMicroseconds(pulseWidthMicros); // probably not needed
digitalWrite(stepPin, LOW);
delay(millisbetweenSteps);
digitalWrite(ledPin, !digitalRead(ledPin));
}
}
void loop() {
}
Any reliable examples to optimice the steppers torche and speed? Thinking in our next step hehe (controlling 5 Nema17 at the same time) Should we used the AccelStepper library? Do you recomend us starting with this example ?
It depends on what you want to do with 5 steppers. If you want them all turning funny-looking clock hands at different speeds on an art project then AccelStepper is one good way to do it.
If you want them moving in perfect synchronisation for a 3D printer or other CAM machine, then you have a lot more work ahead of you.
What we exactly want to do is to control the five steppers indiviadually, in a range of 800 steps, within five prefixed positions in that range. The stepper should be capable of moving between these positions no matter in which position was. The steppers are pulling from a flexible textile, so dont need so much torche.
If we have 5 steppers, A, B, C, D, E and 5 positionts . For example, the situations atached in the hand drawing can ocurr. Should we use the accelstepper library.
Which is the best way to feed the circuit? shoul we use more voltage?
How can we turn off and on the hole circuit? are the sleep and reset pins of the drv8825 necessary?
Even if I turn my laptop on its side I can't make sense of that drawing.
From Reply #14
What we exactly want to do is to control the five steppers indiviadually, in a range of 800 steps, within five prefixed positions in that range
Does this mean that at any one time only one motor will need to move? That greatly simplifies things.
Have a go at writing the program to make 2 motors (out of the 5) work and see how you get on. If it works add a 3rd etc. If it does not work then post your program and explain what it actually does.
electroskin:
Which is the best way to feed the circuit? shoul we use more voltage?
How can we turn off and on the hole circuit? are the sleep and reset pins of the drv8825 necessary?
12V is usually pretty good to feed average NEMA-17 motors. More voltage means they can step faster - they don't have any more torque or holding power.
A switch?
You can hardwire sleep and reset to 5V or 0V as appropriate. Or you can have them controlled by the Arduino. That way you can cut power consumption without turning the whole circuit off.