I'm a mechanical engineer and recently I've started to dabble into the crazy world of electronics! I've created a simple 2 axis CNC router powered by an arduino/CNC Shield that works great but I have a new tracer project that I want to start. Basically I want to place an X and Y axis quadrature rotary encoder on each axis rail and use these to record position as the gantry is moved around. Then, I want to push a button to actively 'record' data points, and when I move the gantry head around the table by hand I want the encoders to record this path that I hand trace (maybe data log XY coordinates from rotary encoders every 1/10 of a second when tracing). Then, I want to home the CNC machine and press another 'play' button and have it go re-trace out this path exactly at fixed inches per minute travel speed. Right now I'm just running my CNC machine with open source GRBL and I'm not actually writing any G code for the machine to execute.
Could anyone point me in the right direction on how to get started with this project? Basically how will I convert the data that the rotary encoders are recording into G code that can then be executed by the Stepper motors without having to use Mach 3 or another driver software? I am going for a very minimalist design and hopefully I can data log and execute within the arduino platform (my coding abilities are limited at this point). Any pointers would be greatly appreciated!
mdowns8357:
Could anyone point me in the right direction on how to get started with this project?
I reckon the first thing is to write a short experimental program so you can learn how to gather data from one encoder.
Basically how will I convert the data that the rotary encoders are recording into G code that can then be executed by the Stepper motors
When you can gather data you can study to see how it would relate to GCode.
You have not told us how the encoder steps relate either to physical movement (steps per mm)or to stepper motor steps (encoder-steps per motor-step).
If there is a simple mathematical relationship between encoder-steps and motor-steps maybe you don't need to bother with GCode at all.
And another question ...
Do you plan to record all the encoder steps or just record corner positions - say by moving the "pointer" to a position and pressing a "record" button?
And another ...
Do you plan to move the "pointer" by hand (i.e. physically push it or pull it)
OR
Do you plan to move it "manually" by jogging the motors with buttons. If you are doing that it should be possible to collect the position data without needing encoders - just by recording the steps that the motors take.
Any progress on this? Interested in some starter code/libraries and/or tips on coding.
Found a great resource for recording points here -- (https://wemakethings.net/2013/02/18/steppers-as-rotary-encoders/), but as for converting back to gcode, inputs are likely needed. Thinking to maybe average over 5-10 steps and interpolate a path between?
Thanks!
Joe