Arduino Rotary Table for Dummies

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.
Hopefully the last update to my program for a while: I just finished version 7.25 of my indexer sketch, with the following changes:
  • added backlash compensation (optional)
  • added a beep function (optional)
  • fixed a minor bug when making a full 360° rotation in one move
In order to use the backlash compensation, you must determine the exact amount of backlash in your indexer and enter it into the program. In practice, I would not reverse rotation direction when actually using the indexer if it can be avoided. Note that the backlash compensation assumes that the amount of system backlash is repeatable and constant (possibly true in the short run; all bets are off in the long run).

The beep function requires the addition of a speaker or piezo buzzer to the system (wired to ground and pin 13). I added this because when I am using the indexer on my mill, I'm mostly not watching the LCD screen and the beep provides a nice confirmation that a rotation has completed.

Version 7.25 is available for download here:

https://sites.google.com/site/lagad...es-mills-etc/build---electronic-indexing-head
 
Mr. kquiggle,
I have been following your build and i appreciate your work. However I have a problem, I cannot get your sketch to load correctly on my arduino uno (clone).
It will load and run the original sketch (from the original poster) but when I try to load your code, my arduino simply does nothing, the IDE says that the upload is complete with no errors but when i power the arduino up all i get is bars across the screen. After trying several times with no success, I can go back to the original code it all functions work as it should again.
Do you have any incite on things that I can try?
Thank You
 
Mr. kquiggle,
I have been following your build and i appreciate your work. However I have a problem, I cannot get your sketch to load correctly on my arduino uno (clone).
It will load and run the original sketch (from the original poster) but when I try to load your code, my arduino simply does nothing, the IDE says that the upload is complete with no errors but when i power the arduino up all i get is bars across the screen. After trying several times with no success, I can go back to the original code it all functions work as it should again.
Do you have any incite on things that I can try?
Thank You

I have exacyly same problem when i moved from bmac2 sketch to kquiggle sketch. (See my previous post)

To fix that, open sketch and find this line:
Code:
LiquidCrystal_I2C lcd(0x3F,20,4);
And replace it by this:
Code:
LiquidCrystal_I2C lcd(0x27,20,4);
 
I have exacyly same problem when i moved from bmac2 sketch to kquiggle sketch. (See my previous post)

To fix that, open sketch and find this line:
Code:
LiquidCrystal_I2C lcd(0x3F,20,4);
And replace it by this:
Code:
LiquidCrystal_I2C lcd(0x27,20,4);

This worked perfectly!! Thank You very much!
 
jabraham17 glad you got it working. It's not a bug exactly - some displays use 0x3F and some use 0x27 so you just have to find the one that works for you. If you are using the latest version (7.25) I make note of this in the code comments (check out the NOTES ON FIRST USE at the beginning of the code listing for some useful tips).

The most recent version adds optional backlash compensation and optional "beep" after move (requires additional hardware). If you don't have the latest version, you can get it here:

https://sites.google.com/site/lagad...es-mills-etc/build---electronic-indexing-head
 
bluejets - thanks for the tip, that's a good one to know. I'm working on a new sketch using acceleration, and every day I am finding out how much I still have to learn about Arduinos and programming them, so I welcome all the advice I can get.

I've just started playing around with the AccelStepper library and I think I'm making some (slow) progress. I'm glad I started with bmac2's approach first - it was an excellent learning tool, and having a working set-up makes testing a new version a lot easier.

As an aside, in the last version of my previous program I added a beep capability (you need to add a speaker or piezo buzzer to your hardware, of course), and I have found it to be very useful in de-bugging. I can throw a beep into the program and get an audible confirmation that something is sorta working even if the motor isn't moving.
 
kquiggle,

I was able to load your version 7.25. By changing to "LiquidCrystal_I2C 1cd(0x27),20,4);" my display looks fine and I can make entries just fine.

I then went into the settings and made these changes:
1) set the 'Full Steps in 360" to 400 (it only turned 1/2 of what I was entering in degrees when it was set for 200)
2) left Micro-stepping = 1
3) set Table Gear Ratio = 90 (because my RT is 90:1)
4) left Step Delay = 1000
5) left Backlash Correction = -1 (is it supposed to be a negative number?)
6) left Beep = 1 (because I might get a noise maker - I understand the value of this)

I doubt that I'll have any use for backlash control. There is some slop in the gear train but by running in one direction only and locking the table for each cut there shouldn't be any problem. I have always done this when running it manually, anyway. The micro-stepping idea is something I don't understand yet.

So far it seems to be right on the money but I still need to attach my original manual handle with it's scale so that I can see it in finer resolution.

