By continuing to use this site, you agree to our use of cookies. Find out more
Forum sponsored by:
Forum sponsored by Allendale Nov 17

Stepper Motor Identification

All Topics | Latest Posts

Search for:  in Thread Title in  
Alan Charleston19/10/2018 06:53:07
59 forum posts
17 photos

Hi,

A couple of years ago I bought a second hand stepper motor with the intention of using it to position my vertex dividing head and speed up cutting gears. I have a StepDuino to control it. It is a KH56 series motor with the first part of the serial number being KH56KM2. I have found a spec. sheet on line for this model but the last three numbers quoted are -911, -912 and -913 whereas the last part of the serial number on the motor is U037. I presume the U stands for Uni-Polar (there are 6 wires coming out) but the 037 doesn't correspond to what's on the spec sheet. The difference between the last three digits seems to be the motor voltage which changes from 2.3V (3.0A) to 3.6V (2.0A) and 6.71V(1.0A) with the power being about 7 watts for the three options.

Can anyone help me determine what voltage I should be applying to the motor? I'm a complete novice with these so don't assume I can see the obvious.

Regards,

Alan

John Haine19/10/2018 07:35:45
2124 forum posts
113 photos

The first thing is to use a multimeter to check the windings. I would guess that it has two centre tapped windings, which can be used with unipolar or bipolar drives. You want to use the latter nowadays. For this you need to find the centre taps, and then not connect them but use the ends of the windings as a1, a2, b1 and b2 as in the stepduino guide.

The motor voltage is a red herring, what matters is the current. If you use a modern driver it will typically need around 24 volts upwards and will allow you to set the drive current to what your motor needs. The Stepduino has two such drivers installed. I assume it has a facility to set the maximum current. If you start at 1 amp you can't go wrong. If you don't get enough torque and the motor isn't getting too hot then turn it up. Forget the voltage, that will be taken care of by the driver.

Can you post a photo of the motor?

Alan Charleston19/10/2018 08:06:39
59 forum posts
17 photos

Hi John,

Thanks for your reply. I haven't got as far as learning how to use the StepDuino yet as I thought I would need to know the motor characteristics first.I didn't realise you set the current instead of the voltage. I have attached a couple of pictures of the motor. The body is about 55mm across. I will go through the training exercises for the Arduino (again - I wish the information would stick) and then try using the stepduino.

Regards,

Alan

stepper1.jpg

stepper2.jpg

not done it yet19/10/2018 08:54:35
2241 forum posts
11 photos

You will need to convert your metric to imperial as the nema system works on inches. Searching for nema system motor sizes should find you more info.

John Haine19/10/2018 09:23:29
2124 forum posts
113 photos

That's a NEMA 23 motor - 2.3 inches.

Looking at the Stepduino schematic and the driver IC datasheet the current is set by two sensing resistors on the board and a potentiometer which allows adjustment. It doesn't say anything about what that should be adjusted to, but from the component values and the driver datasheet the maximum current is about 2.5 amps. So if you could find VR3 on the PCB and adjust it to about half-way the current would be ~1.25A which would be about right.

Alan Charleston20/10/2018 06:16:38
59 forum posts
17 photos

Thanks John. I've measured the resistance across the coils and figured out the configuration which happily coincides with the data sheet. Now for the bit I'm not looking forward to - relearning how to use the arduino. I wish people wouldn't keep on about how easy it is to use - it's not.

Regards,

Alan

John Haine20/10/2018 12:00:47
2124 forum posts
113 photos

Alan, there was an article on a divider controller using Arduino in MEW a while ago. I believe the code is downloadable somewhere. Though written for the standard platform it would probably be easily adaptable.

Alan Charleston24/10/2018 07:55:32
59 forum posts
17 photos

Hi John,

You seem to know a bit about the Stepduino so I'd like to pick your brains if I could.

I've managed to get the Arduino IDE talking to the Stepduino.

As I understand it, I'll need to provide an external power supply as the USB supply hasn't got the power required. I was intending to use the spare battery for my drill which is 18V. Is this OK? From what I can gather, the Input voltage can be 7 - 28V.

Can this power supply be connected when the Stepduino is connected to my PC via the USB port? I need the USB connection to download a sketch which will start to operate as soon as it is uploaded which will need the external power supply.

Do you know what the display screen is for? I can't see the point of it.

I may have made a mistake getting a StepDuino instead of using a basic Arduino with the required add-ons. There is virtually nothing around explaining how to use the StepDuino but heaps of information on how to run stepper motors using an Arduino.

If I can get the external power supply sorted out I may be able to run one of the sample sketches on the Freetronics website and maybe proceed from there.

Regards,

Alan

Michael Gilligan24/10/2018 08:57:24
avatar
11911 forum posts
518 photos

Alan,

