Tips for Arduno software for Rotary Table Controllers

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.
Rod, just another thought. On my old RT controller I add an enable switch for the driver, and it came in very handy allowing me to turn the table using the hand wheel for quick setup and fine alignment. Also helps keep the stepper cooler when not in use for long time. Carl
 
Rod, did I find a bug or don't I understand correctly. When I bring up "set Speed" and set a number, I then click on Select. When I go back to "Set Speed the number is about one half the previous setting. Go back to "Select" and back it halfed again. IE... I set speed to 70% /select/set speed/50%/select/set speed/28%/select/set speed/ 13%/select/ set speed/5%. Etc. Some times after boot my set speed is 0%. Hope you understand what I am trying to point out. Carl

Carl, Thanks. I got all the code rearranged so it uses the data stored in EEPROM last night and after that, I noticed that there was something strange happening in the speed control you mention but everything else is tested and working as expected.

I am rethinking my approach to speed control as now I can specify it in setup as well but both are currently entered in different ways. It's been good to be able to play with the speed on the fly. Its amazing to see how quick I can get the table to move (but at the expense of missing steps on Startup)

I also want to work on some speed ramp up ad ramp down code. I think there are 3 speed parameters:
1. Slowest Speed/Maximum torque
2. Fastest speed/minimum torque
3. Current Operating speed (normally the same as fastest speed but able to be overridden)

I finally found a good article about ramp Up and Ramp Down which says to start at the minimum and ramp up the speed with each stepper pulse until it gets to operating speed. On Ramp down, do the opposite starting before the end of the current movement so you finish at the slow speed.

Rod, just another thought. On my old RT controller I add an enable switch for the driver, and it came in very handy allowing me to turn the table using the hand wheel for quick setup and fine alignment. Also helps keep the stepper cooler when not in use for long time. Carl

I have not got that far yet and am still using 2 power supplies (5V & 19V) but I'll remember that when it gets into a box. On my table the handwheel is gone though and it is hard to turn manually (hence the jog functions)! Using a stepper with a double ended shaft would let you put a hand wheel back on.
 
For got to mention that I have added a feature to the Continuous turning mode so you can change direction on the fly with left/right buttons. I need to allow for ramp up and ramp down once it is done.
 
Carl, Thanks. I got all the code rearranged so it uses the data stored in EEPROM last night and after that, I noticed that there was something strange happening in the speed control you mention but everything else is tested and working as expected.

I am rethinking my approach to speed control as now I can specify it in setup as well but both are currently entered in different ways. It's been good to be able to play with the speed on the fly. Its amazing to see how quick I can get the table to move (but at the expense of missing steps on Startup)

I also want to work on some speed ramp up ad ramp down code. I think there are 3 speed parameters:
1. Slowest Speed/Maximum torque
2. Fastest speed/minimum torque
3. Current Operating speed (normally the same as fastest speed but able to be overridden)

I finally found a good article about ramp Up and Ramp Down which says to start at the minimum and ramp up the speed with each stepper pulse until it gets to operating speed. On Ramp down, do the opposite starting before the end of the current movement so you finish at the slow speed.



I have not got that far yet and am still using 2 power supplies (5V & 19V) but I'll remember that when it gets into a box. On my table the handwheel is gone though and it is hard to turn manually (hence the jog functions)! Using a stepper with a double ended shaft would let you put a hand wheel back on.
Handwheel is needed but on mine I have a 3:1 drive belt into an eight inch 90 turn table. I am using only a nema 17 stepper so I have a way to turn it by hand. Sounds under powered but I have loaded the table up with #70 and it turned with out loosing any steps. Thanks for your great work. Carl
 
Handwheel is needed but on mine I have a 3:1 drive belt into an eight inch 90 turn table. I am using only a nema 17 stepper so I have a way to turn it by hand. Sounds under powered but I have loaded the table up with #70 and it turned with out loosing any steps. Thanks for your great work. Carl

Thanks for the encouragement. I ave a couple of Nema 17's here too but the mounting was easier with the NEMA 23.

Read ramp up stuff again. The algorithim will be:
Ramp up period is 20% of the division
Max speed period is 60% of the division
Ramp down is 20% of the division

we are going to talk Herz below but internally, we'll convert it to the timer interrupt delay (microseconds)
Lets assume a movement of 1,000 steps
1. Start at the specified (slow) starting speed (400 Hz is current default).
2. take 20% of the movement (200) steps
3.After each stepper pulse, reduce the timer delay by 1 microsecond for each of those 200 steps (speeding up), stopping if the maximum speed is reached (1000 Hz is current default).
4.Run at that speed for 600 steps (60%)
5.For the last 200 steps (20%), slow the stepper down by increasing the timer delay by 1 microsecond each step until it stops.

So on small movements we may never get to maximum speed but will always be accurate which is the goal!

I think for a microstepper, we should only change the speed for each full motor step (10 microsteps in the case of my Gecko)

Carl, your NEMA17 will thank me!
 
Thanks for the encouragement. I ave a couple of Nema 17's here too but the mounting was easier with the NEMA 23.

Read ramp up stuff again. The algorithim will be:
Ramp up period is 20% of the division
Max speed period is 60% of the division
Ramp down is 20% of the division

we are going to talk Herz below but internally, we'll convert it to the timer interrupt delay (microseconds)
Lets assume a movement of 1,000 steps
1. Start at the specified (slow) starting speed (400 Hz is current default).
2. take 20% of the movement (200) steps
3.After each stepper pulse, reduce the timer delay by 1 microsecond for each of those 200 steps (speeding up), stopping if the maximum speed is reached (1000 Hz is current default).
4.Run at that speed for 600 steps (60%)
5.For the last 200 steps (20%), slow the stepper down by increasing the timer delay by 1 microsecond each step until it stops.

So on small movements we may never get to maximum speed but will always be accurate which is the goal!

I think for a microstepper, we should only change the speed for each full motor step (10 microsteps in the case of my Gecko)

Carl, your NEMA17 will thank me!
I think that a set speed option in setup would be great. And, my nema 17 is waiting for your help. In ChuckF's skitch the speed defalt was s5 and my 17 didn't like that but ran great when I changed it to s1 or s2.


PS, hope your summer is going great for you. I am in Maine and it's the coldest winter in History. Tons of snow if you want some. LOL Carl
 
Are you still looking for a drawing of the vertex mounting ?
I make these for a company but the drawing and design is mine so I don't mind sharing.
 
Are you still looking for a drawing of the vertex mounting ?
I make these for a company but the drawing and design is mine so I don't mind sharing.

John, thanks, I'm happy with my open cage design. Initially I was going to do it similar to yours but somebody talked me into a different design.

It would be great if you could share your drawings though.
 
OK will sort them out. Checked last night and the ones I have are not complete. I have a 'pattern' set I tend to copy for each batch so I know they work but as all drawings are at my expense and not the customers they tend to be either crude or not updated.
 
OK will sort them out. Checked last night and the ones I have are not complete. I have a 'pattern' set I tend to copy for each batch so I know they work but as all drawings are at my expense and not the customers they tend to be either crude or not updated.

John, is this your design for the vertex tables?

vertexhv4hv6.jpg


I drew up a variant of this where the flange was bolted to a cylinder. Initially, I wanted to see if I could put the mounting bolts on the outside but found there is not enough room and they need to be mounted internally as per this example.

Its actually quite a good exercise in using a a rotary table for the newcomer as the bolt holes can be positioned by dividing so everything is concentric to the stepper shaft.

The key measurements for the Vertex are:
Outer diamater to match vertex collar: 56mm
Centre bore for table shaft: 21mm dia
Main cylinder bore: 43mm (ensure clearance for internal mounting bolt heads)
3 x holes for M5 mounting bolts to the table collar: 5.1 mm dia on PCD of 32 mm
4 x M5 tapped holes for NEMA 23 mount on flange: 4.2mm dia on PCD of 66.66 mm (start at 45 degrees).

Length - to suit your stepper (mine has a long shaft)
Slot cylinder to access shaft coupling screws.
Flange side: match NEMA23 dimensions: 56.4mm
 
Slot cylinder to access shaft coupling screws.

I have seen a few mounts where people put great big holes in the side of the mount to get at the coupling screws.
On my 4th axis there is 1 pipe plug. You mount the coupling on one of the shafts and tighten it's screw. Then turn the shaft so it aligns with the one hole in the mount and insert the mount and line the coupling up with the other shaft tighten the coupling through the hole. And then finish tightening the mount.

You really only need access to one of them.

Scott

P1030465.jpg
 
Yes Rod, they are my design. There are only two parts, the flanged tube although that does have a pressed in steel mounting flange with the 21 mm hole in it and the actual steel stepper mounting.
It's done this was as the three bolts holding the tubs on never sit in the same position table to table, it depends on the mesh of the worm.
But if the flange is separate then you can always get the motor to sit square.

I also convert table for about 4 companies as well. Not all Vertex.
 
Yes Rod, they are my design.
It's done this was as the three bolts holding the tubs on never sit in the same position table to table, it depends on the mesh of the worm.
But if the flange is separate then you can always get the motor to sit square.

Interesting, so just loosening the grub screws on the Vertex collar and turning the assembly does not give enough adjustment? This is how I aligned mine, but it's only one table :)

It looks like I've finally got the software ramping up and down the speed correctly. Still need a bit of cleaning up the code before I get it back on the rotary table. I need to do that before I know I've succeeded as I'm not sure if it is OK to change the interrupt timer delay in the middle of an Interrupt Service routine.

I've been caught a couple of times where perfectly legal C code in an if() statement does not work as expected on the Arduino. Creating the value in a variable and then testing it in the if() statement then works fine. Very frustrating!

I think the algorithim I 'm using for short steps where the number of pulses are insufficient to ramp up to full speed needs to be changed. I'm using (20% ramp up, 60% running, 20% ramp down). I think it should be closer to 45%% ramp up, 10% running, 45% ramp down to maximise performance.

It'll be fun playing with the settings to see if speed on a soft start can be increased past the current limits I've observed.
 
My tubes don't fit by the collar, they fit using the three existing tapped holes when the dial assembly is removed.
Don't think I have a vertex unit here but my girlfriend has one and I'm up there at the week end so I'll strip it, take some pictures and measurements and post early next week.
 
My tubes don't fit by the collar, they fit using the three existing tapped holes when the dial assembly is removed.
Don't think I have a vertex unit here but my girlfriend has one and I'm up there at the week end so I'll strip it, take some pictures and measurements and post early next week.

John real appreciate your input in the hardware. It will be good to have it here with the software.

I think that a set speed option in setup would be great. And, my nema 17 is waiting for your help. In ChuckF's skitch the speed defalt was s5 and my 17 didn't like that but ran great when I changed it to s1 or s2.
[/I]

I still need to do a bit more debugging but have made some great progress on the soft start/ramp up code. It is working fine when dividing and it appears the stepper can be driven faster.

Its been a bit tricky to get the speed to ramp down in continuous and constant jogging modes. For some reason, it won't work until the code s called once, and then it works fine. I have to work out what gets initialised.

I was starting it from 400 Hz and ramping up to 12000 Hz with a NEMA 17 and the little stepper sounds like a jet engine coming to life! Its interesting to watch in continuous mode when you change direction. It slowly stops before ramping up to speed in the reverse direction. (400 is to slow as it takes quite a while to get to speed.

I guess you guys will want video....
 
Well, here it is. Main New features are:
1. Stepper ramps up and ramps down from/to Max Stepper Frequency
2. All defaults saved in EEPROM memory

This version saves all defaults to the EEprom. This has required an additional header file which is included in the zip file. Copy into the Libraries folder (I put it in the LCD folder). This is one of the standard files available on the Arduino web site. See:
http://playground.arduino.cc/Code/EEPROMWriteAnything

Settings (including stepper and direction pins, minimum frequency and maximum frequency) are stored. "Max Stepper Hz" and "Min Stepper Hz" control the speed the stepper starts to ramp up from and also the maximum running speed. These defaults can be edited in the <Setup> Menu.

There is a "Save Settings?" option in the setup menu. If this is set to "Yes", the defaults are written to EEPROM when you press select to exit the menu. If you just want to try settings without saving them, leave it set to "No". You can go back into the setup menu and save them later.

Note the timer Delay is no longer used to control stepper speed but it still remains in the setup menu. Ignore it.

The speed control has been removed in this version.
Speed is controlled by the "Max Stepper Hz". You'll probably want to put the "Min Stepper Hz" to around 1000 as at 400, it is very slow to ramp up. I'll probably add it back in but you can control speed by changing "Max Stepper Hz". Maybe try it at 10,000 but I was able to push it though to about 15,000. The good thing is you don't need to be tethered to a PC to make these changed as they are set in the user interface on the Arduino.

This is a massive rework and should allow you to get more out of your stepper. Bugs most likely abound. I did get some odd behaviour when it was wired up to my rotary table but I have made a lot of changes, since then and have not taken it back in the shed but have been running another stepper on the bench while coding.

I'l be interested to hear if this is kinder on NEMA17 stepper motors.

View attachment RotaryTableChuck7.zip
 
Where do I get all the rest of the libraries? The zip has only the main program and one .h file

Ron, if you go to the very first post, I've edited by adding a header that has a link to post #20 with all the prerequsites and the latest version which is updated every time I do an update.
 

Latest posts

Back
Top