Arduino Uno stepper control position

Hello everyone,
I'm trying to develop a program that allows me to control the position of a stepper motor (nema 17) in a static way by code.
In summary, the stepper motor should move from a starting position (position X) to an arrival position (position Y), wait for a certain period of time (delay) and then return to the starting point, and so on in a continuous loop .

About the hardware part, I would like to use an Arduino Uno, a nema 17 stepper motor and a TB6600 driver.

I'm not very practical with the code part, if someone could kindly recommend me some solution I would be infinitely grateful!

Sincerely,
Giacomo Zammarchi

GiacomoZammarchi:
Hello everyone,
I'm trying to develop a program that allows me to control the position of a stepper motor (nema 17) in a static way by code.
In summary, the stepper motor should move from a starting position (position X) to an arrival position (position Y), wait for a certain period of time (delay) and then return to the starting point, and so on in a continuous loop .

About the hardware part, I would like to use an Arduino Uno, a nema 17 stepper motor and a TB6600 driver.

I'm not very practical with the code part, if someone could kindly recommend me some solution I would be infinitely grateful!

Sincerely,
Giacomo Zammarchi

Fairly ambiguous statement. You always control the position of a stepper motor with code. You count the number of steps you tell the motor controller to make.

As written, you don't care where the starting position is. That is quite rare. Most people have something like a switch or a stop pin to indicate a starting position that never changes.

There are many stepper motor code examples. Have you tried any and do they work?

What are you using for a stepper motor controller? What are you using for power for the stepper motor and for the Arduino?

Paul

Hi Paul,
thanks for your fast reply.

Yeah I suppose it’s a basic code, but it’s my first time coding with Arduino.

I forgot about the endstop, I should mount one to establish the starting position.

I would like to try this code and then evolve it, also trying to make arduino communicate with vb.net (being able to change the variables as speed etc. from a custom graphic interface).

However I will use a TB6600 as stepper driver, I will power Arduino keeping it connected to the computer (having to constantly change the variables from code should be the best choice) and I will power the stepper and the driver through an external 40W 4A power supply.

These links may help

Stepper Motor Basics
Simple Stepper Code

...R