I had not heard of the StepDuino until I saw this thread, but it looks to be quite well documented on the freetronics site: **LINK**

https://www.freetronics.com.au/pages/stepduino-quickstart-guide#.W9AlTtHTWhA

MichaelG.

Edited By Michael Gilligan on 24/10/2018 08:59:15

John Haine24/10/2018 10:39:10
2124 forum posts
113 photos

Alan, to make the stepper driver work as it should you need to supply it with a higher voltage than 5V. In the schematic they show it connected to 12V, but the quickstart guide says 7 - 28 V and there is a switched mode PSU to derive +5 V for the logic. So 18 V should be UK.

Yes you can connect the higher voltage supply while the unit is connected to your PC.

IMHO for your purpose the Stepduino is difficult to use as it has TWO AVR processors. One handles comms via USB and probably other stuff, the other the stepper motor itself and the display. I don't know anything about the Stepduino other than what it says in the quickstart guide and from reading the schematic. Personally I'd use a standard Arduino and the off the shelf design from MEW.

The display is needed since if the controller stands alone it needs an MMI to control it.

Alan Charleston24/10/2018 23:57:39
59 forum posts
17 photos

Hi Michael,

I've been to the Freetronics site but for a beginner like me it's not much use. I bought the Stepduino because I thought it would be easier to use for controlling a steeper motor because that's what it is designed to do. That doesn't seem to be the case.

Thanks John. I think I'll try hooking up the battery and using the sample sketch on the Freetronics website. If it works I'll have at least managed to get a stepper motor shaft to turn which will be a great leap forward. After that I think I'll use my standard Arduino and follow the multiple tutorials around on how to run stepper motors.

Thanks again,

Alan

Michael Gilligan25/10/2018 00:06:20
avatar
11911 forum posts
518 photos
Posted by Alan Charleston on 24/10/2018 23:57:39:

Hi Michael,

I've been to the Freetronics site but for a beginner like me it's not much use. I bought the Stepduino because I thought it would be easier to use for controlling a steeper motor because that's what it is designed to do. That doesn't seem to be the case.

.

I think you're right, Alan

I only pointed you to that page because (a) you already have the board, and (b) it seems to answer several of the questions that you asked.

StepDuino is probably ideal for those who want to develop interactive, multi-axis gizmos; but for what you are doing, I think John is right [best to just use an Arduino].

MichaelG.

Alan Charleston25/10/2018 03:25:19
59 forum posts
17 photos

Hi again,

Thanks to Michael and John.

I've managed to get the shaft of the stepper motor to spin using the example sketch shown on the Freetronics website!

The sketch wouldn't compile but I think the problem was at the end of the sketch where there was a section which froze the shaft in one position. I deleted that part of the sketch and the bit that was left which turned the shaft one revolution forward followed by one revolution in reverse compiled OK.

I had a bit of a hiccup when connecting the motor to the controller. There are six wires coming from the motor so it can be used as a unipolar motor. The controller has only four connectors so the motor needs to be connected in bipolar mode. I assumed that the centre tap wires would be ignored but the motor data sheet showed the connections to be from the centre taps to one end of each of the windings for bipolar operation. I tried this and the motor just buzzed so I connected the ends of the windings and left the centre tap wires loose. The motor then did what it was supposed to and rotated back and forth. I had a bit of a play with the sketch and changed the speeds.

Anyway, at least I've got the motor to turn, I know the motor works and how to connect it to a controller so I'm making progress. I think I'll take John's advice and revert to using a standard Arduino for the time being. When I get more proficient I may be able to make use of the Stepduino.

Regards,

Alan

John Haine25/10/2018 07:38:18
2124 forum posts
113 photos

Sounds like good progress Alan. You can get standalone stepper drivers ready mounted on pcbs for not much.

John Haine25/10/2018 07:46:09
2124 forum posts
113 photos

Like this one.

**LINK**

Alan Charleston26/10/2018 07:07:57
59 forum posts
17 photos

Hi John,

I think I've come up with a working digital dividing head. I stripped out most of the Freetronics example sketch, leaving me with only the instructions required to run one motor a specified number of steps in one direction. The modified sketch is:

const int Stepper1Step = 5;

const int Stepper1Direction = 2;

const int StepsPerRev1 = 4800;

/**

* Set pin assignments

*/

void setup() {

pinMode(Stepper1Step, OUTPUT);

pinMode(Stepper1Direction, OUTPUT);

}

/**

* Main loop

*/

void loop() {

for(int i = 0; i < StepsPerRev1; i++)

{

stepper1Forward();

}

delay( 1000 );

for(int i = 0; i < StepsPerRev1; i++)

delay( 1000 );

}

/**

* Rotate stepper 1 forward by 1 step

*/

void stepper1Forward()

