Stepper motor control

I’m new to this! So be patient!!!
I have read a lot of information on how to make a stepper motor run with an arduino and a driver. My question is I want to take rotation to linear motion. I will do this with a ball screw. but I want to be able to stop the travel at say 4.250” from a designated home point.
Thank you and I hope you understand this.

Noted!!.!

Before writing code, physical size of your system (mass, acceleration, power) will determine a range of motors, and motor specifications will determine driver specifications.

Present specific information (as best you can) concerning your system.

From the thread pitch and the number of motor steps per revolution, you can very accurately calculate the number of steps required have the nut travel a given distance.

2 Likes

I know how to do the math for the distance I want to travel.
I’ll be using a NEMA 23 stepper motor and a MA860H driver. What I don’t understand is how to write the code. I have the arduino kit with the kit stepper motor and their driver board. I am going to try and make it run today.
I need to move a stop on a sheet metal break to a specific distance and then hold that till the break bends the metal.

of course there's no way to know the position of the stepper when the system is started. A common technique is to add a micro switch that is closes at a specific position.

in your case, it could be at that 4.25" point. But when doing this, the code needs to move one step at a time, check the micro-switch and stop immediately when the micro-switch closes

a better approach is a "home" position a safe distance from the 4.25" point that the motor is moved (slowly) too once at startup. An internal position used to count steps is then set to zero, once.

once that position is know, the motor can then be moved forward and backwards to arbitrary positions by counting steps and it can do that at speed.

Ok! I’m following you so far. If I set home position at a point called zero. What is the programming to get the stepper to go to zero.?

that home position is at some end of travel that can always be reached going in one direction or the other (e.g. CW). home() would be called once in setup().' step(CW)` is whatever instruction you need to advance the motor one step in the specified directio

void
home ()
{
    while (LOW != digitalRead (PinHome))  {
        step (CW);
    }
    pos = 0;
}

once pos is zeroed at the home position, you should then be able to advance the motor a specified # of steps to the 4.25" position or advance it until it is at some specified # of steps depending on the functions available in the motor library

I’m with you so far. I’ve been watching a utube video (Open-Source Electronics Platform. ) He has an accent from India but I am following him fairly well.

Be sure to use good thrust bearings at the ends of the leadscrew. Also, are you going to use microstepping with the stepper motor? If so, only do that after homing the nut.

I’ve been reading about micro stepping. Does arduino use all the C++ codes?

do you need that resolution, a fraction of a step?
won't one revolution of the ball screw be close enough, if not a fraction of a revolution?

Probably not but I’m reading as much about the programming as I can. I used to program Mitsubishi programmable systems and it was in ladder logic. C+ is a big difference from Mitsubishi systems.

I would recommend to use a library to drive your stepper. The MoToStepper class of the MobaTools library may be a solution. There are several stepper examples and there is an example for homing the stepper. You can have a look at the documentation.
The MobaTools library can be installed via the library manager.

while i understand digital logic, the big difference when working with FPGA "programs" vs processor programs is that hardware runs in parrallel while processors run sequencially

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.