@madpilot makes

Converting a Makibox into a PCB Mill – Reprogramming the control board

The version of the Makibox that I purchased came with a printrboard, however I fried that years ago. Makibox shipped me a replacement Print5D D8 controller.

I knew very little about this board, and I wondered how I was going to adapt it for CNC use.

I had some questions:

  1. How do I send it G-Code? Do I need to use the software that came with the Makibox?
  2. Controlling the three axes and endstops was easy, but how would I run the spindle?
  3. After more research about milling PCBs, I found out that using a bed levelling algorithm would give the best results – could the board do that?

After some googling, I found that a kind user had archived all of the original Makibox forums. A post about the D8 firmware lead me to the Makible bitbucket account, which not only housed the original firmware source, it also had the schematics!

Some more random googling yielded another interesting tidbit of information: Marlin has hardware definitions for the D8 board.

The original firmware (from 2014) was based on Sprinter which was forked and became Marlin.

Fun fact: Marlin is also what my Lulzbot Mini uses.

Sending G-Code

I know had an answer to question 1: Marlin appears as a serial device that you can simply send G-Code to. If you have screen installed on your *nix like computer you can just connect (by passing the path to your TTY device) and directly enter G-Codes – although using a G-Code sender is easier.

After wiring up the endstops and motors (only the X and Z because I’m still waiting on the slides for the Y) I entered G28 which runs the homing routine. It worked!

The next problem to solve was driving the spindle. The Makibox schematic revealed the drive circuit for both the hotbed and hotend use a MOSFET to switch a 24V line (using PWM). The MOSFET is rated to 40A, which is plenty to run the 5A spindle I have.

Welcome to 2018

This current firmware is ancient, is tuned to the Makibox build area and doesn’t support autolevelling or controlling a spindle, so I needed to upgrade to the latest Marlin. This was far easier than anticipated.

The board is based on the printrboard which is based on the teensy 2.0++, so the first step is to load the teensy board definitions into the Arduino IDE. Unfortunately, this isn’t via the usual method of adding a URL to the board manager – there is a installable which manually handles installation, and adds a bunch of wizards that, if you have done any Arduino development, kind of get in the way.

Regardless, it allowed me to choose the teensy 2.0+ as a build target.

Next, I modified the configuration.h and configuration_adv.h file with the new build area parameters, and set the various options. A number of these settings hadn’t changed since Sprinter, and I was able to just copy the values. I did have to modify a non-configuration file to allow pin 15 to be defined as a PWM pin.

After compiling, I put the board in bootloader mode by placing a jumper over the boot pins and clicking reset.

Once in bootloader mode I erased the EEPROM and uploaded the binary hex file via dfl-programmer.

sudo dfu-programmer at90usb1286 erase
sudo dfu-programmer at90usb1286 flash Marlin.hex

The spindle parameters took a little bit of trial and error to get right:

To calculate the SPEED_POWER_SLOPE use the formula:


I decided to use 0%-100% as my MIN and MAX, so the value I needed was (100 – 0) / 255 = .392156863.

Using that range allows me to use different gear ratios and to drive a laser cutter without modifying the firmware.

I have purchased a copy of GWizard which calculates spindle speeds and feed rates, and it will output a power percentage based on the profile of the spindle, which makes the calculation easy.

Screenshot from GWizard

I’m not entirely sure what SPEED_POWER_INTERCEPT is, but I’d guess that it is a way of offsetting the speed. I’m not sure why you would need to do that.

The new firmware has given me the ability to set the spindle speed via M3, M4 and M5 (M3 and M4 do the same thing because the hardware can’t reverse the direction of the spindle), and in theory perform an auto-level – I say in theory, because I don’t have a levelling probe, nor do I have the Y-axis linear slides. I have now followed up with the AliExpress seller to see where they are.

So once again, I’m blocked – but progress has been made!


  1. Hi Mylos, all.
    for those who are interested in flashing the new FW a snipped taken from the now vanished MakiWiki.
    The whole article is much longer and would not fit this window nicely.
    Requirements, depending on which OS you are.
    the new compiled hex file of course ;-)
    Flip (Atmel)

    Once you are happy the file is not corrupt its time to move onto the next step, flashing the firmware.
    Flashing the FirmwareCheck Current Firmware Version
    Connect using your host software and issue the M608 command from the terminal.
    Send: M608
    Recv: // 5DPrint Firmware Version: 2.20.42 / 19.5.2014 Recv: // 5DPrint D8 Controller Board

    Enable Bootloader Mode
    1. Power up the board with the power supply and plug in the micro-USB cable
    2. Remove the jumper in the middle of the board at connector R13/JP14 (Printrboard) short the connection at J19 towards the top of the board (D8
    3. Press the reset button to set the board into bootloader mode
    1. Enter the M-Code "M852 F3464" via a controller program to get into boot loader mode.
    FlashingLinux / Mac OS
    Navigate to your downloads folder and issue the flash command to the dfu programmer.
    $ sudo dfu-programmer at90usb1286 flash 5dprint_D8_v_2_20_42.hex Validating...
    93444 bytes used (76.04%)
    If the bootloader mode was successful, you should get a "new device" prompt for an "AVR DFU Bootloader". Also check your windows device manager. While installing the driver select 'Install from a list or specific location" and navigate to the USB directory in Flip's installation directory (usually "C:\Program Files (x86)\Atmel\Flip 3.4.7\usb")
    1. Install FLIP from the following link - http://www.atmel.com/tools/FLIP.aspx 2. Download the latest firmware from the Makibox website in hex format
    3. Start Atmel FLIP
    4. Select the correct device under the Device menu
    1. Device → Select → AT90USB1286
    5. Select the communication method under the Communication menu
    1. Communication → USB → Open
    6. Load the firmware by under the File menu 1. File → Load Hex File
    7. Then, select the correct firmware (e.g. makibox_v2_11.hex) to flash in hex format
    8. Select Erase, Program and Verify options on the program main page and click Run
    9. If green dots are returned on the three tasks you just selected, this means the operation was successful.
    Hope this helps someone , when the sites have gone and Webarchive has backed up nothing.
  2. Hi Myles,
    please let me know how much room the compilation left using your method.
    Compiling using the "Marlin configuration" suite compiles a bare minimum with z-probing gives me a hex file of 169kB.
    Compiling with "Linear ABL" option creates a hex file of over 200kB.
    This does not fit the limited EEPROM of the Makibox MCU.
    Even 3 point leveling does no fit the 120kB limit.
  3. Hi Mylos,
    BTW I mean 120kB Flash ROM.
    In the end I got it working.
    The message given by the Teensy programmer app was wrong.
    It reads the file and calculates the fit by the value given from the OS.
    But those value are based on the amount of allocated clusters on the disk.
    Now the working file compiled with ABL and PWM on output on the Heater 0 is 195kB on disk but 70720 bytes on the chip only.
    The Atmel Flip progammer tool gives you the proper calculated vallue.
    It turns out to be a very handy tool BTW.
    Hope You make progress converting the Makibox into a small CNC.
    Good luck and thanks for the inspiration.
  4. The configuration files I have made for using the Marlin Configurator suite
    DL from here: https://www.thingiverse.com/thing:2403436
    could be downloaded from here:
    - Marlin conf 2.10.7
    - npm package 2.10.5
    - http://lt.rv.ua/mc/?h=localhost:3000&s=af7238eac8e6a5cee87241bdf8c85441
    Good luck
  5. @Thomas_W Are you using Marlin 2? That's good news, as I will be upgrading to that eventually - I'm still on Marlin 1.1.
    I don't have the HEX file handy but I'll compile it this afternoon (I've just arrived back from holidays) and let you know the size.
  6. Hi Myles,
    it is Marlin 1.1 still.
    The numbers are from the tools I used to configure and compile.
    It uses a webbrowser style tool. It works sometimes painfull slowly, but it worked for me.
    Now I want to do something like the poeple do with grbl and Candle.
    Just want to scan the surface occupied by the pcb layout.
    Want a software that does the surface scan alone.
    The only prerequisite, the firmware must allow to go deeper then Zero on the z-axis.
    This was not the case with my old Repetier 0.8x.
    Within the config tool a reduced size mesh for scanning could be defined.
    But it is burned into the firmware the same way if you define the values for global ABL.
  7. Hi Myles,
    there seems to be no good offer for us using the z-hight mapping with no grbl, no Mach3, no LinuxCNC, some proprietary controllers.
    Basically I'm using the rough method as shown by Good Life Labs Miky Sclare (no z-high mapping tough).
    Something that could work somehow sometimes?
    But again , basically it is global ABL only.
    With another firmware based on Repetier-Host the scan area values can be altered by changing the EEPROM data trough a menu in Repetier-Host controller software.
    Dead easy, sort of.
    When using a fixture holding the pcb and known size of the pcb the scan area can be calculated in advance.
  8. @Thomas_W I finally managed to look at the code tonight, and mine comes in (with AUTO_BED_LEVELING_BILINEAR enabled) at about 48% of the total flash space.

    I also tried running a probe, and it works EXCEPT it can't go negative - because I'm using BED_CENTER_AT_0_0 it can only level a quarter of the build area - and it seems to max out at a 50x50mm probe. I will have to do some digging to see if I can hack around that, as that is quite limiting.

    I also managed to get pcb_gcode working in Eagle, though I haven't actually run the cutter yet (I didn't get it working until everyone had gone to bed, and the mill is too loud). I'll try it on the weekend.
  9. hi Myles,
    have you checked "Z-Probe_Low_Point"?
    I have set it to "-2". This should allow going deeper than zero on the z-axis.
    do you have no limit switches at all?
    You could do something like they have on the Carvey-pcb mill.
    It works as a tool length sensor only.
    In the left front corner there is a bracket with a small switch inside.
    The same brackets gives the pcb copper clad the front and left edges.
    It will be at the right position each time. Just push it against the bracket and clamp it down.
    It gets triggered when bringing down the tip of the mill bit. Really neat.
    The software. If I could mange to port the grbl to the 1284P (old machine) 1286 (Makibox, Melziboad) I would do this instead of fiddling with Marlin made for 3D printers.
    I have some talks with the maker of the German Arduinoclub grbl controller.
    He said there should no big effort required porting the code over to those mcu.
    They are very similar. A port to Arduino Mega2560 was mad successfully. Now it has a stable branch status.
    Even porting the grbl code to the ESP32 was not die hard, he said.
    Happy hacking.
    1. I have hardware switches at the top of the Z-axis, and at bottom, left corner of the XY (0,0), and then software endstops at Z=0 and X=185, Y=200. Those are the physical limits of the machine though, so the Z-probe doesn't need to go negative (in the machine space) - with my spoil board the actual limit of my Z is 12, so in practice I would crash the spindle if I tried to go to the physical 0.

      Of course, it can go negative-Z in the workspace. Because CNC has it's center in the middle of the XY plane, I tend to run a G92 X-92.5 Y-100 after homing to reposition the 0. I then zero the Z axis against the reference point on the workpiece using the Z-probe function in CNCjs.

      I've only run one PCB, but it looks like the Eagle plugin I use assumes 0,0 to be the bottom left corner, so my steps looks like this:

      1. Home (Workspace: 0, 0, 77)
      2. Z-probe the top of the PCB to get a reference - zero the probe here (Workspace: 0, 0, 0)
      3. Run the Bilinear bed level over the PCB to get a level mesh
      4. Run the cycle.

      Seems to work well enough.
  10. Hi Myles,
    How have you managed to merge the correction values into the Eagle madeGcode.
    AFAIK the available Eagle ULP Autoleveller plugin I had seen somewhere and tool from Autoleveller.uk are for LinuxCNC/Mach3 only.
    Anyway. Got it with ABL. Best pcb I have made on a pcb mill so far.
    Repetier-Host FW and host-SW, 30 degree singel flute mill, 0,1mm plunge.
    Cutout made jogging the cnc by hand.

Leave a comment