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.
Hi Kquiggle

I have downloaded the file again and its working perfectly thanks!
 
Rhynardt1: Thanks for the feedback.

FYI there is a bug in the V2-Rev4.00 program version that prevents backlash correction from being set to zero (turned off). I made a quick fix and uploaded the new program as V2-Rev4.01 - this is available now if this matters to you.

A reminder to anyone reading this: This software is for testing only so there are probably more bugs lurking. I have received a report from another tester that his motor is stalling when he tries to run it in the continuous run mode. I think he may have speed or acceleration set too high,but I could be wrong about this.

Here is what I do know right now: The program is working with my indexer. When I run in in constant run mode, I can hear the motor accelerating. I think this is correct behavior, as the idea is to give the motor time to move a heavy rotary table up to speed (and then decelerate slowly when stopping). However, I only have one indexer to test on, so I am very interested to see how the program works for others.

For anyone testing the program, I would very much appreciate feedback as to whether it worked for you or not. Also, what did you like (or not like) about the program?

Download link:
https://sites.google.com/site/lagadoacademy/miscellaneous-projects/stepper-motor---accelstepper-h
 
Downloaded and tried version 4.11. My stepper is not yet installed on the rotab but everything operates properly with the correct rotations for my setup. I had a bit of difficulty downloading the accelstepper.h library but finally found the link imbedded in the middle of the page - it's definitely not obvious.

I like the interface changes. I really like the accel/decel. I suspect that it will significantly decrease the likelyhood of missed steps. A bit more info on the stetting variables would be helpful, in particular the units. I am assuming they are percent unless otherwise noted. It also appears that the percent can be larger than 100. Are there limits to these values?

It looks like there is an interrelation between stepDelay and stepperMaximumSpeed. A step delay of 1000 microsec implies a maxium output step frequency of 1kHz and a stepperMaximumSpeed of 500 gives 500Hz or a pulse cycle of 2000 microseconds. If I interpret it correctly, the stepDelay must be less than half 1000000/stepperMaximumSpeed assuming a 50% step duty cycle. Is that correct?

Great job so far. I'm looking forward to the next release.
 
SailplaneDrive - I am glad it is working for you, but please keep in mind it's unfinished and not bug-free. I'm currently working on V2-Rev4.50 with a few improvements (but too many bugs yet to be released). With any luck I should have an update posted sometime next week.

I think you are right about stepDelay but I am far from an expert on this so I will defer to others who are more knowledgeable. The version I will be posting next does not use the stepDelay parameter at all, and all of the stepper movement is handled through AccelStepper.h

The program comments contain some useful information on the program but I will add more detail on parameter setting and program operation. Eventually I will post some information on the web page (link below) but I will update the program comments first so that anyone with the program also has the instructions.

https://sites.google.com/site/lagadoacademy/miscellaneous-projects/stepper-motor---accelstepper-h
 
SailplaneDrive - you are correct. In the version you have, there is a setting option for it but it's not used. It's sort of like an appendix - I took it out of the next version.
 
An updated version (V2 - Rev.4.66) of my Rotary Table Control program with acceleration/deceleration is available at the link below. This is a fully working and tested program, but it should still be considered a "working beta" until it has undergone more extensive use and testing. The program is available at the link below. Please read the program comments for instructions and suggestion on use.

Also - many thanks to "VK" for helping to test this program and for many good comments and suggestions.

The program code includes extensive instructions on how to use the program, how to determine optimal speed and acceleration settings, how to determine required backlash corrections, etc.

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 (can be switched on or off)
  • Beep (audio) function is implemented (can be switched on or off)
  • 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)
    • speed and acceleration for this can be set
    • in particular, speed can be reduced for machining purposes
  • Move in arc mode: Move back and forth in a defined arc
https://sites.google.com/site/lagadoacademy/miscellaneous-projects/stepper-motor---accelstepper-h
 
I thought I would add an additional note here about a useful method I found to monitor rotary table position for the purposes of testing backlash compensation and indexer accuracy. It is quite simple: Just attach a laser pointer to the table and point it at a nearby wall. I then mark the position of the laser dot with a sticky note with a black dot on it (see the photo).

Then, for example, if you rotate the table 360 and the dot does not return to the exact same position, you will know there is an error in your indexer somewhere.

If you rotate the table a full 360 degrees in one direction, and then a full 360 degrees in the opposite direction you will see that the dot does not return to the original position due to backlash. In the comments written into my program linked to in my previous post, I explain how to use this method (along with program features) to determine (and compensate for) backlash.

I use a wall about 2 ft away for this purpose and find the dot is quite sensitive to motor stepping; I can easily detect movement of a 1/2-step. For even more sensitivity, just move farther from the wall.


