Electronic (Arduino) Rotary Indexer - Another One

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.

kquiggle

Well-Known Member
Joined
May 29, 2012
Messages
412
Reaction score
137
Introduction:

This thread is a variation based on the excellent post by bmac2: Arduino Rotary Table for Dummies. First, I want to acknowledge that the electronic part of my build is based 100% on bamc2's post. However, I took a somewhat different direction in the Arduino programming and in the "rotary table" (because I didn't use one!). If you are interested in this post at all, I strongly recommend that you read bamc2's post first.

I've started this new post because I did not want to detract from bmac's post in any way, or post items to that thread which were starting to veer off in other directions. With that said, here are the areas where I went in a different direction:

First - I decided from the start that I wanted to try a build that did not use a rotary table. Instead, I built an indexing head with a collet holder which connects directly (no belts or gears) to a stepper motor. As I write this, the mechanical part of the build is complete (see below), but I am still working out some final details.

Second, because my "straight through indexer" requires some approximations in setting the stepper motor positions, I took the Arduino code posted by bmac2 and made some extensive revisions and additions. The advantage of this new code is that it makes it easy to select angular positions which are not an exact number of stepper motor steps, and still get a reasonably accurate approximation of the desired position.

I'll get into more detail on these two areas in subsequent posts.

Here is a link to my build page (still a work in progress as I write this): https://sites.google.com/site/lagad...ls-etc/build---electronic-indexing-head?pli=1

Here is the (nearly) complete indexing head/collet holder:

indexer.jpg
 
My goal for this build was to create an electronic indexing head which I can use to make gears, knobs, and other small parts requiring milling at defined angles. Parts for milling will be held in an ER32 collet holder (or mounted on mandrels held in the collet holder).

From a high level view, this build has three parts:

  1. Electronics - the stepper motor and associated electronics
  2. Code - the computer code which determines stepper motor movement
  3. Fixture - the mechanism which connects to the stepper motor on one end, and holds stock for milling on the other end.
Here I will talk about the fixture, and the current state of the build. The build consists of these primary parts:

  1. Baseplate - holds all other components, and fastens to the mill table
  2. Stepper motor holder - holds the stepper motor
  3. Flexible connector - connects stepper motor to collet holder (I purchased this part)
  4. Collet holder support - supports the collet holder and bushing in which the collet holder is mounted
  5. Collet holder - (purchased) ER32 collet holder for holding stock (or mandrels for holding stock) for milling
The picture below shows the (nearly) complete fixture mounted on my mill table for initial testing. The brass lever in the middle is used to mechanically lock the collet holder in place for milling. For this setup, I used a test indicator to first mount the baseplate square to the table. The, I used the indicator to determine the TIR. For this purpose I mounted a carbide cutting tool in the collet holder, and measure against the shaft of the tool. Before using the carbide tool as my standard, I checked it with a micrometer to make sure it was accurately "round." Based on this test, I came up with a TIR of 0.0035" - not great, but acceptable for my purposes.

See also my build page here: https://sites.google.com/site/lagad...ls-etc/build---electronic-indexing-head?pli=1

indexer-first-test.jpg
 
As noted in the introduction, I built the electronics based on a post by bmac2 (Arduino Rotary Table for Dummies), and I really have nothing to add to that very thorough write-up.

At this stage of my build, I have simply mounted the components on a "breadboard" as shown in the picture below; I'll build an enclosure later. The parts shown in the picture, starting from the lower left and going clockwise:

  1. Stepper motor controller
  2. Arduino Uno (computer - a Chinese clone in this case)
  3. Display
  4. Keypad
  5. Power supply

electronics-breadboard.jpg
 
The computer used in the build requires code to operate, and bmac2 provided such code in his write-up. However, that build assumed that gearing, a belt drive (or both) would result in the stepper motor's steps (typically 200 steps per 360 degrees) to be converted into rotary motion that would be evenly divisible into 360 degrees. Since my build does not use gearing or belts, I needed to revise the code substantially. In addition, the discussion in bmac2's post included some suggested improvements which I also incorporated into my code.

At this time, I have a good working version of the code, but I will probably make additional changes. The current code, and any updates, will be posted to my build log here:

https://sites.google.com/site/lagad...ls-etc/build---electronic-indexing-head?pli=1

To see the changes I made, the best thing to do is to examine the code itself. However, I will also provide a brief explanation here.

The code changes were made so that when stepper motor and rotary table parameters are entered into the program, calculations will be made in two ways [Note: In this explanation I will use "steps" to mean either full steps or microsteps, whichever the stepper motor is set for.]:

First, the program will calculate the exact ("theoretical") number of steps required to move a specified number of degrees; this may be a fractional number even though the stepper motor cannot move a fractional step. The program also keeps track of the total number of theoretical steps moved.

Second, the theoretical number of steps are converted to "actual" (integer) steps. The program also keeps tracks of the total number of actual steps moved.

The determination of the required number of steps to move is in all cases based on the theoretical steps, which are then converted to actual steps. This method provides the best approximation (typically with an error less than 0.01%), and enables the easy use of gear and table ratios which do not divide exactly into 360 degrees.

The table below shows an example for a circle divided into 7 divisions, for a stepper motor which makes 3200 steps in 360 degrees (note that position 0 and position 7 are the same physical position). The first column shows the division number, second column shows the number of steps the stepper motor would turn if it could make fractional steps, and the third column shows the actual number of (cumulative) steps the motor will turn when my revised code is used. For fractions of <.5 the steps are rounded down, for fractions of >=.5 the steps are rounded up.

Although I have used 3200 total steps in this example, the code can be set to whatever microstepping your motor is set for, as well as any gearing or belt drive ratios might be used in your setup, so this code can also be used if you are using a rotary table or a belt drive.

HTML:
         Theoretical      Integer   
Div      Position         Rounded                   
0         0.000               0                   
1         457.143           457                   
2         914.286           914                   
3         1371.429         1371                   
4         1828.571         1829                   
5         2285.714         2286                   
6         2742.857         2743                   
7         3200.000         3200
 
The two pictures below show my first two tests of the indexer - one fail and one success. The first test was in 1/2" brass rod, cutting with 4 divisions. I'm not exactly sure why this failed, but it may be because I did not properly lock the rotation for every cut.

For the second test cut, I switched to (cheaper) aluminum 1/2" rod. This time I was very careful to lock the rotation before each cut. The result was a successful four-sided cut (note, the sides may not look parallel in the picture, but this is just due to parallax error in the camera).

Build log is here: https://sites.google.com/site/lagad...ls-etc/build---electronic-indexing-head?pli=1

test-cut-01.jpg


test-cut-02.jpg
 
Finally got around to finishing up my version of the electronic indexer. I ended up using a stepper motor with planetary gear reduction in order to get sufficient torque.

final-version.jpg


Starting with the code provided by bmac2 (along with good ideas from others) I made extensive modifications. Primarily I added code to enable entry (and storage) of stepper motor parameters through the keypad, modified the display text, enabled entry of more decimal places, and tightened up the code a bit by consolidating some repetition into functions. See the build link below for pictures of the modified display text.

The biggest change I made was to eliminate cumulative rounding errors by keeping track of a running total of "theoretical" fractional steps, rounding required steps separately up or down appropriately for each move.

In the future, I may make further modifications to include backlash correction (although I am not sure this is really needed since the issue can be avoided by always making rotation in one direction).

The code I wrote can be downloaded from a link on my build log. I am not including a direct link to the code here because any corrections or modifications I may make in the future will be posted to the build log, so the latest and greatest version will always be available there.

My build log (which includes down-loadable plans for the collet holder fixture) is at the link below:

https://sites.google.com/site/lagad...es-mills-etc/build---electronic-indexing-head

Here is a picture of a test cut I made to try out the indexer.

test-cut-final.jpg


Finally, I thought I would pass along this little tip for preliminary indexer testing: I attached a digital angle gauge to my collet holder to check the angles as I tried out the indexer code. The gauge is only accurate to ±0.2°, but this is good enough to quickly show any major problems or cumulative errors. I would not rely on this as a definitive test, but it makes a good (and quick) first check.

accu-remote.jpg
 

Attachments

  • final-version.jpg
    final-version.jpg
    92.6 KB · Views: 479
Success!

One of my primary goals in making an electronic indexer was to use it to make gears. Using aluminum gear blanks, I made two 30-tooth gears. If you look closely on the picture below, you can see a vertical witness mark (where the 30 is stamped) - this marks the first cut on the blank. If the indexer is off by a significant amount, it will likely show in the final cut. I'm happy to say that both gears came out nicely, and mesh well together.

gears.jpg

Below is the indexer and gear cutter set-up on my mill. A few things to note:
  • I cut two flats on the mandrel (using the indexer!) so I could hold it with a wrench when tightening the bolt to hold blanks on the mandrel. Otherwise, I found that the mandrel could slip in the collet when loosening or tightening the bolt.
  • The mandrel has to extend quite a bit from the collet to allow room for the cutter. I was concerned that this might cause problems, but it worked OK.
  • It is essential to lock the mandrel rotation before each cut.
  • I added a "remote button" on a long wire to my indexer controls. This allows be to place the electronics at a convenient location, and also initiate an indexer rotation close to the work. This proved to be a very useful addition.
More details on my build page here: https://sites.google.com/site/lagad...es-mills-etc/build---electronic-indexing-head

gear-cutting.jpg
 
Hi kquiggle

Glad to see people are still finding the “Dummies” useful. I haven’t looked at it for quite a while as you say the waters are getting pretty muddy over there.

It’s been a long time since I’ve seen an honest to God “breadboard”, reminds me of my first S100 Buss computer.

The indexer looks good and I’m glad you went with a big locking arm. I know that with a small one I’d forget to lock it and good things just never happen that way.
 
Bob - thanks for the kind words, and double thanks for your "Dummies" post. I think you probably planted a seed that gave rise to a lot of indexers. The project was a lot of fun - it's been a while since I have done any programming and it felt good to reactivate a few neurons.

I'd really like to automate that locking arm - just mulling over a few possible options. Right now I'm thinking of using a servo, though I'm wondering if it will have enough torque.
 
Some days I have to wonder how many of those things are out there.

I checked out your page, I especially like the mail box it’s too bad Canada Post dropped door delivery I’d make one! These two live in my home office, the guy on the left is cast iron and would just rust horribly if I left it outside. . . . with the others.

IMG_3282.JPG
 
Bob - if a mailbox is out, you could always build a Little Free Library with a gargoyle. I was going to make one, but the street in front of my house is way too busy.

Love the cast iron gargoyle - I'll have to look for one.
 

Latest posts

Back
Top