Close
0%
0%

convert a Mach3 CNC controller to GRBL or FluidNC

simply reuse your old parallel port Mach3 controller with FluidNC or GRBL (USB interface)

Similar projects worth following

14 years ago I built my own CNC machine. At that time, CNC were running with Xp PC using parallel port. Gcode eaten by Mach3 software and sent to steppers controller board using the parallel port pins.

This machine, although dusty and rusty,  still runs on an old PC... but it is time to design something more up to date.

This project is how I reused most of my setup and simply replaced Mach3 (and the old PC) by a modern laptop, controlling a FluidNC (GRBL) board via USB.


CNC parallel port control boards

Mach3, EMC2 and most of CNC softwares were using the parallel port in an (almost) standardized way. They all were outputing step and dir signals to control stepper motors directly on the port using 5v TTL logic.

Typically here is the wiring diagram of one of these control boards:

So all the control signals were sent to the parallel port and configured under Mach3 software.

My control board followed these guidelines and more specifically this wiring scheme:

It is thus a board with the following specifications:

  • able to drive 4 axis steppers (X, Y, Z and A)
  • able to control 4 more outputs (Out1, 2, 3 and 4)
  • able to read 3 home switches (HomeX, Y and Z)
  • able to read one probe

This board should be generic enough to fit most (not to say all) "parrallel port" CNC controllers.


Converting my CNC control board to FluidNC

To design a "pass though" board from FluidNC to my control board I needed to "open" my board to check the logic interface after the parallel port.

Here are the schematics:

You recognize the parallel port (left) followed by 74LS541 chips. These chips are octal buffers and line drivers which are used to "clean" the step, dir and out signals coming from the parallel port. Perfect, if I input 3.3V logic signal instead of 5V one it will work thanks to these drivers!

And the outputs of this board (home signals + probe) are simple switches with a 420 Ohm resistor (named R4).

So nothing complex!


The FluidNC control board

The idea is thus to replace Mach3 software by an ESP32 on which will be flashed FluidNC/GRBL firmware.

Then this board will be connected to the parallel port connector of my old Mach3 controller board. This old board will thus be converted to a modern USB/GRBL/control board. (but could still work using the parallel port as nothing will be modified)

And trust me the new interface board cannot be simpler!

As you can see this board is almost empty! The only added electronics are 4 pull up resistors + capacitors on the "home/probe" lines. 

They form RC filtering to debounce the inputs. And trust me these RC filters are more than useful. See here for details : http://wiki.fluidnc.com/en/support/controller_design_guidelines

So I chose R = 10k and C = 100nF to have a RC time constant close to 10ms.

And that's it, the ESP32 does all the rest with FluidNC.


PCB

The PCB was produced and kindly sponsored by PCBWay. 

Here is a little video to explain everything! 

Follow this log to get more information about how to order your PCB

and if you are new to PCBWay please use this affiliated link : https://pcbway.com/g/o35z4O

Eagle files and Bill of Material are available here : eagle files and BoM



FluidNC installation and configuration

Installing FluidNC is fairly easy. Follow this log

Once done and your config.yaml installed you should be able to run your controller. 

But let's have a closer look at this config file:

name: CNC
start:
  must_home: false
axes:
  x:
    steps_per_mm: 80
    max_rate_mm_per_min: 4000
    acceleration_mm_per_sec2: 100
    max_travel_mm: 1000
    motor0:
      limit_all_pin: NO_PIN
      limit_neg_pin: NO_PIN
      limit_pos_pin: NO_PIN
      hard_limits: false
      pulloff_mm: 1
      standard_stepper:
        step_pin: gpio.13:pu
        direction_pin: gpio.15:pu
        disable_pin: NO_PIN
  y:
    steps_per_mm: 80
    max_rate_mm_per_min: 4000
    acceleration_mm_per_sec2: 100
    max_travel_mm: 1000
    motor0:
      limit_all_pin: NO_PIN
      limit_neg_pin...
Read more »

UGS_Prefs.zip

