Skip to content
bdring edited this page Sep 29, 2020 · 4 revisions

Using the MPCNC Controller

Here are some basic instructions for using the Grbl_ESP32 MPCNC controller. If you have any questions, please ask them via the the issues area of GitHub.

Programming the ESP32

http://www.buildlog.net/blog/wp-content/uploads/2018/08/ESP-32-Dev-Board-800x800.jpg

Note: It is best to program the ESP32 module off the MPCNC board the first time. If the module was previously programmed with different firmware, even a simple blinky program could damage the module if an output pin tries to do something it shouldn't. After it has been programmed once with the proper firmware, you can program it in place or even upload new firmware via WiFi.

The MPCNC controller supports (2) types of ESP32 development modules. Both must have 2 rows of 19 pins, but they can be either 0.9" or 1.0" apart.

Configuring the firmware

The controller uses Grbl_ESP32 firmware. Get it from this repo. There are basic instructions on how to compile the firmware here, but you need do some basic configurations first.

cpu_map.h file

You need to use the mpcnc.h or lowrider.h machine definition file. You need to change the board version in those files if you board is older than version 1.2.

Stepper Motor Driver Modules

The module sockets work with basic StepStick style drivers. you should use Allegro A4988 or TI DRV8825 types only. The board does not support SPI type drivers like the TMC2130, etc.

The drivers are hard wired on the PCB for the highest resolution. A4985 modules would be 16x microstepping and DRV8825 would be 32x microstepping.

The DRV8825 can typically give a little more power and have 2x the resolution, but they are noisier and a little more expensive.

Be sure to install them in the correct orientation. The corner pins are labeled on the MPCNC controller and the driver modules are also labeled. You will destroy the drivers and the ESP32 if you install them backwards.

Note: The voltage reference for the current adjustment potentiometer is based on the 3.3V logic voltage that comes from the ESP32. The ESP32 must be installed and the controller powered up to set the current.

You will need to adjust the current of the drivers. Be careful that the drivers and motors don't get too hot. Hot drivers will shut down and hot motors will melt or soften 3D print mounts. Search the web on how to set the current for your driver. Pololu sells both drivers and is a good source for instructions. Here are some links.

DRV8825

A4988

If you use DRV8825 (32x) and a 16 tooth GT2 pulley, the resolution is 200 steps/mm for X and Y. The resolution for the Z will be 800 steps/mm. These are the defaults in the firmware.

If you you A4988 (16x) your X and Y resolution should be 100 and the Z should be 400. Set these using the $100, $101 and $102 settings menus.

Wiring

Most of the wiring is done with 0.1" headers. You can buy a cheap kit on Amazon. The crimps can be done with a needle nose pliers, but you might want to invest in a crimper. 24Awg wires are fine for any of the connections, except the primary power input should be 16AWG-18AWG.

Input Power

Power input is a terminal block. The power should be between 12VDC-24VDC. The power supply should have a minimum of 5A. Higher, if you turn your stepper driver currents up high. There is an on board 5VDC 3A power supply to power the ESP32. You can also power the ESP32 via a USB cable, but that will only power the ESP32 and nothing else on the controller. ESP32 modules can draw a lot of current (~150mA) with WiFi and Bluetooth enabled. Use a good quality cable if you are using the USB to power the ESP32 or you may get brownout errors. If you keep getting brownout errors, you may have to always power the controller via the main power input.

Limit Switches

The default way to wire the limits switches uses switches that close to ground. There are (2) connectors for the X and Y axes if you are using axis squaring. It does not matter which of the (2) switches wire to those connectors.

Advanced: You could also wire the switches as an open on contact. In that case you would only use one of the connectors and wire both switches in series. You would also need to modify the firmware.

Control Pins

The control pins are an optional feature of Grbl. They are Hold, Start and Grbl Reset. Typically when running a job, you could click hold to immediately, but safely, pause a job. If you click Start, it would resume. If you click Reset while paused, it would end the job and clear the buffer, but position would not be lost.

This feature requires the #define IGNOR_CONTROL_PIN to be removed in config.h (see above).

It typically uses normally open switches that close to ground.

Stepper Motors

Wire the stepper motors to these pins. When viewing the board in the orientation shown above, each of the connectors of 4 pins left to right are: B2, B1, A1, A2, which most commonly should map to Black, Green, Blue/White, Red.

You do not need to reverse one of the motors on X and Y. This is done on the board. You can reverse motor direction in the $$ settings or you can spin a motor connector 180°.

Spindle Relay

You can use this relay to control your on/off spindle (110/220AC or up to 30V DC spindles). You would cut the hot wire on the power cord and run it through the spindle. There will be live AC power on the controller. You should have a qualified person do this and enclose the controller. Make sure all live connections are at least 8mm away from any metal or other wiring.

When using a relay, you should set the max RPM to 1 ($x=1) and issue the command $Spindle/Type=Relay. This will prevent a PWM signal from going to your relay and all RPM values in your gcode will turn on the relay.

Advanced: You could also use this to control a coolant device or vacuum. You would need to change the cpu_map.h files to do this.

Spindle/Laser PWM

This is a 5V PWM output that can be used to control a laser or be a signal for a variable speed spindle speed controller. Be sure to comment out #define USE_SPINDLE_RELAY

Fan output

This is can be used to power a 5V fan to cool the stepper driver modules.