Stepper Motor Speed Controller

Hello all, I am needing some pretty serious help with my project. I am relatively new to stepper motors and drivers but I know how they operate and I know the basics. I am trying to make the motor turn at a velocity relative to the position of the knob on a potentiometer. I found the code on the arduino website and used that and I got it working on a Nema 23 motor and a smaller stepper driver while I was waiting for parts, but when I got my parts, that is when my problems started. I ordered the Nema 34 stepper from Stepperonline, I will post the links to the products at the end, and the 6 amp driver they paired the motor with on amazon also from stepperonline. Also, I am using a 24 volt 15 amp power supply and an Arduino Uno. When I hook up the system the same as with the smaller motor, I can hear the motor barely make a high pitch noise, and it gets louder as I turn the potentiometer proportionally, but the motor simply will not even try to turn. I cannot turn the shaft at all so the motor has holding torque, but it just will not turn. So then I hooked the 34 up to the smaller driver I used in another project, the same one that I used to turn the nema 23, and the system works great, but just stalls in high rpm, about 100, and has little torque which I suspect is from the lack of amperage from the smaller driver… but I could be wrong of course. Anyways, I then tested the voltage that the arduino is sending to the ENA, PUL, and DIR ports on the driver, and it was around 2.3 volts. So I read the little manual from the driver, and it mentioned requiring 4-5 volts… so I suspected that could definitely be the problem but at this point I just have no idea. I messed with the code settings and the microstep settings and also the amp settings but nothing I did resulted in the motor actually turning. Another question I have is the map function in the arduino code… I understand its purpose and that it takes a range from the potentiometer, but I am not sure what units of the second parameters that relate to speed are. Based off of judgement, I do not think that it is rpm? I am really just not sure, but I need my motor to spin at about 100 rpm, so if you all could help me with changing parts of my code to make the motor run as smooth as possible, I know it will be jumpy at low rpm, but just as smooth as possible, I would appreciate that. Thank you in advance!

motor and driver:

Project_Code.ino (1.26 KB)

The standard Stepper library is not suitable for stepper motor drivers that take step and direction signals. You should use the AccelStepper library.

This Simple Stepper Code can be used to test your motor. It does not need any library.

...R
Stepper Motor Basics

Having all of your ideas in a single paragraph makes your Original Post very hard to assimilate. A good test of readability is to read your text out loud to yourself.

For the benefit of other readers here is the Original Post with some white space between the different ideas to make it easier to read.

Hello all, I am needing some pretty serious help with my project. I am relatively new to stepper motors and drivers but I know how they operate and I know the basics.

I am trying to make the motor turn at a velocity relative to the position of the knob on a potentiometer. I found the code on the arduino website and used that and I got it working on a Nema 23 motor and a smaller stepper driver while I was waiting for parts, but when I got my parts, that is when my problems started.

I ordered the Nema 34 stepper from Stepperonline, I will post the links to the products at the end, and the 6 amp driver they paired the motor with on amazon also from stepperonline. Also, I am using a 24 volt 15 amp power supply and an Arduino Uno.

When I hook up the system the same as with the smaller motor, I can hear the motor barely make a high pitch noise, and it gets louder as I turn the potentiometer proportionally, but the motor simply will not even try to turn. I cannot turn the shaft at all so the motor has holding torque, but it just will not turn.

So then I hooked the 34 up to the smaller driver I used in another project, the same one that I used to turn the nema 23, and the system works great, but just stalls in high rpm, about 100, and has little torque which I suspect is from the lack of amperage from the smaller driver... but I could be wrong of course.

Anyways, I then tested the voltage that the arduino is sending to the ENA, PUL, and DIR ports on the driver, and it was around 2.3 volts. So I read the little manual from the driver, and it mentioned requiring 4-5 volts... so I suspected that could definitely be the problem but at this point I just have no idea.

I messed with the code settings and the microstep settings and also the amp settings but nothing I did resulted in the motor actually turning.

Another question I have is the map function in the arduino code... I understand its purpose and that it takes a range from the potentiometer, but I am not sure what units of the second parameters that relate to speed are. Based off of judgement, I do not think that it is rpm? I am really just not sure, but I need my motor to spin at about 100 rpm, so if you all could help me with changing parts of my code to make the motor run as smooth as possible, I know it will be jumpy at low rpm, but just as smooth as possible, I would appreciate that. Thank you in advance!

...R

Please read this:-
How to use this forum it will tell you how to ask a question and what information you have to supply.
It would also help if your text was not a solid block but split up into paragraphs. It was a bit difficult trying to follow what you had done.

Based off of judgement, I do not think that it is rpm?

Correct it is not.

Did you read the comments in the code you posted? The comment that said:-

The higher the potentiometer value, the faster the motor speed. Because setSpeed() sets the delay between steps

So that value is a setting of the time between steps. It does not mention the units but you can measure that for yourself. Just send the motor the number of steps for say four revolutions and time with a watch or app how long it takes the motor to turn. You can then work out what units this library works in.

You should set your motor driver to the correct current for the motor, or a smaller current if the exact one is not available.

Note that code, or more specifically the library you used, is not suitable for controlling a stepping motor driver, it is designed for driving coils directly from a FET connected to the individual pins of the Arduino. See this link Motors 3 for how uni-polar stepping motors work. And this link Motors 4 for how bipolar stepping motors work.

Please note that when I started my reply no one else had given a reply. The above two were sent while I was composing this reply.