Hey I am new to this project, and I am looking for some advice. I am using an arduino uno, a L293d Shield and a NEMA 17 motor. There are a couple of problems im having;
Motor runs very slowly
motor stays on and gets hot
I have a sample program that runs the motor at a good speed, its below. I change all the parameters in your code but it doesnt seem to help much, I am getting about 2 steps a second at the fast setting. Also the medium rate goes faster than the fast rate.
Thanks
-Aaron
// Adafruit Motor shield library
// copyright Adafruit Industries LLC, 2009
// this code is public domain, enjoy!
include <AFMotor.h>
// Connect a stepper motor with 48 steps per revolution (7.5 degree)
// to motor port #1 (M3 and M4)
AF_Stepper motor(200, 1);
void setup() {
Serial.begin(9600); // set up Serial library at 9600 bps
Serial.println("Stepper test!");
Hi Aaron
I have attched here v245 for you to test.
Notes:
Connect stepper motor to controller. Connect controller to computer using USB cable. Turn on 12V for stepper motor. Load arduino IDE. Start Windows app but do not connect
Change the line 134 to match your stepmode setting and stepper type. You should only use 1 step mode, calculated from the CFZ, refer PDF for details. If you cannot calculate this, please send me your stepper motor model as well as scope details (FL and FR).
After making change to firmware file, program the controller
Wait for upload to complete
Goto windows app and connect to controller
After connected
Set motor speed change enabled to DISABLED
Set motor speed to fast
Set lcd page display time to 2000
Set maxsteps to 1000
Set focuser position to 5000
Set coil power to ON
Click +500 and see how fast the speed is
The speed of the motor should be smooth, not sounding rough
Remember the fast speed should not be like a bullet - you want a smooth rotation of about 1s max for 500steps
If its too fast or too slow, then
Adjust one speed setting at a time.
Windows app - Disconnect from controller
Change MotorSpeedFast value in arduino firmware (line 144) - use small values like add 10 or minus 10
Reprogram controller
Wait for upload to complete
go back to step 4 and repeat
Next do the speeds medium and slow.
NOTE: You should only ever be using one step mode - the speed settings are only valid for one step mode and are not valid for other stepmodes. You also need the setting on Line 134 to be accurate for your system.
Let me know how it goes
Cheers
Robert
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Aaron
For the stepper overheating, ensure the windows application has CP off.
When stepping CP is on (else stepper will not step) = at end of move stepper power is released.
What stepper motor are you using and what power voltage to the stepper are you using?
Robert
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you very much its working, so far. I am going to be hooking up the lcd screen, home switch, and temperature probe soon. I will let you know if something goes wrong. I have a couple things to ask about.
include <AFMotor.h>
// Connect a stepper motor with 200 steps per revolution
// to motor port #1 (M1 and M2)
AF_Stepper motor(200, 1);
void setup() {
Serial.begin(9600); // set up Serial library at 9600 bps
Serial.println("Stepper test!");
motor.setSpeed(50); // 50 rpm
See in this example it calls AF_Stepper, then it uses the command AF_Stepper motor(200,1). But your code does not use this, instead you do motor speed. My question is how do you go from one to the other.
Another question I have is Is it possible to upgrade to the Mega without much trouble?
I'm still confused about the syntax. The example programs in the AFmotorfolder do not use the mystepper command. If I run through the example AFmotor code, and change the values, the motor moves as expected. I can change the number of steps per revolution, the speed, and mode, all works as expected.
I still get strange behavior using your sketch. The last test, i selected motor speed medium (was high), then told it to go -500 steps. It did this, then went at low motor speed from the current position, about 6100, to 10,000 and stopped there. If I tell it to go -500 steps, it does, then goes back to 10,000 at low speed by itself. It will not halt until this long move is complete, at 10,000
When I change the motor speed to high, and tell it to go -500 steps, it does, then comes back to 10,000 with no input or pause
I have seen it work correctly as well, at least for a few commands.
This session, it worked strangely, then correctly, then this odd moving back to 10,000 behavior.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hey I am new to this project, and I am looking for some advice. I am using an arduino uno, a L293d Shield and a NEMA 17 motor. There are a couple of problems im having;
Motor runs very slowly
motor stays on and gets hot
I have a sample program that runs the motor at a good speed, its below. I change all the parameters in your code but it doesnt seem to help much, I am getting about 2 steps a second at the fast setting. Also the medium rate goes faster than the fast rate.
Thanks
-Aaron
// Adafruit Motor shield library
// copyright Adafruit Industries LLC, 2009
// this code is public domain, enjoy!
include <AFMotor.h>
// Connect a stepper motor with 48 steps per revolution (7.5 degree)
// to motor port #1 (M3 and M4)
AF_Stepper motor(200, 1);
void setup() {
Serial.begin(9600); // set up Serial library at 9600 bps
Serial.println("Stepper test!");
motor.setSpeed(50); // 100 rpm
}
void loop() {
Serial.println("Single coil steps");
motor.step(200, FORWARD, SINGLE);
motor.step(100, BACKWARD, SINGLE);
}
Hi Aaron
I have attched here v245 for you to test.
Notes:
Connect stepper motor to controller. Connect controller to computer using USB cable. Turn on 12V for stepper motor. Load arduino IDE. Start Windows app but do not connect
Change the line 134 to match your stepmode setting and stepper type. You should only use 1 step mode, calculated from the CFZ, refer PDF for details. If you cannot calculate this, please send me your stepper motor model as well as scope details (FL and FR).
After making change to firmware file, program the controller
Next do the speeds medium and slow.
NOTE: You should only ever be using one step mode - the speed settings are only valid for one step mode and are not valid for other stepmodes. You also need the setting on Line 134 to be accurate for your system.
Let me know how it goes
Cheers
Robert
Try this version please
Aaron
For the stepper overheating, ensure the windows application has CP off.
When stepping CP is on (else stepper will not step) = at end of move stepper power is released.
What stepper motor are you using and what power voltage to the stepper are you using?
Robert
Thank you very much its working, so far. I am going to be hooking up the lcd screen, home switch, and temperature probe soon. I will let you know if something goes wrong. I have a couple things to ask about.
include <AFMotor.h>
// Connect a stepper motor with 200 steps per revolution
// to motor port #1 (M1 and M2)
AF_Stepper motor(200, 1);
void setup() {
Serial.begin(9600); // set up Serial library at 9600 bps
Serial.println("Stepper test!");
motor.setSpeed(50); // 50 rpm
See in this example it calls AF_Stepper, then it uses the command AF_Stepper motor(200,1). But your code does not use this, instead you do motor speed. My question is how do you go from one to the other.
Another question I have is Is it possible to upgrade to the Mega without much trouble?
Have you also seen this motor driver? It is much more powerful and is up to current standards.
https://www.adafruit.com/product/1438
The statement
AF_Stepper motor(200, 1);
is the constructor which creates a stepper object called motor.
motor.setSpeed(50); // 50 rpm
is a call to a method setSpeed for the stepper object called motor.
In the L293D_F firmware this is
AF_Stepper mystepper(stepsPerRevolution, Motor_Port);
and
mystepper.setSpeed(motorSpeed);
About the motor shield - the L293D is on ebay for little $, helps keep the cost down and is easy to use.
I'm still confused about the syntax. The example programs in the AFmotorfolder do not use the mystepper command. If I run through the example AFmotor code, and change the values, the motor moves as expected. I can change the number of steps per revolution, the speed, and mode, all works as expected.
I still get strange behavior using your sketch. The last test, i selected motor speed medium (was high), then told it to go -500 steps. It did this, then went at low motor speed from the current position, about 6100, to 10,000 and stopped there. If I tell it to go -500 steps, it does, then goes back to 10,000 at low speed by itself. It will not halt until this long move is complete, at 10,000
When I change the motor speed to high, and tell it to go -500 steps, it does, then comes back to 10,000 with no input or pause
I have seen it work correctly as well, at least for a few commands.
This session, it worked strangely, then correctly, then this odd moving back to 10,000 behavior.
Hmmm - I suspect you have enabled the HOME POSITION CODE and do not have a valid home position switch fitted.... Could this be the case?