Menu

Help with slow moving motor

2016-08-11
2016-08-16
  • Aaron Sliski

    Aaron Sliski - 2016-08-11

    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);

    }

     
    • brownrb

      brownrb - 2016-08-11

      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

      1. 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).

      2. After making change to firmware file, program the controller

      3. Wait for upload to complete
      4. Goto windows app and connect to controller
      5. After connected
      6. Set motor speed change enabled to DISABLED
      7. Set motor speed to fast
      8. Set lcd page display time to 2000
      9. Set maxsteps to 1000
      10. Set focuser position to 5000
      11. Set coil power to ON
      12. Click +500 and see how fast the speed is
      13. The speed of the motor should be smooth, not sounding rough
      14. Remember the fast speed should not be like a bullet - you want a smooth rotation of about 1s max for 500steps
      15. If its too fast or too slow, then
      16. Adjust one speed setting at a time.
      17. Windows app - Disconnect from controller
      18. Change MotorSpeedFast value in arduino firmware (line 144) - use small values like add 10 or minus 10
      19. Reprogram controller
      20. Wait for upload to complete
      21. 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

       
  • brownrb

    brownrb - 2016-08-11

    Try this version please

     
  • brownrb

    brownrb - 2016-08-11

    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

     
  • Aaron Sliski

    Aaron Sliski - 2016-08-15

    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

     
    • brownrb

      brownrb - 2016-08-15

      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.

       
  • Aaron Sliski

    Aaron Sliski - 2016-08-16

    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.

     
    • brownrb

      brownrb - 2016-08-16

      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?

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.