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.
I have seen a mill setup using a fixed limit switch to index, when needed the table moved the tool away from the job to activate the limit switch to index and allow the part to rotate, then a delay before returning to the tool machining position.
 
I'm a CNC engineer, so I'd like to automate this more than it seems I can right now. I want to be able to enter an M code after each cut to trigger a relay/pulse telling the rotary table to index by whatever amount I had set in the indexer control. This is probably a question for kquiggle, although he said he doesn't really want to add more functionality to his program.
 
To do as I suggested earlier all you need is a couple of lines of G code in your program, the limit switch can be positioned on the column and operated from a fixed arm fitted on the table. Your sketch will need modding to provide the index when the switch is operated.
 
That's what I have in mind, but without the switch. My problem is modding the code to accept an outside signal instead of a button push. I've been wanting to learn more coding, so maybe this will be my chance, lol.
 
That looks like the same box I used for my rotary table. I found mine on eBay. This was my first project installing electronics into a box. I was surprised that I got all components to fit. Very pleased with the result. I'm thinking of doing a larger rotary table, thus a larger stepper, thus a larger stepper driver. This driver will not fit the box.
 
That looks like the same box I used for my rotary table. I found mine on eBay. This was my first project installing electronics into a box. I was surprised that I got all components to fit. Very pleased with the result. I'm thinking of doing a larger rotary table, thus a larger stepper, thus a larger stepper driver. This driver will not fit the box.
Unfortunately that box was too small for my driver board and even the LCD I got was a bit too wide to fit it. I ended up ordering this one: https://www.amazon.com/dp/B005T58ZTO?ref=ppx_yo2_dt_b_product_details&th=1 . It should arrive today, hopefully it works well.
I got the stepper mount done last night. I think it'll work out well. I'll post some pics when I get things farther along.
Thanks,
Mike
 
Any idea why it would fry a power supply when plugging it into the arduino? I set the output of the converter to 5.05VDC and as soon as you touch the plugs together they spark and fry both! Should I have had a higher voltage, was it trying to pull too many watts at this voltage? I have a 48VDC power supply going into my stepper controller & found a step down converter that would take 50VDC. I have another uno and a 48VDC to usb output coming tomorrow that I'm just going to plug into the USB port on the uno instead of the barrel connector, hoping it works better.
 
Any idea why it would fry a power supply when plugging it into the arduino? I set the output of the converter to 5.05VDC and as soon as you touch the plugs together they spark and fry both! Should I have had a higher voltage, was it trying to pull too many watts at this voltage? I have a 48VDC power supply going into my stepper controller & found a step down converter that would take 50VDC. I have another uno and a 48VDC to usb output coming tomorrow that I'm just going to plug into the USB port on the uno instead of the barrel connector, hoping it works better.
These low cost 'Buck' converters (I suspect you're using a buck converter vs. a transformer stepdown converter), can fail with the output switch full on, and that puts the full input into the output, (minus maybe a diode drop). These are very cheap power supplies, and have no protection against overvoltage. Unless you can find an overvoltage protection circuit, you just live with random failures that can result in blowing up low voltage micro processors. I believe the Uno has a 5 volt input, with a 3.3volt power supply on board, that too is a buck converter.
 
Hello
I have my components ordered to try and convert a 90-1 indexing head and a 72-1 rotary table I made based on the projects Philip Duclos published.
My electronics skills are weak but I am encouraged by this thread and Chuck Fellows thread.
My first question is what down load do I choose for the IDE installation. Windows installer or windows zip file. If I understand this right if I use the more convenient installer I will always have to be connected to the computer to run programs?
Dave
 
McRoth

The input voltage to all Arduinos can range from about 7 volts to 12 volts dc. For the internal 5 volt regulator to work, the input must be greater than 5 volts. The input is via the power connector not the five volt pins which are outputs from the regulator.

As for smoking your power supply etc, the most likely reason is that you had the polarity reversed with your connections. They are polarity sensitive and no second chances. I am also supprised the current limit feature (of most switch mode power supplies) didn't save it.

The cheap converters often marketed as buck regulators are reasonably reliable. I have used well over twenty or so without any problems but you would have to expect a failure from time to time. You should also check the output voltage with a volt meter before connecting to your Arduino.

Bruce
 
That's what I have in mind, but without the switch. My problem is modding the code to accept an outside signal instead of a button push. I've been wanting to learn more coding, so maybe this will be my chance, lol.
Depending on how the code is set up, the same boolean (true/false) changed by a push button could also be flipped by any sensor writing to the same variable. The MAP function is handy, as you can map any voltage range (potentiometer, proximity sensor, hall effect, etc) and have the software switch trigger when in a desired analog range.
edit* Without the caffeinated nerd language. You can have a proximity sensor change a condition to true when distance is within a certain range.
 
Thanks for the replies! I'm quite sure I had the polarity correct, I'm thinking it was pulling too much power at 5 volts, should've put it at 7 or 8 I'm thinking. They were cheap Amazon buck converters, so I'm not too worried about them. The step down to USB output is working good.
Zeb, thanks for the tip about the code. That does make sense to me.

Here are some progress pics. I have the stepper mounted and luckily I picked a powerful enough one, it turns great! I had the amps on the lowest setting at first and could hear it skipping steps accelerating and decelerating so I put it all the way up and it's good now.
 

Attachments

  • PXL_20211031_234029858.jpg
    PXL_20211031_234029858.jpg
    228.6 KB · Views: 269
  • PXL_20211031_234010497.jpg
    PXL_20211031_234010497.jpg
    191.7 KB · Views: 273
  • PXL_20211031_234111940.TS~2.mp4
    42.6 MB
Thanks for the replies! I'm quite sure I had the polarity correct, I'm thinking it was pulling too much power at 5 volts, should've put it at 7 or 8 I'm thinking. They were cheap Amazon buck converters, so I'm not too worried about them. The step down to USB output is working good.
Zeb, thanks for the tip about the code. That does make sense to me.

Here are some progress pics. I have the stepper mounted and luckily I picked a powerful enough one, it turns great! I had the amps on the lowest setting at first and could hear it skipping steps accelerating and decelerating so I put it all the way up and it's good now.
Here's the box I'm using.
 

Attachments

  • PXL_20211102_003212278.jpg
    PXL_20211102_003212278.jpg
    301.8 KB · Views: 177
  • Like
Reactions: Zeb
The approach I took on this thread
http://www.homemodelenginemachinist.com/showthread.php?t=25091&page=3
was to accumulate the fractional error and add a step when it was > 1.0 add another step.

Chuck Fellowes followed another approach. For the start of each division, he tracked how far around the circle he was and calculated how far around the circle he would be after the division, take the difference and move that number of steps.

Ultimately the result is identical. The adjustment algorithm depends a bit on the complete methodology you use to do your divisions.

As far as the data structure goes, using int or long will make no difference unless the number of steps moved exceeds the resolution of the data type. When I did this, I wanted to avoid the use of floats and inevitable rounding errors so I measured angles in the number of seconds of a degree using an unsigned long as there are 1,296,000 seconds in a circle. I wrote routines to input and display this value for angles in degrees, minutes and seconds but internally worked with seconds. Then when actually moving the rotary axis, I implemented a trapezoidal acceleration/deceleration algorithm to maximise torque on startup and overshoot at the end of the move. (You can't do instantaneous accelleration to maximum speed due to the laws of physics).

So what on the surface looks like a simple application becomes amazingly complex, particularly if you use interrupt driven step generation.
YOUR LINK IS NO LONGER PROPER AND GETS A "OPPS" ERROR
 
This is the unit I made.
IMG_20220314_172320.jpg


reduction 1 : 4
IMG_20220314_172332.jpg


inside
IMG_20220314_172222.jpg

print
IMG_20220308_191329.jpg

milling the PCB
IMG_20220308_165351.jpg


Because I don't get a nice number for the original multiplier (35.555...) I modified 3 lines:

line 32? -> const int Multiplier=(StepsPerRotation*TableRatio); // I deleted division by 360
line 102? -> ToMove=map(Degrees,0,360,0,Multiplier); // here is map used to get the amount of steps ToMove
line 109? ->ToMove=map(Degrees,0,360,0,Multiplier);

The degrees input is here limited to 360 degrees.
Steppermotor is set 1/16 so 3200 steps/rev and the ratio is 4 --> Multiplier is 12800

I am happy that it works. :)
 
Last edited:
I am wondering if a n ESP32 would be a better choice than an Arduino. It includes wifi which would enable wireless CNC control, or control from a mobile phone.
 
No need for speed. A wire is more secure than wireless, but maybe that is an old idea.
 
adzijderlaan

This project has been around for a long time and while the original contributor did (I think anyway) a reasonably good job of it. Yes there were a few issues but it was a good starting point for most.

The main problem has been around the use of integers rather than reals so changing those is a good start. I have modified the sketch for many people for ratios from 4:1 to 120 :1 all of which have been successful.

As for exceeding 360 deg you need to use long integers otherwise it fails when you set a step deg of 280 deg or so. See the below section of code. When you are setting up a work piece in a four jaw chuck on the rotary table you need to be able to select 90 deg steps for the initial adjustment and finally say 1080 for the final check which gives you three continuous revs.

If you would like my sketch, send me an email.

Bruce Weir-Smith
Western Australia




void rotation(long tm, int d)
{
for(long i = 0; i < tm; i++) // Problem Fix
{
digitalWrite(stp, HIGH);
delay(stepdelay);
digitalWrite(stp, LOW);
delay(stepdelay);
}
 

Latest posts

Back
Top