UGS preferences (can be imported in Universal File Sender)

Zip Archive - 16.50 kB - 01/17/2024 at 15:23

Download

FluidNC_CNC_controller_eagle.zip

Zip Archive - 76.16 kB - 01/17/2024 at 13:23

Download

config.yaml

config file for FluidNC CNC controller

yaml - 1.32 kB - 01/16/2024 at 21:08

Download

  • installing FluidNC

    JP Gleyzes01/16/2024 at 21:04 0 comments

    To install FluidNC on a brand new ESP32, connect it to your serial port with USB and into a web browser go to FluidNC web installer.

    click Install and select the proposed Processor

    Then choose the "Wifi" firmware variant

    Now select the file browser and import the config.yaml of my CNC controller

    Now you should enter the credentials of your wifi router into your ESP32.

    Reboot the ESP32 and a hot spot names "Fluidnc" should appear. Connect to this hotspot with password 123456

    then you should see this page :

    Click on the FluidNC tab and enter your wifi credentials

    now  your ESP32 will reboot and can connect to to your internet router.

    So with your PC browser go to this URL : http://fluidnc.local

    And here we are : your "CNC" is accessible from your web browser

  • the controller PCB

    JP Gleyzes01/16/2024 at 08:14 0 comments

    Converting this schematics into a dual sided PCB was a piece of cake! The only "trick" was to use the PCB to support the DB25 connector. The thickness of the PCB is just perfect to fit between the two rows of the connector. One row on top face (red) the second on bottom face (blue).

    This PCB was sponsored by PCBWay (thanks for that!). You can get yours following this link: CNC controller board PCBway

    The quality of this PCB is, as usual, excellent. 

    The only important parameter when ordering is "thickness". Don't change the default value of 1.6mm

    With this value the PCB will fit perfectly into the DB25 connector pins.

    [update] I have been told that some new connectors have a narrower spacing between rows of pins. So a good advice is to first measure this and then to choose the right PCB thickness.

    The ESP32 lolin Lite board is mounted in "Mezzanine" above this shield, the result is a very compact device that can be powered by a USB cord connected to the PC. (alternatively I added a 5V connector, but I will probably not use it).

    Here you can find Eagle files and BoM

View all 2 project logs

Enjoy this project?

Share

Discussions

Nicholas Witham wrote 03/31/2025 at 14:15 point

Hi, this is a great project! Do you have a wiki or some kind of forum you use for discussion? I'd like to have a try of it myself, but just have a couple of questions.

Do you think it can be used on a Gecko G540? It's parallel port matches nearly identical.

I wonder if using the FluidNC GUI over wifi works? The antenna on the esp32 board you have chosen is not great.

My use case is for a CNC plasma table, for which I would need 1x output for Arc trigger, 1x input for Arc ok signal, and 1x input for Arc voltage (to control torch height on Z axis). It seems your board does include enough IO for this.

Thank you.

  Are you sure? yes | no

JP Gleyzes wrote 03/31/2025 at 15:52 point

Hi,

Sorry no wiki ! But you can contact me freedom2000 at free.fr

If the // port has similar pinout it should work. Most of CNC // port dp use the same pinout !

