Hello Guest it is October 09, 2024, 02:28:08 PM

Author Topic: Mach4 Modbus MPG (Wifi or Ethernet)  (Read 10734 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:

https://www.machsupport.com/forum/index.php?topic=43332.msg280091#msg280091

Parts List (non-affiliate [don't need the w5500 if only using WiFi]):
Code: [Select]
https://www.amazon.com/gp/product/B01E6VTZHC/ref=ppx_yo_dt_b_asin_title_o07_s00?ie=UTF8&psc=1
https://www.amazon.com/gp/product/B07BTRLKPT/ref=ppx_yo_dt_b_asin_title_o04_s04?ie=UTF8&psc=1
https://www.amazon.com/gp/product/B082XJXQS6/ref=ppx_yo_dt_b_asin_title_o04_s00?ie=UTF8&psc=1
https://www.amazon.com/gp/product/B07XG323G8/ref=ppx_yo_dt_b_asin_title_o03_s01?ie=UTF8&psc=1
https://www.amazon.com/gp/product/B07T4YHP7Q/ref=ppx_yo_dt_b_asin_title_o02_s00?ie=UTF8&psc=1
https://www.amazon.com/gp/product/B07Q576VWZ/ref=ppx_yo_dt_b_asin_title_o04_s03?ie=UTF8&psc=1

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)

MPG PCB:
    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]
https://github.com/kethort/Mach4ESP32ModbusMPGHandwheel
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

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

Tweakie.
PEACE
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.

https://www.youtube.com/watch?v=sGhttK0reT0
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?