laser-dot.jpg
 
People who have been following this thread may be interested in a video I just ran across on building an Electronic Lead Screw. Even if you are just thinking about building an electronic indexer, the video has a good overview of the different types of Arduinos and other microprocessors, and their pros and cons.
 
The final version Arduino_Rotary_Table_Control_2019_V2-Rev4.68.ino of my program which implements acceleration and deceleration is available at the link below. If you are trying this program for the first time (even if you tried an earlier version) you must use the Settings mode first to enter your stepper and rotary table parameters.

This is "final" in the sense that there will be no additional program features added, but if any bugs are reported to me I will post fixes as they become available; I will also note any issues on the page linked to below. Bugs can be reported by replying to this thread, or by sending an email to the address found at the link below.

Additional note to anyone trying out this program: I would appreciate if you would let me know what program parameters (maximum speed, acceleration, etc.) worked for your indexer (as well as a brief description of your hardware) as I would like to get a general idea of what workable settings should be.

Finally, I would like to thank a couple of people (you know who you are!) who helped out with testing earlier versions of this program and who contributed many good comments and suggestions.

Program download and additional information here:

https://sites.google.com/site/lagadoacademy/miscellaneous-projects/stepper-motor---accelstepper-h
 
A couple of minor bug fixes to the final version (now Arduino_Rotary_Table_Control_2019_V2-Rev4.69.ino) of my program which implements acceleration and deceleration is available at the link below. If you are trying this program for the first time (even if you tried an earlier version) you must use the Settings mode first to enter your stepper and rotary table parameters.

These are the only bugs reported since the "final" version was published on April 17, 2019 so I believe the code is reasonably bug-free at this point. However, I will do my best to address any issues that may be reported in the future.

Program download and additional information here:

https://sites.google.com/site/lagadoacademy/miscellaneous-projects/stepper-motor---accelstepper-h
 
Greetings,

I'm getting a bug during the test (under verify), please help my.

//decelerate to a stop
stepper.stop(); //Reset target for deceleration "here is the error code"
stepper.runToPosition();
makeBeep(halt);

Regards, KIM
 
Hi kquiggle
I have successfully tried your code and it work like a charm :) I have come up with may be one more idea of upgrading it but not sure how to better change the code to activate electromagnetic breaks straight after indexing move with short "beep" and deactivate like 10 milliseconds before next indexing move begins.
It my be useful to others who utilized small stepper motors in this project and it will make possible ( with right hardware) to make "direct driven" indexing table :)
Thanks
Ilia
 
KIM - I don't think I understand what bug you are seeing - can you please clarify?

Ilia - I'm guessing you want to implement some sort of automated table lock, which is the reason for your question. In any case, the answer would be to write a simple function to activate/deactivate an IO pin, and then insert the function in the appropriate place in the code. My goal right now with the current version of the code is to finalize it with respect to adding any new features, and just make bug fixes. However, I would consider publishing a second experimental version with the function you described if you can give me some additional detail on what you plan to do in terms of hardware. As I said, I am assuming that you want to make a particular hardware IO pin go HIGH after indexing and LOW before indexing (or vice versa) in order to activate a relay. I can write the necessary code, but I would need someone to test it.
 
SailplaneDriver - I am looking into ways to wire in a stop button, but I am not optimistic about finding a good method. One option you might consider for a "panic stop" button is to wire a button to the reset switch. Pressing reset will result in a dead stop (no deceleration) and loss of current position information but is probably the best choice for an emergency stop, aside from just killing power to the motor (in fact a power on/off switch is another option).

Note also that a stop button cannot be used when moving in index mode because the AccelStepper.h function used is "blocking" - there is no option for the code to look for a stop button press. It may be that the use of an interrupt could work around this, but this needs further exploration (again, I am not optimistic). I could have used a non-blocking function for index moves but there are drawbacks to that as well, and since I thought that since most index moves are over fairly quickly (at least for me when making gears) that a stop option wouldn't add much benefit. There is a stop option in continuous move mode already and that seems to work reasonably well.
 
Update for anyone interested in operating a relay along with the stepper motor:

A program version Arduino_Rotary_Table_Control_2019_V2-Rev4.69B.ino has been posted which implements this function. The code was kindly supplied to me by VK; I have not tested it myself as I do not have a relay set up, but I see no reason why it should not work from a programming viewpoint.

Program download and additional information here:

https://sites.google.com/site/lagadoacademy/miscellaneous-projects/stepper-motor---accelstepper-h
 
To program a quick stop, you can use the button press to change the "target" value to the current running value adding some extra steps to cope with safe deceleration. In this way, you can stop without losing position.
 

Latest posts

Back
Top