{

digitalWrite(Stepper1Direction, HIGH);

digitalWrite(Stepper1Step, HIGH);

delayMicroseconds(500); // 1uS minimum pulse duration for DRV8811

digitalWrite(Stepper1Step, LOW);

delayMicroseconds(100);

}

I slowed it down by increasing the pulse duration to 500 uS and set the motor to rotate 3 revolutions by setting the steps/revolution to 4800. I disconnected the USB connection to my PC and the external 18V supply to the controller. I found that when the external power supply was reconnected, the stepper motor rotated three revolutions and stopped. This is what is needed to turn my dividing head.

I connected the motor to the dividing head using a toothed belt and a 15 tooth pulley on the motor and a 45 tooth pulley on the dividing head. The gearing in the dividing head is 40X so the three revolutions of the stepper motor resulted in the dividing head rotating 9 degrees. I've included a couple of photos of the setup.

There is a indexing plate on the head with holes every 10 degrees which can be engaged by a pin on the main body. After setting the dividing head to 0 degrees, I applied the power to the controller from the battery 10 times and found the pin engaged the indexing plate perfectly at 90 degrees. The same thing happened at 180, 270 and back to 0 degrees again so the stepper motor is as accurate as the indexing plate.

This setting enables a 40 tooth gear to be cut. I can of course change that to any number of teeth I want by connecting the Stepduino to my PC and changing the number of Steps/Revolution in the sketch. This is probably not much more time consuming than setting it using the LCD screen with all the complications with the sketch and the hardware this would entail.

One thing worries me a bit. Given that it takes 1600 pulses to rotate the stepper motor 1 revolution and the gearing between the stepper motor and the business end of the dividing head (120:1) it requires 192,000 pulses to rotate the work one complete revolution. If, for example, I wanted to cut the ever popular 127 tooth gear, the number of steps/tooth required would be 1511.8 pulses. As the input to the sketch needs to be an integer, the StepsPerRev would need to be set at 1512. 1512 X 127 = 192,024pulses which is 24 pulses too many. This doesn't sound much but is 1.6% of the 1512 pulses/tooth. In other words, the final tooth will have 1.6% of its thickness removed and this will be worse if multiple passes are made when cutting a gear or if the decimal is closer to 0.5 rather than the .8 in this example.

One way around this would be to cut 103 teeth at 1512 StepsPerRevolution, then cut the remaining 24 teeth at 1511 StepsPerRevolution which would reduce the error to 0.07% for the last 24 teeth which is probably negligible. This can be done by reprogramming the sketch after cutting 103 teeth or, since I have the dual output stepduino, reactivate the Stepper Two output with the StepsPerRevolution set at 1511. After cutting 103 teeth the motor would be unplugged from output one and plugged into output two.

I hope this crude way of doing things doesn't cause too much offence.

Regards,

Alan

divhead1.jpgdivhead2.jpg

Joseph Noci 126/10/2018 08:33:48
378 forum posts
704 photos

And therein lies the Devil!

There are two typical ways to cope with this dilemma.

To make the error as small as possible you would want to increase the number of stepper pulses per blank revolution. This either by increasing the gear ratios considerably, or by increasing the stepper controller microstepping count. The latter with the disadvantage that the stepper torque diminishes considerably when microstepping. Already at 1600 microsteps the torque is well down from full step mode, so lost steps become an issue.

Increasing the gear ratios is better, as torque is multiplied, so maybe a balance between increased microstep count and greater gear ratios.

I understand from your setup you are not doing continuous rotation hobbing, ie, the blank just indexes from position to position and halts each time, so stepper max RPM is not an issue.

However, with microstepping, and esp when increasing the microstep count, you may need to apply an acceleration profile to the command index so as to not loose steps due to poor motor torque.

The 'normal' or better approach to the integer issue is to 'spread' or interpolate the error evenly over the full index profile - crudely put, for your example above:

For 127 teeth, cut 2 teeth at 1512 pulses, then 1 tooth at 1510 pulses, and repeat - this gives 84 teeth @ 1512 pulses interspersed with 42 teeth at 1510 pulses, with a last tooth cut at 1512 pulses. The error per tooth will then be between 0.8 and 1.2 stepper pulses, spread over a 1:2 ratio.

Again, this is a crude representation of a typical DDA algorithm - Google the DDA and you should get a good understanding of its application.

In essence - View the stepper motor individual steps as a staircase, starting graphically at x=0, y=0.

The X axis represents 0 to 192,000 steps ( the steps required for a full blank revolution).

The Y axis represents actual steps given to the stepper, ie, an increment in Y is a step pulse, no increment, the stepper stays where it was. The DDA generates outputs which then give the step or no-step command.

If you zoom in on the slope of the line in this mental graph, you will see steps, like a staircase - however, you will see anomalies in the step shape - some risers will be more than one step tall, and some treads will be more than one tread long. This pattern repeats at regular intervals, spread evenly over the full 192,000 steps.

You may need to massage it a little for your specifics, but it works well. Basically it is simple linear interpolation, and is used in many applications, a useful one being an Electronic Leadscrew for lathes. It is also used in the CNC world - to move the tool to a specific place at constant velocity in both x and y axes - but I digress..

If you hack it, spread the error over the full blank, not over a few teeth at one end - else the gear will impose the same error on the driven leadscrew on your lathe, and on any thread you cut with it - a cyclic wobble..

So, if the need is to cut a small handful of gears, hack it, but if the need is one of challenge , DDA it!

Joe

 

 

Edited By Joseph Noci 1 on 26/10/2018 08:39:05

Joseph Noci 126/10/2018 09:50:39
378 forum posts
704 photos

Alan, a little more thought yields a better approach - The DDA algorithm is in fact better suited to CNC applications, where two or more axes are driven from a specific point to another endpoint. The strength of the DDA is the generation of the stepper pulses at frequencies that ensure the axes, and thereby the cutting tool, move at constant velocity, that is, constant feed rates. - needed when cutting metal!

A better method is Bresenham's line draw algorithm. This is in fact the way I did my Lathe ELS system.

My description of the staircase alone the line's slope holds for Bresenham's as well and will sort your issues out elegantly.

Joe

SillyOldDuffer26/10/2018 12:06:35
3414 forum posts
669 photos

First, I wouldn't be too quick to discard the StepDuino. Looking at it, it seems to be no more than a board consisting of an Arduino Uno clone with two built-in stepper drivers, an SD-Card slot, and an LCD Display. You could assemble the equivalent from an actual Uno and the equivalent modules, but StepDuino does all that for you.

The SD-Card, second stepper driver, and LCD display are all features. If you don't write code to explicitly use them, they will be ignored.

Given that Alan started with an unknown motor, I suspect his problems are more to do with wiring it up and getting its parameters right in the code than a fundamental problem with Stepduino, especially as he has made progress with it. May not be a good idea to hack lumps out of Freetronics examples. Generally with computers you have to proceed logically. It's not like fault finding a mechanical problem where poking about often flushes out what's wrong.

Secondly, dividing error. Joseph's suggestions are most interesting. I have my own stepper software, and am up for improving it if it's worth the effort. But is it?

Here's a perfect 127 'toothed' 100mm diameter circle:

metric127errorperfect.jpg

This is the same 127 'teeth' generated from 8 turns with Alan's rounding error (1512 for 1511.8)

metric127errorx8.jpg

 

In the second image there are still 127 'teeth' but the lines are thicker because the 'cut' is displaced slightly each time the wheel is rotated. Zooming in shows that the effect of the error is to turn the whole gear in a negative direction.

metricerrorzoom.jpg

Whilst the gear isn't perfect, the error doesn't accumulate at one end! Rather it is distributed around the entire gear wheel. My question is, does this matter in practice? Also, are the errors due to step rounding any worse than the errors that occur during cutting with a conventional dividing head?

Dave

 

 

 

 

Edited By SillyOldDuffer on 26/10/2018 12:11:13

Michael Gilligan26/10/2018 12:44:01
avatar
11911 forum posts
518 photos
Posted by SillyOldDuffer on 26/10/2018 12:06:35:

Here's a perfect 127 'toothed' 100mm diameter circle:

metric127errorperfect.jpg

.

An excellent post, Dave yes

But one question, if I may be so bold: ... In what sense is that division 'perfect' ?

So far as I am aware, very little to do with circles can be perfectly represented in the digital domain.

MichaelG.

All Topics | Latest Posts

Please login to post a reply.

Magazine Locator

Want the latest issue of Model Engineer or Model Engineers' Workshop? Use our magazine locator links to find your nearest stockist!

Find Model Engineer & Model Engineers' Workshop

Latest Forum Posts
Support Our Partners
Eccentric July 5 2018
méridienne Nov 18
Ausee.com.au
TRANSWAVE Converters
emcomachinetools
ChesterUK
Sarik
Shapiro
Eccentric Engineering
Allendale Electronics
Warco
Subscription Offer

Latest "For Sale" Ads
Latest "Wanted" Ads
Get In Touch!

Do you want to contact the Model Engineer and Model Engineers' Workshop team?

You can contact us by phone, mail or email about the magazines including becoming a contributor, submitting reader's letters or making queries about articles. You can also get in touch about this website, advertising or other general issues.

Click THIS LINK for full contact details.

For subscription issues please see THIS LINK.

Digital Back Issues

Social Media online

'Like' us on Facebook
Follow us on Facebook

Follow us on Twitter
 Twitter Logo

Pin us on Pinterest