Next I want to get some more information from Bruce about incorporating a continuous running option for making smooth curves. Then comes the project of putting this together with boxes and buttons so it will be safely useable. Maybe I'll even be able to convince some people that I knew what I was doing when "I" designed this thing.

I may not be done yet but I would like to thank everybody who has helped me muddle through this. It sure is fascinating!
 
lkrestorer -

Good to hear it is working for you. To address your points one at a time:
  1. The "Full steps in 360" is the total number of "full" (no micro-stepping) steps your motor needs to turn a complete 360°. Typically this is 200, but for some motors it's 400. Make sure it is set properly for your stepper motor.
  2. The micro-stepping setting should match whatever your stepper controller hardware is set for; 1 is correct if you are not doing any micro-stepping.
  3. Sounds like you have the table gear ratio set correctly, assuming you are driving the table directly. However, if you were driving the table via a 2:1 belt reduction, you would need to set it for the reduction of the entire driving train (2x 90 = 180 in my example).
  4. I think a step delay of 1000 (micro-seconds) is a good compromise. My stepper ran at 750 but stalled at 500, so I think 1000 gives a good safety margin. Of coursde ther is no way for the program to account for any missed steps,so you want to avoid that possibility.
  5. Backlash correction should not be a negative number. If you used an earlier version of my program, you are probably picking up a random number from the EEPROM. IF you are not using backlash correction just set it to 0 (zero). I agree with you on running in one direction only - that's the only way I would do gear cutting. However, it was easy to add backlash compensation, and I have some ideas for using it in a new program so I wanted to try it out. For what it's worth, it worked better than I expected.
  6. Now that I have started using the beep I am really finding it useful. A piezo buzzer is only a buck (no need to use a resister), so it's a cheap and easy addition.
About continuous running: I'm working on a program for this now, including acceleration/deceleration. Right now I am just at the point where I'm starting to understand the AccelStepper library, so it's going to be a few weeks before I have something to share, but I'll post something here when I do.
 
piezo-buzzer.jpg
Adding a simple beeper to your indexer (I used a "piezo buzzer"like the one shown - actual size about 22mm diameter) is very easy; these cost around $1 or less. Simply connect the two wires on the beeper as follows:
  • black: pin 13
  • red: ground (GND)
Actually the beeper will work even if the two wires are reversed, but I found that mine worked better as above than when reversed. Sometimes it is suggested to add a 100 ohm resister, but this is really not necessary.

The indexing program I wrote includes the option to use a beeper. I also wrote a simple program ("beep-test" - available for download in the Coding section of the link below) which can be used to test beeper function and find the best frequency to use with your beeper.

When I wrote my version 7.25 indexer program, I used a tiny speaker from my junk box as a beeper and found a frequency of 4000 worked best. With the piezo buzzer I found that a frequency of 3800 was a bit better. I suggest using the beep-test program to determine what works best for your beeper.


https://sites.google.com/site/lagad...es-mills-etc/build---electronic-indexing-head
 
kquiggle
Rather than using the accel library I was considering just using an approximation. It would be something like this
First 5 steps use 5x stepdelay
Next 5 steps use 4x stepdelay
And so on
Similarly decelerate at the end.
 
tjwal - That is essentially what the AccelStepper library does (but supposedly in a more sophisticated manner).

I found the AccelStepper library a bit counter-intuitive at first, but now that I am starting to figure it out I can see the benefits. For example, you can set acceleration and max motor speed and then with a single command you can move from A to B and the motor will automatically go from A to B by accelerating to top speed and then decelerating down to B (and if there is not enough time between A and B to reach top speed it will handle that too).

I think your proposed approach will work, and it may be the best approach depending on exactly what you want to do. On the other hand, there are a lot of little details to address if you want to write your own acceleration code. The advantage of the AccelStepper library is that those nasty little details have been addressed and de-bugged (there have been about 50 enhancements and bug fixes since the initial release).

Both approaches have advantages and disadvantages. If you write it yourself you will have a deeper understanding of how the program works, but it may be more limited. If you go with AccelStepper you will have to go through a learning curve and that may take more time and effort than necessary for what you need to do.

The best part is: You can choose whatever you want.
 
As I mentioned earlier, I have been trying out the AccelStepper.h library for acceleration and deceleration of stepper motors. As I worked through the learning process I started accumulating notes, ideas, and observations so I decided to organize all the information on a web page. I have also written some small sample programs to show how the library can be used, and I am posting those programs also (with more on the way). Anyone who has built a bmac2 type hardware setup should be able to run these programs.

My ultimate goal is to write program for controlling a rotary index table using acceleration/deceleration with these general capabilities:
  • Indexed moves (by degrees or number of sides/teeth)
  • Continuous rotation in both directions
  • Rotation in an arc, both one way and back and forth
  • Backlash compensation