It also shoud work with Wifi, the ESP32 antenna is not "covered by copper nor epoxy"  as the ESP32 is flying 1cm over the board. This board has quite a good wifi range (not as good as external antenna but correct... I can uploas FluidNC over wifi with it in my garage !

Regarding plasma driver beware of high voltage interferences... for the torch height control don't you need a, ADC input ?

  Are you sure? yes | no

Nicholas Witham wrote 04/01/2025 at 00:52 point

Thanks for the reply.

I'm pretty confident it should work on the Gecko G540, which will be exciting.

High interferences are caused only by certain types of plasma machines, when it is first striking an arc (high frequency start). If the correct type of plasma machine is used (using blowback start), the interference is negligible.

Torch height control just needs an arc voltage output from the plasma machine, which will change dependent on the torch height from the work piece. Some plasma machines have a 1:1 output, some have it scaled down, or some don't have any output at all. If it's a 1:1 readout, a simple voltage divider on that output is all that's needed. Just use a suitable one that suits the input on the ESP32.

Dr DFlow does a better job of explaining it here.

https://www.drdflo.com/pages/Guides/Plasma-Cutters-For-CNC.html

Anyway, thanks again. I'll order the board and see how I go.

Ps. I think I wont solder the DB25 directly to it. I'll use a pigtail cable so I can mount this in a separate box beside my usual setup.

Will drop you an email at some point to

freedom2000 at free.fr

Cheers.

  Are you sure? yes | no

JP Gleyzes wrote 04/01/2025 at 06:38 point

Hi , What I meant is that Torch Height Control requires (at least it's what I understood) an analog voltage to be entered into an ADC of the µcontroler. 

I am not sure whether FluidNC can handle ADC inputs... You'll have to check this !

  Are you sure? yes | no

Nicholas Witham wrote 04/02/2025 at 05:18 point

Haha, yeah I've been thinking that myself since yesterday. It's a shame the ESP32 ADCs didn't get mapped to the outputs on your board (Specifically OUT1 and OUT 4), Version 2 maybe?

Nevermind though, you've left 4 ADCs open on JP1 and JP2. :-)

As you say though, I'd just need to confirm that FluidNC can utilize these pins as an ADC, and how, then I'm in business.

I've ordered the PCBs and a couple of the lolin boards.

Will update you once received.

  Are you sure? yes | no

JP Gleyzes wrote 04/02/2025 at 07:42 point

Well to be more precise, ADC1-4, -6 and -7 are accessible on my board (and the DB25 connector) under the names "HOMEX, HOMEY and HOMEZ". So basically digital inputs.

What you have to check is whether Fluidnc can handle ADCs inputs as "analog voltage" and trigger the internal ADCs of ESP32 on these pins

  Are you sure? yes | no

Nicholas Witham wrote 04/02/2025 at 09:21 point

I'm thinking more like ADC2-0 and ADC2-2. Yeah they won't go through the DB25 plug, but running an extra cable to this board would be ok for me, especially just while I'm tinkering.

What's your intentions with ADC2-0 and ADC2-2 on JP1 and JP2?

(ADC2-1 is recommended not for use by FluidNC)

ADC1-4, -6 and -7 are for homing XYZ, and plug directly into the Gecko homing plugs.

  Are you sure? yes | no

JP Gleyzes wrote 04/02/2025 at 11:27 point

Ah yes, if you can cope with another wire instead of DB25 connector, then you can use JP1 and JP2 pins headers. They were simply there for "future use"! So just perfect !

  Are you sure? yes | no

Nicholas Witham wrote 04/03/2025 at 01:07 point

Turns out ADC2 is shared with Wifi. I'm assuming that'd interfere with the voltage reading.

I might need to steal an ADC1 from somewhere along the DB25

  Are you sure? yes | no

Nicholas Witham wrote 04/03/2025 at 13:26 point

I'll send StepY to GPIO22, then use GPIO12 as the arc control

  Are you sure? yes | no

JP Gleyzes wrote 04/03/2025 at 14:35 point

Great !

  Are you sure? yes | no

DBQ wrote 01/13/2024 at 08:45 point

Where can I download the control software?

  Are you sure? yes | no

JP Gleyzes wrote 01/15/2024 at 14:04 point

control software is fluidNC : http://wiki.fluidnc.com/

  Are you sure? yes | no

aaaaaa wrote 01/06/2024 at 19:08 point

meybe add normal socket usb A female for flash drive/pen drive for g code and ......

screen , keys (like prusa 3d printer  rotor/knob)

  Are you sure? yes | no

JP Gleyzes wrote 01/07/2024 at 08:50 point

I forgot to say that USB socket is already present on the lolin32 esp board.

I have left 4 pins accessible for future use.

For now this board can be controlled by fluidnc and all features that it offers (serial over USB, wifi, bluetooth)

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates