CNC BF16 - Controller & Firmware

Home

CNC BF16
  • Specifications
  • Mechanics
  • Electronics
  • Controller
  • Software
    CNC Router
    CNC Links

    3D DLP Printer
    UM2+ Dual

    Laser_Show
    CO2_Laser

    Engineering

    Stirling

    Arduino

    VB.NET

    VB6 - 3D
    VB6 - Simulation
    VB6 - Games
    VB6 - Other
    VB6 - Outsourcing

    About

    Valide CSS!
  • The most annoying thing right now is the circular interpolation algorithm, which only allows these quarter start/end points of a circle. Right now, I also like to use the DXF2GCode converter, but it's not working nicely with these circles.. Instead of re-inventing the wheel agian, it's time for some firmware comparison on the internet:
    Project:GRBL:Reprap: Reprap: My approach: Synthetos: MarginallyClever:
    Repository: GRBL Marlin NewFirmware N/A
    Read this
    TinyG & G2 GCodeCNCdemo
    (GCodeAMotorV2)
    Date: 2014/08/07 2011 2010/12/12 2013/06/30 2015/06/03
    File: motion_control.c motion_control.cpp
    (copy GRBL)
    stepper_control.pde MotionCtrl_20130630d.ino plan_arc.cpp N/A
    Read this
    WoW: The arc is approximated by generating a huge number of tiny, linear segments. The length of each segment is configured in settings.mm_per_arc_segment. Vector rotation by transformation matrix: r is the original vector, r_T is the rotated vector, and phi is the angle of rotation. Based on the solution approach by Jens Geisler.
    r_T = [cos(phi) -sin(phi);
    sin(phi) cos(phi] * r ;
    This approximation also allows mc_arc to immediately insert a line segment into the planner without the initial overhead of computing cos() or sin(). By the time the arc needs to be applied a correction, the planner should have caught up to the lag caused by the initial mc_arc overhead. This is important when there are successive arc motions.
    Using a midpoint circle interpolating algorithm, with tables for: dominate axis, octant steps etc. Using a midpoint circle interpolating algorithm, with one switch statement to determine the octant and response. Again an approximation method. The actual calculation is using straight line segments, SIN/COS for each straight line and a count down to finish.
    Remarks: +Probably the fastest code.
    +Buffering.
    (Just use GRBL instead..) +Buffering
    -No speed control
    ?Unsure if all coordinates will work.
    +Simple midpoint circle algoritm.
    -Only quadrant start/stops.
    -No speed control.
    +Buffering +Simple to understand.
    -No buffering.
    -Code not found in repositories.

    Next update for the firmware is the circular interpolation. Based on the Midpoint circle algorithm, I found this very nice document (XY Interpolation algorithms), explaining how this will work in code. I updated the controller firmware, so it finally also accepts the G2 & G3 circular commands.
    There 2 issue's:
  • The acceleration algorithm. Because it's unknown when the arc ends (during incremental steps), the de-acceleration could not be defined. So the current maximum speed is the pull-in/out speed of the steppers. (Which is still fast enough for cutting.)
  • Because of the incremental steps within the algorithm, it could possible happen due to rounding errors, the algorithm will not detect the end position, so it will rotate forever. This could lead to big issue's. Although it's still safe to use: 90, 180, 270, 360 degrees arcs, it's not ideal.

  • Today is the big day where I was waiting for!
    Finally all the mechanical/electronic/software modules are connected.
    Now it's possible to write G-Code in text file (only G0 & G1 are supported) and send this to the machine :)

    Basically, the controller has 2 mayor functionalities:

  • Manual movement:
    Manual movement could be done by a PC screen, but it's more handy without PC interference, just working with a handheld.
  • CNC controlled movement:
    CNC controller approach will be as follow:
  • Use an arduino for sense & simplicity
  • Since the Arduino is relative slow, program it as simple as possible
  • So the Arduino acts only as motion controller
  • All 'difficult' tasks will be done by VB.Net
  • So VB.Net will do the G-Code conversions and send simple 'GoTo' (G0,G1) commands towards the Arduino.


  • One of my main challenges, was to implement the Bresenham algorithm in the Arduino. After reading a lot on the web, I programmed a 4-axis version. It's was running on 15.6 [kHz] or 62 [us/step], which if fast enough to run a stepper.

    Maximum speed algorithm with arduino-uno: 64 [us/step] = 15625 [steps/sec] / 5 [micro stepping driver ] / 200 [steps/rev] * 5 (pitch: [mm/sec]) = 78 [mm/sec] = 4.68 [m/min] fast enough!