Author Topic: Gear Ratios Please Help!  (Read 5796 times)

0 Members and 1 Guest are viewing this topic.

Offline Brendle12321Topic starter

  • Newbie
  • Posts: 6
Gear Ratios Please Help!
« on: June 26, 2015, 03:31:22 pm »
Howdy,

First time poster here.

I am working on a stepper motor / rotary encoder setup.

These are the two devices I have already purchased:
Stepper motor: http://www.digikey.ca/product-detail/en/0/1528-1062-ND
Rotary Encoder: http://www.digikey.ca/product-detail/en/0/EAW0J-B24-BE0128L-ND

Because I'm a fool (obviously) who didn't consider gear ratios before I ordered these products, I find myself in a bit of a pickle.

I want to gear these two devices together so that one full rotation of the stepper motor can be encoded as one full rotation of the rotary encoder. Specifically, I want to make sure that the absolute positioning of the stepper motor is held by the rotary encoder without any sort of non-volatile memory in my microcontroller. (so when I power on, based on the position of the rotary encoder, I want to be able to step the motor back to it's starting position using only the binary readout of the rotary encoder).

This obviously poses a problem, because these two devices need a funny gear ratio.

I think I've figured it out but I was hoping that I could have some confirmation before I go ordering expensive gears.

Here is what I have so far:

Stepper Motor: 200 steps/revolution
Rotary Encoder: 128 counts(let's call them "steps")/ revolution

If I put a gear with 64 teeth on the stepper motor, and 100 teeth on the rotary encoder I think this solves it.

Math:

Stepper motor: (200 steps/revolution)*64 teeth = 12,800 teeth*steps/revolution
Encoder:          (128 steps/revolution)*100 teeth= 12,800 teeth*steps/revolution

Obviously I'm no gear technician, but does this math work out, or am I about to order 50$ worth of useless gears?

Thanks very much for your help!

-Brendle
 

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3238
  • Country: gb
Re: Gear Ratios Please Help!
« Reply #1 on: June 26, 2015, 04:17:59 pm »
I may be misunderstanding your requirements, but there is no amount of gearing that will give you 200 discrete codes out of a 128 position encoder.

Gearing up the encoder by a factor of 200/128 will give the same angular resolution as the stepper, but the problem is that the encoder will have spat out all of it's 128 codes when the stepper has turned only 360*(128/200) = 230.4 degrees.  Past that the codes will be repeated, so you no longer have an absolute position sensor unless you add another sensor to the system to effectively add another bit to the encoder.
 

Offline Brendle12321Topic starter

  • Newbie
  • Posts: 6
Re: Gear Ratios Please Help!
« Reply #2 on: June 26, 2015, 04:22:15 pm »
Hey, thank you for your reply.

I don't necessarily need 200 codes out of my 128 code rotary encoder. I just need the gear ratio between these two devices such that when one makes a complete revolution, the other also makes a complete revolution. At least that way I can step the motor back to the 0 position with confidence.

 

Offline albert22

  • Regular Contributor
  • *
  • Posts: 177
Re: Gear Ratios Please Help!
« Reply #3 on: June 26, 2015, 04:57:34 pm »
Hey, thank you for your reply.

I don't necessarily need 200 codes out of my 128 code rotary encoder. I just need the gear ratio between these two devices such that when one makes a complete revolution, the other also makes a complete revolution. At least that way I can step the motor back to the 0 position with confidence.

You pointed yourself to the solution. A 1:1 is needed. You will get the absolute position of the stepper but your readout is not going to be 1/200 it will be 1/128 instead. If you cannot afford to loose resolution I think that you will need to get another encoder N x 200 codes per rev.
 

Offline IanB

  • Super Contributor
  • ***
  • Posts: 11882
  • Country: us
Re: Gear Ratios Please Help!
« Reply #4 on: June 26, 2015, 05:07:49 pm »
Confirmed. 1:1 gearing is what you need. If you set up the system so that "zero" on the rotary encoder corresponds to "zero" on the stepper motor, then whenever you want to return to zero you just step the motor until the rotary encoder reads zero again.

As long as they start out at zero-zero and there is no slip in the system, then they will always return to zero-zero by stepping the motor enough times. The algorithm is "step motor until rotary encoder reads zero".
 

Offline robrenz

  • Super Contributor
  • ***
  • Posts: 3035
  • Country: us
  • Real Machinist, Wannabe EE
Re: Gear Ratios Please Help!
« Reply #5 on: June 26, 2015, 05:49:40 pm »
That encoder is mechanical and will not survive long connected to a stepper motor. And it is not meant to restrain the side loading that gearing would impose on it. Quit while you are ahead and get a proper encoder.

Offline Brendle12321Topic starter

  • Newbie
  • Posts: 6
Re: Gear Ratios Please Help!
« Reply #6 on: June 26, 2015, 05:53:34 pm »
Hey everybody, thanks for the replies!

Can anyone confirm my math for me that the gear ratio I calculated will provide a 1:1 turn ratio between the two devices?

Also I appreciate the advice that the device is mechanical and won't last long, can someone point me to a "proper" encoder then please?

Thanks,

Brendle

 

Offline georges80

  • Frequent Contributor
  • **
  • Posts: 912
  • Country: us
Re: Gear Ratios Please Help!
« Reply #7 on: June 26, 2015, 06:08:22 pm »
Hey everybody, thanks for the replies!

Can anyone confirm my math for me that the gear ratio I calculated will provide a 1:1 turn ratio between the two devices?

Also I appreciate the advice that the device is mechanical and won't last long, can someone point me to a "proper" encoder then please?

Thanks,

Brendle

1:1 ratio implies 1:1 gearing.

How about you actually explained EXACTLY what you are trying to achieve and what your 'system' is... Then more useful responses might be possible versus firing the shotgun randomly at an undefined target or targets.

cheers,
george.
 

Offline Brendle12321Topic starter

  • Newbie
  • Posts: 6
Re: Gear Ratios Please Help!
« Reply #8 on: June 26, 2015, 06:34:57 pm »
Howdy,

What I am trying to achieve is to have some way of telling where my stepper motor is after I power my circuit off without having some sort of non volatile memory.

I figured that having an absolute rotary encoder attached to my stepper motor would allow me to at least step my motor back to the 0 position and go from there.

My issue is that the stepper motor and the rotary encoder that I bought have a different number of steps per revolution.

If gear them together in a 1:1 ratio, I think that this will make one rotation of the stepper motor equal more than one rotation of the rotary encoder.

As I type this, it occurs to me that if I gear them together in a 1:1 ratio, one rotation of the stepper motor equals one rotation of the rotary encoder... So I think that I don't actually have a problem after all.

Damnit.
 

Offline georges80

  • Frequent Contributor
  • **
  • Posts: 912
  • Country: us
Re: Gear Ratios Please Help!
« Reply #9 on: June 26, 2015, 06:40:52 pm »
... and you still haven't explained your system.

Anyhow, I presume your stepper never goes beyond one full revolution???? If so, you still won't know where your system zero is since the encoder will wrap around on each full revolution.

Limit switches are often used to get a system back to zero. But again, you still haven't actually explained what you are trying to do - as in the BIG PICTURE :)

cheers,
george.
 

Offline IanB

  • Super Contributor
  • ***
  • Posts: 11882
  • Country: us
Re: Gear Ratios Please Help!
« Reply #10 on: June 26, 2015, 06:44:43 pm »
Can anyone confirm my math for me that the gear ratio I calculated will provide a 1:1 turn ratio between the two devices?

No, because it won't.

If you put 64 teeth on the drive gear and 100 teeth on the driven gear, then when the drive gear makes one full turn the driven gear will make 64/100 (= 16/25) of a turn. A ratio of 16:25 is not the same as a ratio of 1:1.
 

Offline Brendle12321Topic starter

  • Newbie
  • Posts: 6
Re: Gear Ratios Please Help!
« Reply #11 on: June 26, 2015, 07:06:01 pm »
Hey Georges80,

I guess the reason I'm having trouble explaining my system is that there is no system...  :P

I just bought these two parts to have a little fun and figure out how to interface the two things.

I see your point though if the stepper motor ever goes over one full revolution, I've lost my starting location.

Can you explain what a limit switch is for me please?

I suppose that my other option is to implement some sort of non-volatile memory to keep track of my positioning.

I appreciate the help, you have all been very patient!
 

Offline georges80

  • Frequent Contributor
  • **
  • Posts: 912
  • Country: us
Re: Gear Ratios Please Help!
« Reply #12 on: June 26, 2015, 07:12:26 pm »
google limit switch and read & learn  :)


cheers,
george.
 

Offline IanB

  • Super Contributor
  • ***
  • Posts: 11882
  • Country: us
Re: Gear Ratios Please Help!
« Reply #13 on: June 26, 2015, 08:37:44 pm »
Anyhow, I presume your stepper never goes beyond one full revolution???? If so, you still won't know where your system zero is since the encoder will wrap around on each full revolution.

This depends on whether the system has any physical limits. If the system is free running it won't matter if the motor goes beyond one full revolution, you can always get it back to zero. An example of a free running system is a clock face...it doesn't matter how many times the hands have gone round, you can always get back to 12 o'clock.
 

Offline georges80

  • Frequent Contributor
  • **
  • Posts: 912
  • Country: us
Re: Gear Ratios Please Help!
« Reply #14 on: June 26, 2015, 08:44:48 pm »
Yes, which is why I originally asked WHAT the OP's system actually was. Which finally turns out to be nothing other than a stepper and an encoder sitting on a bench...

So, limit switches, rotary encoders, steppers, pixie dust etc don't seem to matter much in this case :)  The OP is just experimenting and learning without an clear application at this stage.

cheers,
george.
 

Offline dadler

  • Supporter
  • ****
  • Posts: 851
  • Country: us
 

Offline lincoln

  • Regular Contributor
  • *
  • Posts: 155
  • Country: us
Re: Gear Ratios Please Help!
« Reply #16 on: June 26, 2015, 09:12:51 pm »
Hey Georges80,

I guess the reason I'm having trouble explaining my system is that there is no system...  :P

I just bought these two parts to have a little fun and figure out how to interface the two things.

I see your point though if the stepper motor ever goes over one full revolution, I've lost my starting location.

Can you explain what a limit switch is for me please?

I suppose that my other option is to implement some sort of non-volatile memory to keep track of my positioning.

I appreciate the help, you have all been very patient!

Steppers are usually driven by something, a micro controller, set of counters ect. Why steppers have descret steps (Duh!) so that the provided the motor doesn't stall, the application knows the position by integrating the steps given to the motor. Most stepper driven equipment is run in an "open loop" fashion. the controller doesn't know if the commands given to the motor actually moved anything. (unlike a ac or DC servo that has an encoder to tell the controller actual distance or speed)

you say: Well thats useless how do you know where you start from? what if you hit some thing?

Ok, well usually a stepper is used to position something. Limit switches are placed at the end of travel in an arrangement that they will open just before the mechanical system begin driven will "crash" or come to a mechanical hard stop. For small motors this may not be so bad, for big systems this can be disastrous.

A " home " switch is a switch that is triggered when the mechanical system crosses a single point. That fires an interrupt and sets the controller position to 0. On large CNC machines (think spindle motors rated in 10s and 100's of horse power) it is a common power down procedure to "park" the machine. that is send all axis to the home position. On power up, a cold start procedure is to home the axis, basically the controller will move the axis slowly back and for to find the home switch then trip the switch in one direction and reset the axis counter. 

A limit switch can also double as home switch, depending on the mechanics of what you are moving.

It is up to the engineer to use a motor and drive that is suitably oversize so that the motor will not stall under load. The trade off is that the controls avoid potential problems with closed loop setup.

Now back to your project. The encoders you have are mechanical and will eventually wear out, and have significant contact bounce, not the best for positioning but for some thing to screw around with, have fun.

 

Offline John Coloccia

  • Super Contributor
  • ***
  • Posts: 1212
  • Country: us
Re: Gear Ratios Please Help!
« Reply #17 on: June 26, 2015, 10:08:28 pm »
I've done an awful lot of robotics and motion control.  I can't think of even one system where I've ever used an absolute encoder.  I'm sure I must have at some point, but it's not coming to mind.  You invariably home the system before use.  Trying to remember where you were is more trouble than it's worth in the vast majority of cases.  What if the system moves when it's powered off?  With servos, that's almost a certainty, and with steppers it's still probable.

If you want to play, you should completely forget about encoders for the time being, and just get the stepper moving.  That will give you enough trouble to get it moving with proper motion profiles.  It's not trivial, though it's not all that difficult either if you do your homework.

Then start playing with some limit switches and home routines.  For example, with capacitive limit switches, and the home routine I wrote, I was able to home my CNC machine to better than .001" repeatability.  No encoders anywhere...just a simple capacitive switch and an intelligent home routine.  LOTS of systems run with steppers and no encoders.

THEN, if you want to add encoders, understand that their primary purpose is not to tell you where you are, though you want to know that too. You're looking for rate data so you can close the loop on your motion profile.  This is especially important for servos, but they're also sometimes used on steppers so that intelligent controllers can make adjustments, or at a minimum halt motion if you start loosing steps. This is where you start getting into big boy territory because it is NOT trivial at all to close the loop on this sort of motion.  Most hobbyist/small CNC guys stick with open loop steppers to avoid all of the headaches involved with tuning closed loop systems.  If you don't need to do it, most opt to simply avoid it for simplicity's sake.  But this is also where you can really start extracting amazing performance from your system.  Good servos, good encoders, good controllers and good software can team up to make a very accurate and precise system that runs very fast and smooth as glass.
 

Offline B.B.Bubby

  • Regular Contributor
  • *
  • Posts: 58
  • Country: au
Re: Gear Ratios Please Help!
« Reply #18 on: June 26, 2015, 10:27:14 pm »
I don't understand where the problem is. Just mount the encoder after the gearbox. why does the ratio even matter??

 

Offline CatalinaWOW

  • Super Contributor
  • ***
  • Posts: 5231
  • Country: us
Re: Gear Ratios Please Help!
« Reply #19 on: June 27, 2015, 05:34:01 pm »
Sometimes conceptual points are hard to get.  Just to make what others are saying explicit, you need a 1:1 gear ratio, which means the same number of teeth on the encoder gear and the stepper motor gear.  The encoder will make one turn when the stepper makes one turn.  This is totally independent of the step size of the motor and the resolution of the encoder. 

While there are many reasons why you might choose not to use an absolute encoder to accomplish your goal of recovery of the "zero" position there is nothing conceptually wrong with it.  Since your encoder has a different number of steps per turn than the motor you will have some fun in implementing it.  If you read the encoder and use that to compute the number of motor steps to zero you might end up a step or two away.  Why?  Because there are multiple places around the revolution where full motor step won't cause an increment of the encoder.  The last motor step just barely triggered the next encoder step, and the current step doesn't quite get to the next one.  These issues are compounded by issues like gear backlash and so on.  Cost and size are two of the common reasons people opt out of the encoder solution in many cases.

A simple method of recovering zero that is related to limit switches is to use a simple optical interrupter at your zero point.  Think of an led shining on a disk on your motor that has hole in it at the zero position.  A detector on the other side of the disk triggers when the led shines through the hole.  These interrupters are available as a package containing the led and detector with a gap between them.  They are cheap and easy to interface.
 

Offline Brendle12321Topic starter

  • Newbie
  • Posts: 6
Re: Gear Ratios Please Help!
« Reply #20 on: June 27, 2015, 06:58:27 pm »
Hey everyone,

I want to say thank you all very much, I'm blown away by the support and the knowledge you all have provided for me.

I think that I have alot to think about, and probably alot more parts to order to tinker around with! :P

I feel like such a tool for being confused about this whole gear ratio thing in the first place, and now I realize that although I could theoretically hook the rotary encoder and the stepper motor together, it really isn't the right way to go. Thank you all for helping me save like 60$ on gears and stuff.

I'm going to look into limit switches and optical interrupters I think, and then work on having my motor zero itself out on power up.

Thanks again for the support, I know where to come next time I need help with this stuff!
 

Offline John Coloccia

  • Super Contributor
  • ***
  • Posts: 1212
  • Country: us
Re: Gear Ratios Please Help!
« Reply #21 on: June 27, 2015, 07:48:23 pm »
One fairly traditional way of "zeroing" a stepper, even though you may end up off by a small number of steps, is to simply drive the stepper into a hardstop.  There will be some uncertainty on exactly what position you're in, but if you can be off by a few steps, that's pretty effective. The reason you end up off is that you stall the stepper, but you have know way of knowing which phase you're on when it stalls.  This works extremely well when you don't need absolute position but merely need to start at some reasonable location.  An example might be if you need to execute a search algorithm where your actual position isn't critical...you're closing the loop on some external stimuli.

Real encoders designed for motion control often have an "index" pulse (sometimes called a synch pulse).  It goes off once per revolution.  The idea is to remove any uncertainty/hysteresis in detecting the limit switch.  You drive until you hit a limit switch.  Then you slowly move forward until you hit the index pulse.  That makes for a very precise home position...as accurate as the encoder itself.

Lots of ideas to fiddle with just to turn a stupid motor!  :)
 

Offline CatalinaWOW

  • Super Contributor
  • ***
  • Posts: 5231
  • Country: us
Re: Gear Ratios Please Help!
« Reply #22 on: June 27, 2015, 11:02:44 pm »
One reason so many people were asking what you are doing is that there are literally thousands of ways to put a system together, and the "best" way to do it will depend on the final result desired.

For example, a stepper motor is convenient to drive with a digital source, and has the advantage of a known number of steps per revolution.  This lets you do many positioning tasks merely by sending an appropriate number of steps to the motor.  But even with microstepping you are limited to about 1024 steps per revolution (about since given a strong enough desire almost anything is possible).   But with an appropriate belt or gear drive this can become thousands of steps per revolution at the output shaft, with substantial increase in torque.  Or with a brushless motor, gears and belts the resolution at the output can become nearly infinite. 

If you really want to do a lot of electro-mechanical engineering it will pay you to learn as many options as you can, their benefits and drawbacks.  The bigger your toolbox the better your solutions to a given problem will be.  There are always trades between speed, cost, power, volume, precision, reliability and other factors.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf