@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:

(SPEED_POWER_MAX - SPEED_POWER_MIN) / 255

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!

7 comments

  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 ;-)
    dfu-programmer
    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
    Board)
    3. Press the reset button to set the board into bootloader mode
    OR
    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.
    Cheers
  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.
    Cheers
  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.
    Cheers
  7. @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.

Leave a comment