584,857 active members*
4,670 visitors online*
Register for free
Login
IndustryArena Forum > CNC Electronics > Stepper Motors / Drives > noob question - stepper motor encoder
Results 1 to 18 of 18
  1. #1
    Join Date
    Feb 2017
    Posts
    7

    noob question - stepper motor encoder

    Hello,

    I am totally new to this. I want to mount an encoder to a stepper motor that I recently bought in order to correct missing steps, from time to time.

    The motor is this Nema 34 CNC Stepper Motor 13Nm and controls a belt driven linear slide. On the shaft of the motor is a pulley 27 Tooth Timing Pulley, T 10mm Pitch, Aluminum . The motor is control by a drive set at 2000 pulse/revolution, the maximum speed will be 10.000 steps/second. The drive is controlled now by a teensy 3.2 board with AccelStepper library.

    I don't know how can I mount the encoder to this and what type I will need. Off course a cheaper solution will be more convenient. I don't want to use a servo motor, I don't need a speed more then the one mention.

    Thanks

  2. #2
    Join Date
    Apr 2004
    Posts
    5728

    Re: noob question - stepper motor encoder

    Mounting an encoder onto your stepper isn't going to help by itself. You'll need to switch drives to something that supports encoder feedback. If you're doing that anyway, it would make more sense to get rid of the "teensy" drive and get something beefier. - I couldn't find out how many watts you could put through one of those things, but it's probably not enough for your steppers,
    Andrew Werby
    Website

  3. #3
    Join Date
    Jan 2016
    Posts
    25

    Re: noob question - stepper motor encoder

    we had drama with a switching powersupply on a doughty drive it would miss steps if we ran full simultaneus too fast, either slow it down or make some upgrades to a toridial style power suppy

  4. #4
    Join Date
    May 2005
    Posts
    1397

    Re: noob question - stepper motor encoder

    This diagram might help explain how servotechref.massmind.org/techref/io/servo/index.htm
    James hosts the single best wiki page about steppers for CNC hobbyists on the net:
    http://www.piclist.com/techref/io/steppers.htm Disagree? Tell him what's missing! ,o)

  5. #5
    Join Date
    Feb 2017
    Posts
    7

    Re: noob question - stepper motor encoder

    Quote Originally Posted by awerby View Post
    Mounting an encoder onto your stepper isn't going to help by itself. You'll need to switch drives to something that supports encoder feedback. If you're doing that anyway, it would make more sense to get rid of the "teensy" drive and get something beefier. - I couldn't find out how many watts you could put through one of those things, but it's probably not enough for your steppers,
    So is not possible to put an encoder and read the impulse with teensy? Are you sure?

  6. #6
    Join Date
    Jan 2005
    Posts
    1943

    Re: noob question - stepper motor encoder

    You can read the encoder pulses with a teensy, but then what? All that tells you is whether it is off or not. If the position is not where it is supposed to be then how are you going to get it back to where it is supposed to be? Doing it on the fly is much more complicated than just injecting a few extra pulses. As I understand it, the commercial closed loop feedback steppers can momentarily increase current to the motor, thereby increasing torque for short durations. This is something you can't do with a normal stepper driver. In addition, you would have to have logic to detect the steps and not just inject more steps, but momentarily increase/decrease the step pulse generation and once caught up return it to normal. My guess is that the closed loop drivers have a FPGA or something to perform this task. You could probably hack a standard driver with a piggyback microprocessor and after a lot of testing, code writing, code re-writing... get it to work. In the end all that has already been done and isn't all that expensive. If you want to do it because you like that stuff then that is great, but from an economic standpoint it would not be practical if you count your time worth anything.

    Having said the above, If you want to track position with an encoder and somehow check it only occasionally, like in-between code runs every 15 minutes or something, I think that could be implemented easier, but I wonder why you wouldn't just use homing switches and home the machine occasionally if that is your end goal.

  7. #7
    Join Date
    Apr 2004
    Posts
    733

    Re: noob question - stepper motor encoder

    Quote Originally Posted by redpeppery View Post
    So is not possible to put an encoder and read the impulse with teensy? Are you sure?
    You can if you are a good enough programmer. teensy 3.2 is arm cortex so plenty of processing power to read encoder signals and run a PID loop to "servo control" a stepper motor/driver. You will need to read, understand and implement a working PID for the Teensy. If you don't even know what a PID is then you have many hours of hard work to implement this.

    Time vs money

    You can spend $150 for leadshine servo driver/servo motor with encoder and be done with it.

  8. #8
    Join Date
    May 2005
    Posts
    1397

    Re: noob question - stepper motor encoder

    There are, and you can build, stepper motor based closed loop servo systems. It's pretty easy as well...

    1. You just take the step and direction signals from the motion controller (PC, RAMPS, whatever) and instead of feeding them into a stepper driver directly, you feed them into a servo controller. That can be a microcontroller like the teensy given the right programming. It needs to track the desired position from the step and direction pulses in one variable, e.g. via an interrupt routine which is triggered by the step, and counts up if direction is one way, down if it's the other.

    2. Then that same controller needs to read the encoder and have a second variable tracking the actual position of the shaft. Typically, that is a quadrature signal so you have another interrupt and you count up if it's one phase, down for the other.

    3. Now that it knows the current position, and the desired position, it can compare the two and produce step and direction signals that go to the actual stepper motor driver, commanding the motor to turn in the direction that will reduce the error. That comparison can be a simple difference, or something more complex, like a PID.

    The source code for my servo controller (which currently produces PWM signals for a standard motor driver) is available and shows how this generally works... It's for a PIC, but that's also a good option for the controller. It would be fairly easy to modify my controller to drive steppers as well.
    techref.massmind.org/techref/io/servo/BOBPID.htm

    Now... this isn't normally done because: Stepper motors pretty much suck, except for one thing: They don't usually NEED closed loop feedback! So if you have closed loop, you are really better off using DC motors or BLDC's or whatever. More power, lower cost, etc... For a nice list of the good and bad points of each sort of motor, read this page:
    techref.massmind.org/techref/io/motors.htm
    James hosts the single best wiki page about steppers for CNC hobbyists on the net:
    http://www.piclist.com/techref/io/steppers.htm Disagree? Tell him what's missing! ,o)

  9. #9
    Join Date
    May 2005
    Posts
    1397

    Re: noob question - stepper motor encoder

    I don't know how can I mount the encoder to this
    Magnetic encoders are easy to mount: You just glue or clamp the magnet to the end of the shaft. Most are very very low speed, but there are some which are fast:
    techref.massmind.org/techref/io/sensor/pos/enc/ENC1.htm
    James hosts the single best wiki page about steppers for CNC hobbyists on the net:
    http://www.piclist.com/techref/io/steppers.htm Disagree? Tell him what's missing! ,o)

  10. #10
    Join Date
    Mar 2003
    Posts
    35538

    Re: noob question - stepper motor encoder

    3. Now that it knows the current position, and the desired position, it can compare the two and produce step and direction signals that go to the actual stepper motor driver, commanding the motor to turn in the direction that will reduce the error. That comparison can be a simple difference, or something more complex, like a PID.
    The problem here is that the stepper has already lost position, most likely because it didn't have enough power. So, if it didn't have enough power to go where it was supposed to go, how s it going to have enough power to make corrections?
    Gerry

    UCCNC 2017 Screenset
    http://www.thecncwoodworker.com/2017.html

    Mach3 2010 Screenset
    http://www.thecncwoodworker.com/2010.html

    JointCAM - CNC Dovetails & Box Joints
    http://www.g-forcecnc.com/jointcam.html

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)

  11. #11
    Join Date
    May 2005
    Posts
    1397

    Re: noob question - stepper motor encoder

    Quote Originally Posted by ger21 View Post
    The problem here is that the stepper has already lost position, most likely because it didn't have enough power. So, if it didn't have enough power to go where it was supposed to go, how s it going to have enough power to make corrections?
    Lost steps are often the result of a momentary failure. Vibration, resonance, binding that clears when shaken, the head hitting something, cutting head bouncing, etc... One lost step almost never causes the motor to just bind in place. Yes, there are stalls that do cause that, but that is the exception rather than the rule.

    I do completely agree that the better solution is NOT feedback, but rather a larger or better motor / driver. But not for that reason. If you are going to stay with steppers, get one that has the power to do the job open loop, or switch to non-stepper motors with a servo controller. Putting a closed loop patch on a motor that is only there because it can be open loop is a bad idea.
    James hosts the single best wiki page about steppers for CNC hobbyists on the net:
    http://www.piclist.com/techref/io/steppers.htm Disagree? Tell him what's missing! ,o)

  12. #12
    Join Date
    Apr 2004
    Posts
    733

    Re: noob question - stepper motor encoder

    I suppose the better question to ask the OP is what model stepper driver, stepper motor, PS voltage and linear stage he is running. Something may be mis matched. We all know that low end drivers do not have anti-resonance capability. Does the OP driver have that.

  13. #13
    Join Date
    Feb 2017
    Posts
    7
    Quote Originally Posted by jfong View Post
    I suppose the better question to ask the OP is what model stepper driver, stepper motor, PS voltage and linear stage he is running. Something may be mis matched. We all know that low end drivers do not have anti-resonance capability. Does the OP driver have that.
    Thank you all for your answers.

    As I said before I don't have any experience with this is my first project but I have a lot of experience in programming in general, so I can write my own code, after I will have the proper equipment.

    First off all I already bought the stepper motor, the driver and the power supply. This is what I have:
    http://eu.stepperonline.com/high-torquespeed-nema-34-cnc-stepper-motor-13nm1841ozin-34hs595004s-p-57.html
    http://eu.stepperonline.com/ma860h-stepper-motor-driver-max-80vac-or-110vdc-with-2472a-p-173.html
    http://eu.stepperonline.com/switching-power-supply-350w-60v-59a-for-cnc-router-kits-115v230v-s35060-p-178.html

    Besides that I bought the teensy 3.2 to control it.
    I allready build a Linear Motion system (actuator) for the current configuration and made the code for it, in order to control speed, acceleration, length, starting position, ending positions.
    The maximum speed that I need from the motor is 300 rpm, with a torque around 7 nm. The problem is, that sometimes the load could to much for it, or could be stall by something and loose steps.
    This is not a very big issue for me actually, and could be corrected manually but it will be very nice to have a feature that at list positions back the actuator at the starting set positions and not set again this. Off course I could put a sensor on the starting point and end point but this means that I will have to also set this manually.
    First I look for a Linear distance sensor, in order to read the actual position of the block on the rail, but I found that is not that easy to achieve, and someone advice me to put an encoder on the motor to make this correction.
    What I will also do by code, is to determine if the actuator is drifting with the current load and reduce the speed and limit to a speed that is no more loose steps.
    I don't really want know to change all my configuration in order to achieve what I need.

    Thanks

  14. #14
    Join Date
    Mar 2003
    Posts
    35538

    Re: noob question - stepper motor encoder

    Not sure if that motor will give you 7Nm at 300rpm, especially at 60V. You'd have a better chance with 100V.
    But generally, those big motors don't have a lot of torque once they start spinning.
    When you need that much torque, servos are a much better choice.
    Gerry

    UCCNC 2017 Screenset
    http://www.thecncwoodworker.com/2017.html

    Mach3 2010 Screenset
    http://www.thecncwoodworker.com/2010.html

    JointCAM - CNC Dovetails & Box Joints
    http://www.g-forcecnc.com/jointcam.html

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)

  15. #15
    Join Date
    Feb 2017
    Posts
    7
    Quote Originally Posted by ger21 View Post
    Not sure if that motor will give you 7Nm at 300rpm, especially at 60V. You'd have a better chance with 100V.
    But generally, those big motors don't have a lot of torque once they start spinning.
    When you need that much torque, servos are a much better choice.
    The torque is ok now in almost all the occasions. Still I can reduce speed and the torque will be increased if it's really necessary, but this will be determined by the encoder feedback.

    So back to the original problem what sensor do I need, in order to not change the current configuration.

  16. #16
    Join Date
    Apr 2004
    Posts
    733

    noob question - stepper motor encoder

    You will need a quadrature encoder mounted to the back of the stepper motor. This will require a dual shaft motor. I like to use ones by USdigital. Usually the E2 or E5 version.

    I have used this encoder when a dual shaft isn't available

    Slowing 69.16.243.61&c=1&t=42773.7226631944

    You mount the magnet on the end of the front shaft with glue and place the board as close as possible to get a reading.

    Hookup the encoder to the arm chip and write your code.

  17. #17
    Join Date
    Jul 2010
    Posts
    178

    Re: noob question - stepper motor encoder

    Adding an encoder to an open system is quite easy. You should however look at why you want to do this? Losing steps is often a common belief, but not a reality... especially with micro stepping.

    I have made a video here that you might find interesting -

    https://youtu.be/b5JD2-hlvtw

  18. #18
    Join Date
    Mar 2015
    Posts
    70

    Re: noob question - stepper motor encoder

    HI Gerry,



    NEMA34 8Nm with the HSS86 driver.
    the motor goes to position fault whenever home switch is triggered.
    Mach3 through LPT to 5 axis BoB.

    what could be happening ?

Similar Threads

  1. Encoder for stepper motor
    By ssjantonio in forum Dynomotion/Kflop/Kanalog
    Replies: 51
    Last Post: 12-16-2016, 03:25 AM
  2. stepper motor without encoder
    By ReCar in forum CNC Machine Related Electronics
    Replies: 0
    Last Post: 05-18-2012, 07:55 PM
  3. encoder for stepper motor
    By 15mgtar in forum Stepper Motors / Drives
    Replies: 0
    Last Post: 09-22-2009, 04:47 PM
  4. encoder-stepper motor
    By granado in forum Stepper Motors / Drives
    Replies: 2
    Last Post: 11-29-2004, 11:38 AM
  5. Stepper motor with encoder?
    By buscht in forum Stepper Motors / Drives
    Replies: 3
    Last Post: 07-13-2004, 03:53 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •