586,055 active members*
4,375 visitors online*
Register for free
Login
IndustryArena Forum > CNC Electronics > Stepper Motors / Drives > stepper motor positioning error
Results 1 to 9 of 9
  1. #1
    Join Date
    Feb 2015
    Posts
    3

    stepper motor positioning error

    Dear all,


    I setup up a measurement device, which uses two stepper motors to translate one detector in two directions. In my measurement process i am scanning one line by line into Y-direction. Attached is a sample picture of a resulting image. You can see that the picture shows kind of stripes into Y-direction. To my idea it looks like the motor gathers an arbitrary offset while it is running into Y-direction which distorts the image.


    It appeared during my first measurement procedure in which is was going a step into Y, measuring, going again a step, again measuring,... until i was at the end, then went one step into X and did the process backwards. I thought it might be that the motor gathers an error due to many times stopping and going again, so I changed two things:


    I am now running into Y without stopping and measure in parallel. I am doing that in a synchronised way so that i am able to post-calculate which measurement was at which position. Additionally i let my motor measure one time back and one time forth and average in order to get rid of bidirectional errors. The last thing i changed is that after each Y-scan i let the motor go to the homing position in Y-direction and start over from there. But still. The picture I attached was recorded with this method. It didnt help.


    Does anybody have an idea how to treat such errors? Is there probably a smarter way to design the measurement procedure in order to get rid of this error? Or is it maybe even a common error which might come from the controller electronics (which i made myself using the pololu A4988 stepper motor driver)?


    I'd appreciate your help!

    Click image for larger version. 

Name:	scan.PNG 
Views:	1 
Size:	10.1 KB 
ID:	270198

  2. #2
    Join Date
    Jan 2005
    Posts
    1695

    Re: stepper motor positioning error

    There should be no position error, no matter how often you start and stop. Your system is not running properly. Perhaps you can post photos of your setup. How are you generating the step pulses? What is your power supply voltage?

  3. #3
    Join Date
    Feb 2015
    Posts
    3

    Re: stepper motor positioning error

    Quote Originally Posted by H500 View Post
    There should be no position error, no matter how often you start and stop. Your system is not running properly. Perhaps you can post photos of your setup. How are you generating the step pulses? What is your power supply voltage?
    Hi,

    I will try to get a camera and add some photos later, but here is the description so far:

    - I am using a simple 12 V DC power supply. Before the stepper motor drivers i additionaly put a voltage divider in order to also get a 5 V logic voltage supply and a 100 µF capacitor accross the power supply IN and GND.
    - the motors i am using are part of this: http://www.owis.eu/fileadmin/user_up.../pi_ktm_65.pdf
    - i set the current limit of the motors to the maximum value given in the data sheet (450 mA). Actually i thought i set it a little below, but reviewing it now i understood it is pretty much exactly the 450 mA. Might that be a problem?
    - the pulses on the STEP-pin of the driver are generated by an Arduino Uno board, which i programmed myself. Here is one more thing that i suspect to be a problem: While I was testing the motor i figured that it can't be driven with a frequency higher than 500 Hz. From around 600 Hz on it just starts humming without moving. Eversince I left the frequency at 500 Hz and also didn't use something like a smooth acceleration or slow-down.

    Apart from that there is no more magic to it :-)

    Thanks!

  4. #4
    Join Date
    Aug 2004
    Posts
    780

    Re: stepper motor positioning error

    You are trying to do something very difficult .. and 99% of similar projects have given up.

    It IS NOT easy to do smooth, accurate, motion control reliably, and with decent speeds and accuracies.
    Each part of the equation, as you described, may be the problem, and probably is.

    Good stepper drivers are not trivial.
    Kit drivers, like yours, are .. and thus wont work "well". They will work ok, if very slow, and driven within their constraints and limits.

    The 500 Hz speed limit is a clue.

    I see, every day, about 20-50 similar ideas projects, everything from raspberry pi, to arduinos, to shields, to this to that.
    Usually with the word "cheap" somewhere.
    And, in 99% of cases, with no motion control experience.

    My suggestion(s).
    First, forget all kit drivers.
    Use a 2M542 or xx542 series stepper driver, with any suitable motors.
    Use a 24-48 v psu for them.

    Second, forget anything usb and anything arduino.
    Use any suitable environment with demonstrated numbers of users doing useful work WITH motion control, steppers, and with reliability and accuracy.

    I am sorry for the negative tone, but..
    Its not easy to re-do a whole motion control ecosystem.
    The needed work is several thousands of hours, and several thousands of people have already done this with L3xx stepper drivers and kit drivers, from since 2002 onwards, usually with bad results.
    There are endless numbers of real problems that you will encounter - many of which you will only encounter once you have already done a huge amount of work and its "almost working".

    Example:
    There are about 10-15 USB breakout boards for mach3. NONE of them work well and completely. Zero.

    Some work ok, and do good useful work for not a lot of money.
    Pokeys is one example.
    It still has limitations, but is reliable and has an excellent motion control hardware engine.
    It is about 3-5x better than the average products.
    Ime.

    It is very, very laborious to truly make a g-code engine.
    All the breakout board makers have failed to do this truly well, all of them.

  5. #5
    Join Date
    Jan 2005
    Posts
    1695

    Re: stepper motor positioning error

    Quote Originally Posted by quantumchaos View Post
    Ever since I left the frequency at 500 Hz and also didn't use something like a smooth acceleration or slow-down.
    I think that is the problem. You are trying to go from zero to 500 hz instantly. That is why it misses whenever you stop, but works if you don't.

    You have several options

    1. Slow the freq down until there is no longer any position error.
    2. Use a higher voltage power supply.
    3. Implement acceleration in your code.

    If you don't want to do the code yourself, you can load GRBL on to the arduino. It will coordinate up to 3 axes and handle the acceleration. A second arduino (or anything with a UART) will be needed to send motion commands to GRBL.

  6. #6
    Join Date
    Jan 2005
    Posts
    1943

    Re: stepper motor positioning error

    Quote Originally Posted by hanermo View Post
    You are trying to do something very difficult .. and 99% of similar projects have given up.

    It IS NOT easy to do smooth, accurate, motion control reliably, and with decent speeds and accuracies.
    Each part of the equation, as you described, may be the problem, and probably is.

    Good stepper drivers are not trivial.
    Kit drivers, like yours, are .. and thus wont work "well". They will work ok, if very slow, and driven within their constraints and limits.

    The 500 Hz speed limit is a clue.

    I see, every day, about 20-50 similar ideas projects, everything from raspberry pi, to arduinos, to shields, to this to that.
    Usually with the word "cheap" somewhere.
    And, in 99% of cases, with no motion control experience.

    My suggestion(s).
    First, forget all kit drivers.
    Use a 2M542 or xx542 series stepper driver, with any suitable motors.
    Use a 24-48 v psu for them.

    Second, forget anything usb and anything arduino.
    Use any suitable environment with demonstrated numbers of users doing useful work WITH motion control, steppers, and with reliability and accuracy.

    I am sorry for the negative tone, but..
    Its not easy to re-do a whole motion control ecosystem.
    The needed work is several thousands of hours, and several thousands of people have already done this with L3xx stepper drivers and kit drivers, from since 2002 onwards, usually with bad results.
    There are endless numbers of real problems that you will encounter - many of which you will only encounter once you have already done a huge amount of work and its "almost working".

    Example:
    There are about 10-15 USB breakout boards for mach3. NONE of them work well and completely. Zero.

    Some work ok, and do good useful work for not a lot of money.
    Pokeys is one example.
    It still has limitations, but is reliable and has an excellent motion control hardware engine.
    It is about 3-5x better than the average products.
    Ime.

    It is very, very laborious to truly make a g-code engine.
    All the breakout board makers have failed to do this truly well, all of them.
    I have to disagree with some of what is stated above.

    First, an Arduino can be a very good choice for motion control. They have a built in clock and if programmed properly can provide dead accurate timing for motion control if used within proper parameters. They do have their limitations, but it has been proven by thousands and thousands of users that an Arduino CAN provide proper motion control. An Arduino will not be running a full blown operating system that needs to prioritize which of the many programs that are running gets the attention. An Arduino will only be running a single program, so the one and only running program already has the top priority. This is a definite benefit.

    Next you say forget about anything USB. Not necessarily true. A simple USB breakout board will not work because you can't count on the timing coming from the computer. However, take the above Arduino for example. The Arduino is providing the accurate real time program for the motion control tasks, so the USB link doesn't have to have accurate timing for each step pulse, it just has to have a USB that can stream fast enough to stay ahead of the arduino. Not a difficult task. Even if the USB did fall behind, the Arduino would just pause inbetween commands and then wait for the next command. That won't really happen though. The above description has also been done with PIC microcontrollers (Planet CNC's USBCNC control board)

    Third, right after you said don't use USB or Arduino, you say"Use any suitable environment with demonstrated numbers of users doing useful work WITH motion control, steppers, and with reliability and accuracy." Well, there are thousand of people using USB and Arduino in combination successfully with steppers, doing motion control accurately and reliably. GRBL, and many other Arduino firmware's are available and used by countless people running them for 3D printers, mills, etc. This right there contradicts just about everything you have said about USB and Arduino.

    Third, you say "Its not easy to re-do a whole motion control ecosystem." While this statement by itself is true, you have absolutely no idea exactly what the OP's end goal is.You have assumed that he intends to create a whole new CNC motion control system with all of the glorious features of Mach3, LinuxCNC, or others. I have made no such assumption. Perhaps the OP simply wants to learn something about Arduino's, steppers, motion control, etc. I see nowhere in his posts a description of his end goal. As for writing a code to interpret G-code taking thousands and thousands of hours, here is a guy who did a 2-axis limited g-code interpreter using only 293 lines of code (LINK) Perhaps this is what the OP is trying to learn. I really don't know, but it could be.

    Forth you said "Kit drivers, like yours, are [trivial].. and thus wont work "well" The OP said he built a driver based on the Allegro A4988 chip. It isn't exactly a "kit" driver. The entire stepper driver is essentially contained on the chip itself except for a few common components (capacitors and resistors) that are fully described in the datasheet for the chip. This will provide a working driver that can do everything that The xx542 driver you recommended can do but on a smaller scale. implementations of these A4988 drivers are used in 3d printers very successfully For small steppers they are a good choice..

    A lot of what is done by folks here in these forums is for education, enjoyment, and self gratification only. I for example built a couple of CNC mill conversions, learning about steppers, drivers, software, hardware...... My end goal was to get a CNC mill. If that was the ONLY goal, I would have been far better off to just buy one already built, but the enjoyment of learning new things, pride in self accomplishment, and a multitude of other things were also part of the equation. You can't simply assume that a person want the most direct way to get from point A to point B. Sometimes the journey IS what it is all about.

  7. #7
    Join Date
    Jan 2005
    Posts
    1943

    Re: stepper motor positioning error

    quantumchaos,

    Re-reading your posts, I agree that not having any kind of acceleration programmed into your Arduino will definitely result in missed steps. don't know if you are microstepping, but at full steps you would be trying to go from 0 to 150 rpm at 500 Hz step rate. All steppers are going to need an acceleration curve of some type. A simple linear acceleration will work. The link I posted ealier has some info on acceleration. I suggest reading that link and it will likely help you a great deal with your p[roject. Here is that link again.

    https://www.marginallyclever.com/blo...e-interpreter/

  8. #8
    Join Date
    Feb 2015
    Posts
    3

    Re: stepper motor positioning error

    Quote Originally Posted by 109jb View Post
    quantumchaos,

    Re-reading your posts, I agree that not having any kind of acceleration programmed into your Arduino will definitely result in missed steps. don't know if you are microstepping, but at full steps you would be trying to go from 0 to 150 rpm at 500 Hz step rate. All steppers are going to need an acceleration curve of some type. A simple linear acceleration will work. The link I posted ealier has some info on acceleration. I suggest reading that link and it will likely help you a great deal with your p[roject. Here is that link again.

    https://www.marginallyclever.com/blo...e-interpreter/
    Hey all,

    thanks for your plenty and colorful input.

    Shame on me, I cant deny that the words/phrases "cheap" and "no experience" fit to my case. But I try to gather experience and if I can get my "almost working" just a little better, I will achieve my goal. And yes, I never defined it. I would like my system to be, say, 20 µm precise within one scanning run. It is not necessary that between different runs it can reliably go to the same position as I am not interested in absolute, but relative positioning. On the other hand this project is for sure for learning, but not only. This device, if working, is intended to be used a couple of times for measuring laser beam profiles where other follow-up choices depends on the result. So it ought to be at least slightly reliable :-)

    In between all your comments I now read two thing several times:

    - Implement acceleration, which I am going to do for sure
    - Use a higher supply voltage. I was just quickly reading about the role of the amount of input voltage, but I guess I got that it effects how fast the motor's coils can build up the necessary winding current. Speaking of which: At the moment I am using a 50%/50% duty cycle for the high- and low-time of a step. Are there any considerations to be taken into account? If I increase the voltage and thus the current builds up faster, can I be longer in the low-state to decrease the consumed power?

    Thanks again for your help!

  9. #9
    Join Date
    Jan 2005
    Posts
    1695

    Re: stepper motor positioning error

    On the A4988, the duty cycle of the step pulse has no effect on the motor current.

Similar Threads

  1. Y axis positioning error
    By Brian L in forum Milltronics
    Replies: 9
    Last Post: 05-29-2012, 09:17 PM
  2. Stepper motor error & laser engraver
    By LaserLord in forum CNC Machine Related Electronics
    Replies: 0
    Last Post: 10-11-2011, 01:03 AM
  3. Positioning an antennae with stepper motor
    By Konstantin in forum CNC Machine Related Electronics
    Replies: 1
    Last Post: 05-14-2011, 01:01 AM
  4. positioning error
    By kendo in forum Haas Mills
    Replies: 1
    Last Post: 12-16-2008, 02:50 PM
  5. 320 Positioning Error
    By elogicca in forum Gecko Drives
    Replies: 2
    Last Post: 07-08-2008, 05:33 PM

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
  •