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.
The second issue is that the ground of your driver board will be at -12v. The +5 from the supply is now +17 v when referenced to the driver. If you’re using the +5 to power an Arduino or something else connected to the driver then unless the grounds are kept separate you will be shorting out the -12v rail.
I had planned on using +12v on the + rail and -12v on the - rail, done this before to get 24v. But bmac2 is correct only 1 amp on the -12v rail. Given the stepper specs this still might work.

PS original usage was to build live steam parts.
 
The voltage that is ideal for a specific stepper motor is based on its inductance. On the Gecko drives site there is an explanation as to how you calculate that voltage. You then need drivers that can handle that voltage to get maximum performance.

In any event this highlights a couple of things. One it is possible to match motor inductance to the power supply available. Second you don't always need max performance out of the motor. If you are hell bent on using a PC power supplies 12 VDC rail make sure you have a low inductance motor that will run well on 12 VDC.

This highlights another issue, sometimes you can get better performance out of a smaller motor if your power supply is less than optimal.

A related problem that i see in the reprap and CNC forums is that people tend to set the current settings on their drives often because they believe the motor is running too hot. This can completely trash stepper performance. You want the motor driver to run the motor at its rated current to get full performance. In a nut shell current impacts torque and voltage allows you to over come inductance faster, proper values for the stepper in question leads to the best possible performance.

Now on a worm driven rotary table you have significant gearing advantages so maybe you don't need max performance. That is possible but you never know what you may be doing in the future and end up with a drive failure due to the lack of torque.

So what is all this gibberish? Simply a suggestion to make sure you are getting maximum performance for when you need it.
 
On the Gecko drives site there is an explanation as to how you calculate that voltage.
Did that;

32 x sqrt16.2 = 128.7975 but at what amps?

Because remember my motor is rated 8.6v at 2 amps.

So would that mean 0.1335 amps at 128.7975 volts?

I'm asking this because I am willing to change both the driver and power supply, but need to know what would be both relatively safe for the motor as well as cost effective for me.


Would some thing like this work, or is it too small voltage wise if I keep to the recommended input voltage?

Input voltage 9-42 V (24 V recommended)
Ouput Current 0.5-4.0 A
Maxium frequency: 20KHz

Is this driver better?

Input voltage: 20 - 40 VDC
Output current: 7 selections of 0.30 - 2.20A
Maximum frequency: 75KHz

I'm guessing it might be for my stepper.
 
Don't overcomplicate things.

If you are going to upgrade hardware, don't stuff around and go with 48 volts. It is common to send much higher voltages to the drive than what the spec says.

I can recommend 2 quality drivers but the Gecko is the smallest so it might be easy to fit in an enclosure.
Gecko g251x http://www.geckodrive.com/g251x.html

Longs Motors DM542a https://www.ebay.com/itm/High-1pcs-...VDC-CNC-New-/131184809631?hash=item1e8b39569f
Make sure you get one with an elephant on it. I have 5 of these driving my 1200mm x 1200mm plasma table and they fairly scream!

The main thing is to limit the current on the driver so it does not exceed the drive rating so if yours is 2 amps, set the current to 2 amps. Gecko uses a resistor, Longs Motor uses a DIP switch
 
Did that;

32 x sqrt16.2 = 128.7975 but at what amps?
You run stepper motors at their rated current, nothing more and nothing less. It is the responsibility of the stepper driver to regulate the current to the motor. It will do this if the driver is set up properly.
Because remember my motor is rated 8.6v at 2 amps.
Doesn't matter, a properly set up drive regulates the current. The big issue here is that the stepper requires a fairly high voltage to get max performance. Id strongky suggest sourcing a stepper with a lower inductance that can operate successfully on a lower voltage and thus more commonly available drives.
So would that mean 0.1335 amps at 128.7975 volts?
No! Steppers are current based devices, best performance comes at the rated value for the stepper.
I'm asking this because I am willing to change both the driver and power supply, but need to know what would be both relatively safe for the motor as well as cost effective for me.
Buy a stepper motor with a lower inductance that can operate off lower voltage power supplies.

You can try running this stepper off a supply of less than 80VDC and see what happens but you wont get max performance. . It might be good enough if ultimate speed isn't important. In the end though the right answer is to buy a drive/stepper/power supply combo that work well together.
Would some thing like this work, or is it too small voltage wise if I keep to the recommended input voltage?
That doesn't even translate into something that makes sense to me. So a quick stepper primmer.

Current affects torque, you always want your driver set up to run the stepper at its rated current otherwise torque is compromised.

Second inductance impacts the rate of change to current flow in a circuit. In the case of steppers high inductance means a slow motor for a given power supply.

Applying a higher voltage to a high inductance stepper will change the current through the windings faster. The little bit of math that we use finds what that max voltage should be.

Now modern drives regulate the current in the motors by rapidly switching the voltage to the windings thus the motor never sees the power supply voltage for any length if time. So the concern about voltage has to do with the speed at which the drive can saturate the windings and thus the ultimate speed of the stepper. So max performance demands a power supply close to your calculated value.

Now your problem is that the vast majority of low cost solutions operate at less than 80 volts DC. This means you either need a new stepper or a high voltage drive to get max performance out of your stepper. It is one or the other if you need max performance.

In a nut shell you would be far better off with a different stepper that can run off commonly available power supplies. Commonly available supplies have voltages of 5, 12, 24, 28 and 48 VDC. With a bit of searching you can also find supplies in the 72-80 volt range for servo or stepper use.

The trick is to fit all of your electronics into a suitable panel bos, ideally one that isn't huge. In this regard you really want to think carefully about the voltage you settle upon
Is this driver better?



I'm guessing it might be for my stepper.

Don't guess! Really that will lead to excessive frustration. Post questions here but more importantly look for stepper motor tutorials on the net and spend some time learning about the tech. This will allow you to make wise decisions about the parts you buy. In a nut shell a little bit of engineering up front goes a long way.
 
Buy a stepper motor with a lower inductance that can operate off lower voltage power supplies.

Or just get a higher voltage power supply.

Lower inductance generally means higher cost so choose your options carefully to stay in budget. Regardless of the inductance, doubling the voltage more than quadruples the torque.
 
Ok, I ordered the stuff, waited three months, then followed the instructions and made it to post 19. Bob says if you own a scope you probably stop reading? Not me LOL. I finished the project but the stepper will not move? Every thing seems to work and I tried two different stepper drives. The first was a Pokeys 25-32 which I had never used before and purchased for another project. I suspected it might be the issue so I connected a TB6600 which is wired like the one Bob used. No go.

Having an O scope and some limited knowledge I attached it to the Arduino pin 2 to see if I could find a trace of the step signal and I get nothing? I went back to post 19 to look at the photo of Bob's scope to see what he had set it to. I have a Tec 2232 and set it to the same as Bob's and then set the controller to do 60 degrees, pressed A and waited to see something and there was nothing but noise?

The only changes I made to the code were 1600 steps, as I am using a nema 17 200 step motor and eighth steps on the controller. I also changed the ratio to 72 as I am using a Sherline rotary table. I am confused as to what I am doing wrong?

Any direction here would be most appreciated as I have no experience with programming an Ardunio. I have done a little with VB in Mach3 and that is about the extent of my programming.

Apparently Bob's wife is smarter then me and I am dummer then the dummies this tutorial was intended for?

Thanks,

Jeff K.
 
Hi Jeff
If your seeing nothing but noise on your scope check that the ground lead on the scope probe is connected to the Arduinos GND. You could start with the “Blink” sketch and the delays set to 100 or so and have a look at pin 13 with your scope. If the LED on the board is flashing you will have a square wave on the scope.
I’d suggest stepping back a bit and start by loading the stock sketch as is and run it with the controller disconnected. If you can see the step signal on the Arduino then connect the controller. It looks like on the TB6600 “ENA-“should be connected to the Arduino GND. Then connect the scope probe ground clip to the “-“ terminal of the stepper supply and check that you have something on the stepper output. If that’s working connect your stepper and once it’s up and running then tweak the software.
 
I second the advice to start with an example sketch (like "Blink"). I recently received a Chinese clone Arduino with a simple robotic car kit and although it powers on, it refuses to communicate with the Arduino environment, so it's very possible to get dodgy boards. Some day, when all the other things I have on the to-do list have been achieved, I'm going to build one of these rotary table controllers as well...
 
Hi Cogsy I see on the news that you are definitely in “The Heat of Summer” down under. We were at a high one day last week of -31 and then today +3. Got to love winter in Canada.

For your Arduine, stragenmitsuko (Pat) mentioned that a lot of the Chinese cloned use a CH340 uart. You just have to download/install the driver. Easy peasy.
https://sparks.gogo.co.nz/ch340.html
 
I recently received a Chinese clone Arduino with a simple robotic car kit and although it powers on, it refuses to communicate with the Arduino environment, so it's very possible to get dodgy boards.

Its not uncommon to have problems with setting up USB serial ports on a Windows machine regardless of who made the chipset. If you have a poke around using Device Manager, you can often find the correct COM port in the Arduino IDE. Sometimes though you will need to install the correct device driver and then Device Manager may give you a clue on what to look for.
 
Thanks for the reply. I did disconnect the driver and power supply prior to making the check with the scope. As for the 6600 I have one on the bench connected to my other project I was working on prior to getting the components for this one. It is attached to a rotary tool changer I built to go on the sherline cnc lathe. It is connected to a breakout board and I can jog the axis with Mach3 but am having trouble with the VB script program. That aside it works without attaching anything to the enable pin. I am charging my camera up so I can provide a photo of my setup for you. I am not very experienced with the scope and bought it to work out some problems with a Pokeys57cnc board I am using for a cnc conversion at work.

