Hello Guest it is September 27, 2021, 09:17:49 AM

Author Topic: Mach4 Modbus MPG (Wifi or Ethernet)  (Read 830 times)

0 Members and 1 Guest are viewing this topic.

Mach4 Modbus MPG (Wifi or Ethernet)
« on: October 09, 2020, 02:28:02 AM »
Original post moving with update:


Parts List (non-affiliate [don't need the w5500 if only using WiFi]):
Code: [Select]

I chose the ESP32 for this project because of all the already available libraries and it's 32-bit processor
so it can read the encoder counts really quickly.

The switch on for battery power is now the big red button on the MPG (normally an Estop?).

For wiring I just desoldered the wires that were already in the MPG and did the following:
Code: [Select]
battery -> TP4056 Charger Module -> XL6009 Boost Convert (3.3 to 5V) -> MPG Estop switch -> ESP32 VIN/GND

(The LED on the MPG PCB is connected to the 3.3v and GND terminals on the ESP32)

    ESP32 GND    -> COM
    ESP32 Pin 2  -> A+
    ESP32 Pin 4  -> B+
    ESP32 Pin 13 -> X Axis
    ESP32 Pin 14 -> Y Axis
    ESP32 Pin 27 -> Z Axis
    ESP32 Pin 25 -> MPG Enable Switch
    ESP32 Pin 32 -> A Axis
    ESP32 Pin 35 -> B Axis (8k ohm pullup to 3.3v)
    ESP32 Pin 34 -> C Axis (8k ohm pullup to 3.3v)
    ESP32 Pin 15 -> Inc 1
    ESP32 Pin 21 -> Inc 2
    ESP32 Pin 22 -> Inc 3

(only if you want ethernet instead of just WiFi)
W5500 Lite:
    ESP32 Pin 23 -> MOSI
    ESP32 Pin 19 -> MISO
    ESP32 Pin 18 -> SCLK
    ESP32 Pin 5  -> CS
    ESP32 Pin 26 -> RST

source code for WiFi:
Code: [Select]
Uncomment #define STATIC_IP to use an automatic configuration.

The rest of the instructions for the firmware are on the git page.

The ModbusMPG.lua file goes in the Mach4 Modules directory

The Ethernet Modbus connection to the ESP32 requires modification of Server.h in the Arduino libraries so I'm not going to include the source. I'll attach the sketch and the modified Server.h file but no instructions. It's easy if you follow the error in the compilation in the Arduino IDE.
« Last Edit: October 09, 2020, 02:37:54 AM by compewter_numerical »
Re: Mach4 Modbus MPG (Wifi or Ethernet)
« Reply #1 on: October 22, 2020, 12:33:04 AM »
Fixed some bugs.

Added restart modbus function
« Last Edit: October 24, 2020, 02:22:03 AM by compewter_numerical »

Offline Tweakie.CNC

  • *
  •  8,807 8,807
  • Super Kitty
    • View Profile
    • Tweakie.CNC
Re: Mach4 Modbus MPG (Wifi or Ethernet)
« Reply #3 on: October 24, 2020, 02:50:47 AM »
Excellent work, my congrats.

Re: Mach4 Modbus MPG (Wifi or Ethernet)
« Reply #4 on: March 15, 2021, 04:55:07 AM »
closer to an open source MPG.

3d print files uploaded. Gerber files almost done.

Re: Mach4 Modbus MPG (Wifi or Ethernet)
« Reply #5 on: August 01, 2021, 11:13:38 AM »
Very good work.
How can i use a button for switch from Step to Cont Modus?