If you are interested in writing your own programs with this library, you may find my web page useful:

https://sites.google.com/site/lagadoacademy/miscellaneous-projects/stepper-motor---accelstepper-h
 
kquiggle
I took a look at your website. You’ve been busy!!
I do have a couple of questions on your furnace controller.
How many watts is it?
What voltage is it?
What are the interior dimensions of the kiln?
I’m planning on a heat treat furnace but have been wondering how much power I should aim for.

The 100+ minutes of warm up time and maximum temps you are achieving has me leaning towards 240V, but my furnace will likely be smaller than yours so 120V might work.

Thanks for any info.

John
 
John - I don't want to get to far off-topic for this thread, but to give you a quick answer:

The furnace is fairly small; internal dimensions are 6.5" W x 4.25" H x 6"D. I do not know what the wattage is, but jewelry furnaces of similar size are around 1500 Watts so it is probably somewhere near that. I figured if it turned out to be too small I could make another furnace a bit larger and use the same controller, but for the small pieces I am doing it has worked out OK. If you have more questions feel free to PM me. For anybody wondering what the heck we are talking about: https://sites.google.com/site/lagadoacademy/machining---lathes-mills-etc/build---furnace-controller
 
For anyone interested in trying out a Rotary Table Controller program which uses acceleration and deceleration, I have an almost complete, partially tested Rotary Table Controller program. The program implements the following functions:
  • All user settings are stored in permanent memory
  • All user settings can be entered via keypad
  • All stepper motor moves use acceleration/deceleration
    • Maximum motor speed and acceleration are set by the user
  • Backlash compensation is implemented
  • Beep (audio) function is implemented
  • Move in indexed steps by setting degrees per move
  • Move in indexed steps by setting number of sides or (gear) teeth
  • Move in jog mode (small steps clockwise or counterclockwise)
  • Move in continuous rotation (clockwise or counterclockwise)
  • Not yet implemented: Move back and forth in a defined arc
The program is available for download here:
https://sites.google.com/site/lagadoacademy/miscellaneous-projects/stepper-motor---accelstepper-h

I'm interested in comments, suggestions, and bug finds from anyone who cares to try it out.

As noted above, everything in the program is working except the arc function, which I am just starting to design. The arc function will move the table back and forth in a defined arc. My current plan is something like this:
  • Use the jog function to move to the arc starting position (call it point A)
  • Define the arc ending position (call it point B) by one of these methods:
    • specify number of degrees from point A
    • use the jog function to move to point B and save the position
  • Move back and forth from A to B continuously (with keypad keys to start and stop)
 
Hello kquiggle,

your last version looks promising... I'm really excited! I will give it a try hopefully later today.
One thing I can add as a suggestion... for permanent movement in either direction a speed-control-function would be nice, maybe by using a separate potentiometer.
This makes it possible to use the programm for a welding table function as well.

Regards,
Sebastian
 
Hi kquiggle

I have tried to load your Rory table 7.25 program but it keeps on faailing with this message:


Arduino: 1.8.9 (Windows Store 1.8.21.0) (Windows 10), Board: "Arduino/Genuino Uno"

In file included from C:\Users\Rhynardt\Documents\Arduino\Arduino_Rotary_Table_Control_2019_Rev7.25\Arduino_Rotary_Table_Control_2019_Rev7.25.ino:79:0:

C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.21.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\libraries\Wire\src/Wire.h:33:1: error: expected unqualified-id before 'class'

class TwoWire : public Stream

^

C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.21.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\libraries\Wire\src/Wire.h:33:1: error: expected constructor, destructor, or type conversion before 'class'

exit status 1
Error compiling for board Arduino/Genuino Uno.

This report would have more information with
"Show verbose output during compilation"

option enabled in File -> Preferences.


What can i do to fix this?
 
Sebastian - your potentiometer idea is a good one. However, now that I have started working on adding the arc movement functions I am starting to get "low memory" warnings when compiling; I I think I can make it fit but I will need to do some code optimization. But I don't think I can fit in another speed control function. The current program does include an option for setting the continuous rotation speed. Another possibility would a separate program for rotary table applications which do not need to do indexing.

Rhynhardt1 - in answer to your problem with version 7.25 of the program: This sounds like the kind of error I see when there is a missing semi-colon or parenthesis. The first thing I would try is to download the program again and then try re0installing it. If that does not work, let me know. Just to be sure, I just re-downloaded and installed myself with no errors.
 
Hi kquiggle

Thanks for the prompt reply. Will try it today and give you feedback
 

Latest posts

Back
Top