I will re-flash the arduino with the original sketch and try that. What do you suggest I set the scope for in divisions and period? I am using a 10x probe and had the div at 10 and the period at 1 ms.

By the way I did check to make sure I had a good ground. I was using the ground pin that went to the controller per your instructions. I was thinking maybe I should have the wife or my daughter do it for me!!! Hopefully I will have some photos and results for you before church this morning. If not it will need to wait till after lunch.

Thanks again,

Jeff k.
 
Here are some pics!

DSC00789.jpg


DSC00790.jpg


DSC00791.jpg


DSC00792.jpg
 
Using original sketch

1600 steps and 72 ratio returns '-1320 steps' . . . Knock it back down to 400 steps [half step]

Rod is by far better with code as to why it returns a minus @ 1600 than I . . .
 
I put it back to the original 400 and 36 and got a good scope reading. I did set the driver to half step and then hooked it up and it worked. I need to change the ratio to 72 and see if it will still works?

Thanks,

Jeff K.
 
Excellent this will stop you having to get your wife's help. Believe me it will save you HOURS is standing in the mall, holding her purse, and looking at shoes that all look the same
 
Should be good at 72
Just stripped out from the sketch all that wasn't needed to get a step value


// int yields a range of -32,768 to 32,767
// const int good for 400 [half step]

const int StepsPerRotation = 400; // Set Steps per rotation of stepper NOTE the driver is set to Half step
const int TableRatio = 72; // ratio of rotary table
const int Multiplier = (StepsPerRotation * TableRatio)/360; // 200*90=18000/360 = 50
// const long StepsPerRotation = 800; // Set Steps per rotation of stepper NOTE the driver is set to Half step
//const long TableRatio = 72; // ratio of rotary table
// const long Multiplier = (StepsPerRotation * TableRatio) / 360; // 200*90=18000/360 = 50

float Degrees = 180; // Degrees from Serial input
float ToMove = (Degrees*Multiplier); // Steps to move


void setup()
{
Serial.begin(9600);
Serial.println((StepsPerRotation * TableRatio) / 360);
Serial.println(ToMove);
}

void loop() // MAIN LOOP
{
}

Something about 'int' being limited which my minimal skills sparked as a red flag . . .- anywho const int works with the numbers even at 360 degree rotation
 
Bob,

That is why I was going to ask my 16 year old daughter first! dodged the bullet there. Anyway here are the results ....it will not work with anything but 400 steps (1/2 step)? I would really like to take better advantage of micro stepping as it has a lot of resonance at 1/2 step. Do you have any suggestions as to how to make that happen? I am using a 20V 3A power supply and a nema 17 84 ozin stepper with 3mh inductance @ 1 khz and 2A rating.

Thanks,

Jeff K.
 
You guys are getting caught up with overflow of the datatype. As said an int can count from -32767 to +32767 so if you add 1 to 32767, you get -32767.

400 * 72 = 28,800 which is getting up near 32767 so you can't go past 400 steps per rev.

If you use const unsigned int, you get to count from 0 to 65,534 which may help but really the code needs a bit of cleaning up at this point. Personally, I would use a #define to set the rotation parameters. This is a preprocessor directive that generates no code but when the compiler sees a #define it blindly substitutes what is on the #define statement. Convention says #defines are shown in capital letters to designate its a #define not a variable.

You are also probably getting problems from type mismatches when calculating the steps per degree for the variable ToMove as you are mixing data types. When assigning a value to a float, ALWAYS ensure the value has a decimal point like this:

float Degrees = 180.0; // Makes it unambiguous to the compiler that you are assigning a float data type

So I would start like this:

Code:
#define STEPS_PER_ROTATION 400
#define TABLE_RATIO 72
float Multiplier = ((float) STEPS_PER_ROTATION * (float) TABLE_RATIO) / 360.0  
float Degrees = 180.0; // Degrees from Serial input
float ToMove = (Degrees*Multiplier); // Steps to move

void setup()
{
Serial.begin(9600);
Serial.println(Multiplier);
Serial.println(ToMove);
}

void loop() // MAIN LOOP
{
}

This is still not really clean code as the variable multiplier never changes so you could use another #define instead

Code:
#define MULTIPLIER ((float) STEPS_PER_ROTATION * (float) TABLE_RATIO) / 360.0

Once compiled, the compiler will do the maths and only store the result.
This might be a bit hard to print as per the example as the print statement will expect a type so you might have to do
Code:
Serial.println((float)MULTIPLIER);

So in summary guys, you have been set up to fail by poor coding practices in the original script. Whilst it worked for the author, it is not universal code and full of gotchas that could bite the inexperienced coder who needs to change the values to suit his hardware.

Please take the time to learn about C compiler preprocessor directives (like #define) and C data types. Just Google these phrases.
 

Latest posts

Back
Top