Hello all,
Could someone, please, indicate on how to control 2 stepper motors synchronously to draw a circle.
I did check the "linear interpolation" in the forum, thank you, however, the curved lines would require more variables...
I would appreciate any Flowcode examples, or a link to an application note.
I am not planning to use a G-codes, just to use a radius variable to be entered on the display and a start button to execute the circular motion with predetermined ramping and feedrate.
Any help would be greately appreciated.
If anyone could indicate a link for a good book on the above subject (control phylosophy and math) that would be great!
Thank you very much!
Vasile.
Draw a circle using 2 stepper motors
-
- Valued Contributor
- Posts: 1189
- Joined: Wed May 31, 2017 11:57 am
- Has thanked: 70 times
- Been thanked: 439 times
- Contact:
Re: Draw a circle using 2 stepper motors
That's an interesting idea.
Of course the simplest way to draw a circle with two motors is to just use one of them
If you use two motors you will have to combine horizontal and vertical steps - using an algorithm such as https://www.google.com/url?sa=t&source= ... D_bW224dx1
Which is fairly easy to use - I used it for an LCD display..
So you have the option of drawing a horizontal line and then moving vertically to draw a filled circle or stepping around the outside of the circle?
Have a look at the etch a sketch mechanism for a way to control the pen.
Martin
Of course the simplest way to draw a circle with two motors is to just use one of them
If you use two motors you will have to combine horizontal and vertical steps - using an algorithm such as https://www.google.com/url?sa=t&source= ... D_bW224dx1
Which is fairly easy to use - I used it for an LCD display..
So you have the option of drawing a horizontal line and then moving vertically to draw a filled circle or stepping around the outside of the circle?
Have a look at the etch a sketch mechanism for a way to control the pen.
Martin
-
- Posts: 24
- Joined: Sun Jun 04, 2017 6:27 am
- Has thanked: 17 times
- Been thanked: 2 times
- Contact:
Re: Draw a circle using 2 stepper motors
Thank you for the link, Martin.
I did check the Bresenham algorithms, they do look promising. They are great for drawing on the displays but, there are some other issues when it comes to the mechanical implementation: acceleration/deceleration, linear speed when following a curve etc. I did also noticed that the "lookup" algorithm is used but could not find details about it.
Now, regarding the hardware and Flowcode.
I am planning to use my old 3 axis CNC machine as a test bed.
I would like to make a stand alone (usually called offline) 3 axis controller with a local display (HMI) to be able to select shapes and enter sizes and execute. So far I am looking for:
1. Circles (contour and mill)
2. Rounded rectangles (contour and mill).
My next question is on how to handle the micro controller outputs in real time. Looks like I will have to generate pulses simultaneously on at least 2 outputs and taking in consideration the ramp up/down dynamics and some compensation to have consistent linear speed when following an arc.
What would be the best approach, using interrupts, multi thread, etc.?
I am sure that something would be done before me, just cannot find the right material.
It would be great to find a programming example out there.
I do need to educate myself in this field first, but, unfortunately, I could not find yet any literature describing this multi axes stepper motors control philosophy specifically for microcontrollers. Lots of articles with general information, but nothing to use as a proven reference.
Any input would be greatly appreciated.
Thanks again.
Looking forward for more info.
Have a great day!
Vasile.
I did check the Bresenham algorithms, they do look promising. They are great for drawing on the displays but, there are some other issues when it comes to the mechanical implementation: acceleration/deceleration, linear speed when following a curve etc. I did also noticed that the "lookup" algorithm is used but could not find details about it.
Now, regarding the hardware and Flowcode.
I am planning to use my old 3 axis CNC machine as a test bed.
I would like to make a stand alone (usually called offline) 3 axis controller with a local display (HMI) to be able to select shapes and enter sizes and execute. So far I am looking for:
1. Circles (contour and mill)
2. Rounded rectangles (contour and mill).
My next question is on how to handle the micro controller outputs in real time. Looks like I will have to generate pulses simultaneously on at least 2 outputs and taking in consideration the ramp up/down dynamics and some compensation to have consistent linear speed when following an arc.
What would be the best approach, using interrupts, multi thread, etc.?
I am sure that something would be done before me, just cannot find the right material.
It would be great to find a programming example out there.
I do need to educate myself in this field first, but, unfortunately, I could not find yet any literature describing this multi axes stepper motors control philosophy specifically for microcontrollers. Lots of articles with general information, but nothing to use as a proven reference.
Any input would be greatly appreciated.
Thanks again.
Looking forward for more info.
Have a great day!
Vasile.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Draw a circle using 2 stepper motors
Hello,
Some G code converters will simply use linear interpolation making the circle up of lots of individual straight lines.
However some more advanced G code converters will use circular interpolation. It's very similar to linear interpolation but uses SIN and COS with a radius and a central offset to provide a circular motion path. Its a lot more advanced but it certainly can be done.
https://www.cnc.com/circular-interpolation-cnc/
Some G code converters will simply use linear interpolation making the circle up of lots of individual straight lines.
However some more advanced G code converters will use circular interpolation. It's very similar to linear interpolation but uses SIN and COS with a radius and a central offset to provide a circular motion path. Its a lot more advanced but it certainly can be done.
https://www.cnc.com/circular-interpolation-cnc/
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel