Welcome to Our Community

Some features disabled for guests. Register Today.

Need help understand and choosing a method of control for 3-axis machine

Discussion in 'Controller Boards' started by JPear, Aug 27, 2023.

  1. JPear

    JPear New
    Builder

    Joined:
    Aug 26, 2023
    Messages:
    4
    Likes Received:
    0
    I'm nearing the end of my undergraduate program and I'm on a team for my design project which is to design and build a 3-dimensional CNC wire bender. We've already made a 3D-printed prototype with an arduino and 3 gear motors with encoders. We know what we need for torque and size constraints. We need help making an informed decision on a method of controlling our motors.

    I'd like to start with the options I've considered so far.

    The first option is to scale up the prototype and program an arduino ourselves. This setup would look something like this in my mind:
    1. Program (custom format analagous to g-code)
    2. Arduino (parse and pulses to drivers)
    3. Motor drivers
    4. Motors (with encoder feedback)
    I don't like this approach because I don't like tuning PID controllers and in my experience, it can take a long time to get working correctly. Also, could a single Mega handle

    Second option would be a more traditional hobby cnc approach with open-loop steppers (please correct me if I'm wrong here). The control structure here would look like this:
    1. Program (g-code format)
    2. Motion controller (GRBL, mach3, linuxCNC, other)
    3. Motor drivers
    4. Stepper motors (no feedback this time)
    This option seems more straightforward. The problem is that we really need feedback on our axis that will actually bend wire. It's slow speed and high torque with a gearbox. This option will work but with no way to reliably deal with backlash, it fails to meet our design spec for accuracy.

    Third option is basically the same as the second expect with the addition of a servo motor.
    1. Program (g-code format)
    2. Motion controller (GRBL, mach3, linuxCNC, other)
    3. Motor drivers
    4. Servo motor + steppers
    This option seems the most robust to me, but others on my team and an advisor want to go with option 1 because they are afraid of gcode and think it is more difficult than controlling the motors by programming our own microcontroller.

    Here are my questions surrounding these options.
    • In your opinion, is using an exisiting controller that takes g-code as an input or an arduino/microcontroller the better option? Please justify.
    • Am I missing components in these options? (for example: do I need mach 3 and a motion controller or controller board or a break out board?)
    • Are controller boards flashed with something to change how they interpret g-code? (custom g-codes for example)
    • Can an arduino running GRBL only parse g-code and send pulses to motor drivers or can it still read and write on free pins?
    • Are inexpensive controllers from amazon or aliexpress reliable and a viable option?
    • Is linuxCNC too difficult for a team of 6 who have zero prior experience?
    • What controller board would you reccomend we look into in your opinion? (Our budget is not super tight, but we can't afford top of the line, so keep that in mind please)
    Thank you for reading. Resources or links are greatly appreciated.
     
  2. Alex Chambers

    Alex Chambers Master
    Moderator Builder

    Joined:
    Nov 1, 2018
    Messages:
    2,769
    Likes Received:
    1,357
    How accurate do you need to be? An open loop stepper system with leadscrews can be accurate to +/- 0.1~0.2 mm and backlash can be (almost) eliminated by mechanical means.
    Have a look at the linear actuators in the parts store (Linear Actuators Kits - OpenBuilds Part Store).

    Alex.
     
  3. terjeio

    terjeio Well-Known
    Builder

    Joined:
    Oct 18, 2020
    Messages:
    59
    Likes Received:
    60
    grblHAL can be extended with additional M-codes or even have the parser entirely replaced via plugin code. An example.

    If by Arduino you mean 8-bit Arduinos then you have to use a Mega 256 to be able to add code due to very limited free flash space. And the original code has to be modified to add functionality unlike grblHAL that has an open architecture that allows plugins to be compiled in.

    To avoid EMI issues it might be best to go for controllers that has isolated I/O. Dev boards can be used as well, ESP32 and RP2040 are nearly free - but you have to add the cost of time to add parts to make a functional controller.

    I have no idea of how difficult it will be to adapt LinuxCNC, if the codebase has to be changed then I guess grblHAL will be less challenging.

    Here is a list for grblHAL. I would personally prefer a controller with a MPU that is easily debuggable if any code has to be developed. RP2040 (Pi Pico) and STM32 Nucleo development boards are good choices.

    Disclaimer: I am the lead developer/maintainer of grblHAL.
     
  4. David the swarfer

    David the swarfer OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Aug 6, 2013
    Messages:
    3,430
    Likes Received:
    1,907
    this guy has a few videos on creating your own rotary feedback which you caneasily do with an extra Uno.
    thus you would keep the cnc controller and let it drive all axes as open loop step/direction signals and let a separate Uno take the step and direction for the geared motor and drive the motor as needed.
     
  5. JPear

    JPear New
    Builder

    Joined:
    Aug 26, 2023
    Messages:
    4
    Likes Received:
    0
    We could use a stepper and leadscrew for one of our axes but it's not practical for the other 2. We want +/- 0.5 deg on the other 2 axes. Backlash on the gearboxes that we can afford typically exceeds this.
     
  6. David the swarfer

    David the swarfer OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Aug 6, 2013
    Messages:
    3,430
    Likes Received:
    1,907
    you put the sensor disk on the output shaft and the electronics shoud take up the backlash to hold position, it helps if there is some preload on the output shaft.
     
  7. JPear

    JPear New
    Builder

    Joined:
    Aug 26, 2023
    Messages:
    4
    Likes Received:
    0
    If I do this and use a controller that takes g-code, like grbl for example, then how do I get the encoder feedback back to the controller? For budget reasons I am really limited to stepper motors and as far as I can tell they do not work with off-the-shelf servo drives like the gecko 320x. So at that point am I using another microcontroller to accept the step-dir information from the controller and relay that to the stepper driver and manage feedback?
     
  8. terjeio

    terjeio Well-Known
    Builder

    Joined:
    Oct 18, 2020
    Messages:
    59
    Likes Received:
    60
    If you use a MCU with enough pins, and prefererably with embedded quadrature encoder peripherals, you do not need an extra microcontroller as it will only add complexity.
    An example is the Maslow CNC project uses DC motors and encoder feedback for handling XY motion. IIRC they have custom firmware and I believe also a modified Grbl version that works. PID control is used to handle the feedback.
    When I tinkered with Maslow kinematics a few years back I used a TI TM4C123 MCU since it has two encoder (QEI) peripherals that made it easy to get hold of the position. FYI quite a few 32 bit MCUs has such peripherals nowadays, 8 bit ones likely not so(?).
     
  9. David the swarfer

    David the swarfer OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Aug 6, 2013
    Messages:
    3,430
    Likes Received:
    1,907
    if you watch the video I linked AND his other ones on the topic you will see that he is using a microcontroller to sense the position and control the motor, and that controller can take step and direction signals as inputs. This forms a allinone controller, just like a stepper driver.

    Those step/dir signals would come from a Uno or similar running GRBL or grblHAL, which would then be controlling the motor/sensor/mcu as though it were a stepper driver, just step and direction signals.

    This is the simplest way of doing it, subdivide the problem into 'grbl controller' and 'motor controller'.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice