Motor project guidance

Hi all,

Firstly I'd like to say that I'm at an intermediate level of coding. I am looking for advice or any ideas that i coukd change. Also a point to some code if it's been done already so I can learn from it.

My aim is to create an arduino controlled controller for a motor driver with STEP and DIR inputs . It will have an LCD screen with input buttons. I'd like to be able to control the degree of rotation to 0.1 degree increments with adjustment using fine and coarse buttons. Or a keypad. I'd imagine up and down buttons will be easier. Once the degree has been set a button will be pressed and it will move to the desired location and stop. It can then be adjusted to another angle if required using the buttons to select the new degree angle. Once done you can press another button to move it back to its 'home' position of say -5 degrees.

This will be driving a reduction ratio of 100:1 with roller chain and a gearbox. The motor is an industrial 1KW servo with a driver STEP and DIR inputs so no different to a stepper motor really. It will be to bend steel pipe and tubing.

The mechanical side I can manage no problem but the coding will be a bit tricky. I've done very little with stepper motors. Any recommend libraries or reading material would be great.

Thanks in advance.

Stepper basics by Robin2 might be a starting point.

Thanks for the link I'll have a read.

Can I confirm that when using a driver to control a motor you digitalWrite () the STEP and DIR pins HIGH and LOW in the loop for the desired amount of steps and direction? Is it really as simple as that?

Yes, pretty much. Have a read of the linked post and you will see. The Accelstepper library also lets you control acceleration and moving the motors to position in a non blocking manner. Accelstepper allows control of multiple motors, too.

All seems pretty basic so far. Not as daunting as I first thought. What dictates the pulse length/time does there have to be a delay in the loop or do you change the frequency some other way?

In addition to the link in Reply #1 this Simple Stepper Code may help with understanding. I hope the variable names are self-explanatory. The first example is OK for testing but the use of delay() is not really suitable for a serious project. The second example uses millis() and micros() for non-blocking timing.

Most specialized stepper drivers that take step and direction signals are happy with a very short step pulse of about 10 microsecs.

...R