Interrupt Driven Rotary Table controller

Home Model Engine Machinist Forum

Help Support Home Model Engine Machinist Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.
thanks for the details ! any slop in that ? any chance of taking some close ups of the stepper mechanical connection to the indexer ? maybe i can fab one up using one of my manual hardinge ones..

thanks !
thanks for the details ! any slop in that ? any chance of taking some close ups of the stepper mechanical connection to the indexer ? maybe i can fab one up using one of my manual hardinge ones..

thanks !
I will take some pictures of the mount on it I have two more that don't have motors on them I will get some pics for you. If I remember correctly hardinge made them for Haas I think

as I told in my short introduction, I built an arduino rotary stepper with the version "rotary 11" of rodw.
The LCD Key shield worked just from the start, but my stepper did not run.
Later, I changed the Dir and Step pins to the positions 2 and 3. That seems to work.
But now, every run starts with a frequency burst and ends with a frequency burst.
After setting down the motor frequency, the stepper seems to work correct. I noticed, that the program did not work fine, when I run divisions like 7.
Going deeper into the program, i changed the step pin in the step correction.

But there was a remaining problem, that the stepper runs quick and slows down after a while.
So it was time to use my oscilloscope to test my construction.
First step was to test the arduino. Everything was ok. Then I tested the driver.
The leadshine digital driver switches between different microstep settings. This seems to be the main problem.

But also the arduino output changes frequency from 1000 Hz to approx. 650 Hz after some time.

So I will have a deeper look at the driver problems first.

best regards

reloader, be sure you are using the version in post #103 and make the change in post #107. The code is robust and enough people have used it to know its bug free now.
You may be getting interference from the serial port data re the burst. I can't quite remember which pins it uses.
In my experience, steppers loose steps when they get hot. What voltage are you running them at?
The Leadshine probably does step morphing so at constant velocity it will reduce the microstepping to the motor to maximise torque. In fact, I would expect it would do that for sure.

I never checked the Arduino frequency but I would be surprised if it was not constant unless it had a flaky crystal on board. The doc say "nearly perfect accuracy compared to software timers" see khoih-prog/TimerInterrupt
I can confirm that the code runs flawlessly . I use an old A3977 based stepper driver .
It's a 1/16 single chip driver . Not the best driver n the world , but for this application
it is more then enough .
I've used it many times over the past year without even a glitch .
I also use the leadshines digital drive DM556 on my experimental cnc , machIII parallel port .
As far as I can tell they're not morping drives .

Hello Rod,

thank you very much for your quick answer. Yes, I use the program from # 103, but I did not make the changes from #107.

As I read before, the Digital pins 0 and 1 are influenced by the usb dta transfer.

I checked the output of the arduino with my cheap digital LCD oscilloscope and it has the nice feature to measure the frequency of the signal.
So I could see the change in frequency . But this effect dissapeared after an arduino reset.

I also made some mistakes with the driver settings, because I did not see, that there was a additional switch for halve and full current on the digital driver.

I will have a closer look at my construction tomorrow.

best regards


I thougt about a new strategy to solve my problems.
I will install the originial rotary 11 again with the driver pins 1 and 2.
Then I will search, where this pins are on my strange AZ delivery LCD shield. It seems soo ,that the locations of pin 1 and 2 are complete different to other LCD shields. I hope, this will work for me.

best regards


i must say, that I am a little bit helpless. I installed the origin rotary 11, checked that the changes in the LCD library were done.
Then set the Dir pin with the LCD shield at 2 and the step pin at 1.
But the step pin 1 was not saved!
Now I have the funny situation, that Dir Pin is 2 and step Pin is 2 and the stepper still runs!
and the arduino still plays the frequency change modus.

best regards


attached you will find some photos of my 7 division run.
You can see the first, the 5th, the 7th and the 9th division.

Please have a look at the frequency. The signal comes direct from the step Pin.
Any help is wellcome.

best regards


rotary 11.jpg
Rotary 11_1.jpg
rotary 11_2.jpg
Rotary 11_3.jpg
Hello Rod,

I do not understand, what you mean with the changes in post#107?

If I delete a comment, the program will not be changed. How does the arduino knows, what LCD shield is used? I could not see this in the program.

Today I loaded the older version rotary 10.
Also with this version, I could not change the step pin to 1. So I think, that the LCD library does not fit 100% to my LCD shield.

You may know, that your program is very complex for an arduino beginner.
I had big problems to understand why a rotation needs 1296000 seconds!

You defined minutes in a circle, comment this as second for a circle, but I think, you mean arc seconds of a full circle.

best regards

Hi folks, at the risk of necroposting : regarding the problems that Edgar/reloader has been having...
" know its bug free now. "
Bloke I used to work with used to say "There is always one more bug!", and so it is with the RotaryTable11 sketch:


So trying to change the Step pin will never work - there is no code block to handle it it ; changing the Dir pin will cause the globals.StepPin to be re-initialized (as well as actually changing the Dir pin)

I believe the correct code would be:

Hope it helps someone!

Cheers - Andrew
Hmm, it indeed looks like you have found a bug
Hi Rod,
my name is Wolfgang and I live in Germany.
I have rebuilt your indexer. I am not a programmer. In principle everything works, except the selection <contin>, if I select that and then stop with <set> this hangs up the whole and works only after a reset.
Do you have an idea what could be the reason?
I am working with the 11th version where I downloaded from this thread.

best regards,
There is a 12th version. I uploaded it here.
However, if the keyboard is not working, it is because of an incompatible keyboard/LCD shield that uses a different resistor value.
You could try editing LCD.cpp and use this key map instead of whats there.
static uint8_t const buttonMappings[] PROGMEM = {
    2, 0, 3, 3, 0, 0, 0, 4, 4, 0, 0, 0, 1, 1, 0, 0,
    0, 0, 0, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0

I had saved this back when I wrote V 12. I'm not sure if it will fix the issue. Its generated by a C program to speed up keyboard response.


  • RotaryTable12.ino.txt
    37.2 KB · Views: 46
Hi Rod,
first of all thank you very much for the answer.
I have tested with a DFRobot module. There it works. Unfortunately, my used module the holes are not equal and is but already installed.
Now my question would be, can you explain to me how that works with the generation of the key map that I can create from my board?
Since I have no idea. A small to do list would be very helpful.

best regards,
It's resistor value issue . Check posts 69 and 71 .
I had thesame issue and it's easily solved .
I really have no Idea.It will not include the bug fix of Andrew in post #136

Latest posts