Trying to use the AccellStepper Constant Speed on a Servo/Stepper

183 views
Skip to first unread message

Ralph Hulslander

unread,
Jun 26, 2023, 2:17:56 PM6/26/23
to accelstepper
2HSS86 Rattm Motor hybrid servo driver

The motor turns but always at the same speed.

With a regular stepper motor the speed varies as expected with different myStepper.setSpeed.

I have not found other code to use.

Ralph


Ralph Hulslander

unread,
Jun 27, 2023, 11:45:40 AM6/27/23
to accelstepper
Anyone have any idea on where to even start?

I am sure I have a pulse generator somewhere possible that will vary the motor revolutions.

I wonder if it is possible the pulse width that needs changing.

Ralph

Jim Larson

unread,
Jun 27, 2023, 12:07:48 PM6/27/23
to accelstepper
A couple of stupid questions:
-Do you have an encoder connected?
-Is your motor one of the ones this controller is designed for?

Assuming the answer to these questions is "Yes", I'm not sure what to suggest. I have no experience with his sort of controller.
I think your idea about increasing the pulse width is a good on, however.
You might try just using runSpeed() to see if you can get the motor to run at various (constant) speeds. The controller may want to handle acceleration on its own?

Sorry I can't offer more.
     -ji

Ralph Hulslander

unread,
Jun 27, 2023, 9:49:28 PM6/27/23
to accelstepper
I do not have a encoder but when I increase set speed from 50 to 3000 the motor appears to be spinning at the same speed.

The motor and driver are bought as a set.

I wanted to run with out acceleration but that is a good idea to at least try.

When I do that with a stepper motor the difference is obvious.

The stepper is using a a different driver. I could replace the Servo/Stepper with a stepper motor
to see what happens.

Thanks for the reply it got me thinking.

Ralph

Jim Larson

unread,
Jun 28, 2023, 12:01:11 AM6/28/23
to accelstepper
I'm still just guessing here, but a couple of thoughts:
- Be sure that you have called setMaxSpeed() with a speed greater than or equal to any value you're setting with setSpeed(). Otherwise, speed is limited to the value of setMaxSpeed().
- My reading of the controller data sheet made me think that an encoder is required for proper operation. Are you sure you don't need one?

Sorry, I still can't help much.

          -jim

Ralph Hulslander

unread,
Jun 28, 2023, 2:21:30 PM6/28/23
to accels...@googlegroups.com
Thanks for the reply! Sorry I was thinking of an encoder to view RPM not for motor operation.
Yes there is an encoder for motor operation.

I am using the AccellSteper ConstantSpeed.ino code.

With a stepper motor and driver changing 
myStepper.setMaxSpeed(5000);   
myStepper.setSpeed(1000);
to
myStepper.setSpeed(3000);

Makes a big difference in motor rpm but with the Servo/Stepper motor it does not make any difference.


I need to test again but I "think" I tried running your leadscrew code and the motor did not turn at all.

Here is the User Manual for the driver HSS86.
  

Ralph

--
You received this message because you are subscribed to a topic in the Google Groups "accelstepper" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/accelstepper/Zs0GRPCk_78/unsubscribe.
To unsubscribe from this group and all its topics, send an email to accelstepper...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/accelstepper/a51d5911-ffd7-48b3-bb99-281b883c4ffdn%40googlegroups.com.

Jim Larson

unread,
Jun 28, 2023, 6:43:49 PM6/28/23
to accelstepper
Running out of ideas here.
- Have you tried setting the speed slower? Try 100, just to see what happens.
- Have you tried adjusting the step pules width? Use setMinPulseWidith(20) and see if it helps.

That's it for me!
Good Luck!!
          -jim

Ralph Hulslander

unread,
Jun 28, 2023, 7:39:08 PM6/28/23
to accels...@googlegroups.com
I tried 50 and others upto 3000 they all turn the same.

I was hoping someone familiar with the HSS86 driver would jump in.

You have given me some good ideas to try.

I was really lost and was not even able to think of things to try.

Now I have a number of things to try.


Now I haven't the slightest idea what to set the pulse at.

Ralph

You received this message because you are subscribed to the Google Groups "accelstepper" group.
To unsubscribe from this group and stop receiving emails from it, send an email to accelstepper...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/accelstepper/ebd0f130-21c2-47ff-b545-61e50d3e73a6n%40googlegroups.com.

Ralph Hulslander

unread,
Jun 30, 2023, 11:23:48 AM6/30/23
to accelstepper
Darn, Compilation error: 'setMinPulseWidith' was not declared in this scope

I tried it in Setup and in the Loop.

Ralph

Jim Larson

unread,
Jun 30, 2023, 11:36:39 AM6/30/23
to accelstepper
There's a typo in the instruction! Try using setMinPulseWidth() instead. Very sorry!
          -jim

Ralph Hulslander

unread,
Jun 30, 2023, 3:56:52 PM6/30/23
to accels...@googlegroups.com
Finally it is working.
The seller had said that the motor was run before it left their shop so the switch settings should stay as they come.
Well guess what! They were wrong.
I changed the PPR settings and the motor runs!!

It is interesting I ran through all of the settings.
The default ON-ON-ON-ON 400 PPR fails.
The Max OFF-OFF-OFF-OFF 40,000 PPR fails.
But everything else works.
800 appears to be the best, fastest.
I bought an optical RPM checker but that does not show consistent readings so it is useless.

Now I need to set up an encoder for RPM.

Plus I have to program an ON/OFF button.
I am "thinking" of putting in a range of setSpeed that I will select with a encoder.
Of course I am not a programmer but I have Jim's leadscrew program so I'll copy his button routine.

Ralph




Ralph Hulslander

unread,
Jul 14, 2023, 4:07:03 PM7/14/23
to accelstepper
Damm, I switched computers and updated Arduino.

Now I am getting this error:

C:\Users\Ralph\Documents\Arduino\AccellStepper\ConstantSpeed\ConstantSpeed.ino: In function 'void setup()':
C:\Users\Ralph\Documents\Arduino\AccellStepper\ConstantSpeed\ConstantSpeed.ino:23:4: error: 'stepper' was not declared in this scope
    stepper.setMaxSpeed(1000);

#include <AccelStepper.h>

// Motor Connections (constant current, step/direction bipolar motor driver)
const int dirPin = 4;
const int stepPin = 5;

AccelStepper myStepper(AccelStepper::DRIVER, stepPin, dirPin);

void setup()
{  
   stepper.setMaxSpeed(1000);
   stepper.setSpeed(50);  
}

Remember I am not a programmer so I have no idea what I need to do but beg for help.
This is the exact same code that was running.
This is Arduino 2.1.1

Ralph

Jim Larson

unread,
Jul 14, 2023, 7:03:29 PM7/14/23
to accelstepper
Hi Ralph -
Since you have changed computers you probably need to install the AccelStepper library in Arduino.
 -jim

gjgsm...@gmail.com

unread,
Jul 14, 2023, 7:47:14 PM7/14/23
to accelstepper
Your AccelStepper object is named myStepper,
change...
void setup()
{  
   stepper.setMaxSpeed(1000);
   stepper.setSpeed(50);

to...

void setup()
{  
   myStepper.setMaxSpeed(1000);
   myStepper.setSpeed(50);  
}

Ralph Hulslander

unread,
Jul 14, 2023, 7:59:45 PM7/14/23
to accelstepper
Duh, I do not know where stepper came from.

Thanks for the help!
Ralph

Reply all
Reply to author
Forward
0 new messages