Skip to content

RS485 Modbus Module

bdring edited this page Jan 18, 2024 · 18 revisions

This is an RS485 CNC Module that can be used to control spindle VFDs (Variable Frequency Drives).

Huanyang Wiring

Ideally use 22-24awg twisted, shielded cable. If that is not available a twisted pair of wires will work for smaller machines. Ethernet cable can work too.

RS485 Module VFD Description
A RS+ Low (logic 1)
B RS- High (logic 1)
Gnd N/C Terminate cable shield if you have one

VFD Parameters

Before using the parameters must be setup per below.

Parameter Value Description
PD001 2 RS485 Control of run commands
PD002 2 RS485 Control of operating frequency
PD005 400 (Hz) Maximum frequency Hz (RPM/60)
PD011 120 (Hz) Minimum frequency Hz (RPM/60) (Recommend Aircooled=120 Water=100)
PD014 10 Acceleration time (Test to optimize)
PD015 10 Deceleration time (Test to optimize)
PD023 1 Reverse run enabled
PD142 3.7 Max current Amps (0.8kw=3.7 1.5kw=7.0, 2.2kw=??)
PD143 2 Motor Poles Typically 2. It is used for RPM Hz to RPM conversion
PD163 1 RS485 Address
PD164 1 RS485 Baud rate: 9600
PD165 3 RS485 Mode: RTU, 8N1

FluidNC config File Examples

Module Socket #3

uart1:
  txd_pin: gpio.26
  rxd_pin: gpio.16
  rts_pin: gpio.4
  baud: 9600
  mode: 8N1

Huanyang:
  uart_num: 1
  modbus_id: 1
  tool_num: 0
  speed_map: 0=0% 0=25% 6000=25% 24000=100%

Module Socket #4

uart1:
  txd_pin: gpio.14
  rxd_pin: gpio.15
  rts_pin: gpio.13
  baud: 9600
  mode: 8N1

Huanyang:
  uart_num: 1
  modbus_id: 1
  tool_num: 10
  speed_map: 0=0% 0=25% 6000=25% 24000=100%

Grbl_ESP32 Machine Definition Examples

Socket #1 cannot be used because all pins are input only

Socket #2 should work...not tested yet. (waiting for V1p1 hardware)

// RS485 Modbus In socket #3
// https://github.com/bdring/6-Pack_CNC_Controller/wiki/RS485-Modbus-Module
#define SPINDLE_TYPE            SpindleType::HUANYANG // default, check actual $Spindle/Type Setting
#define VFD_RS485_TXD_PIN        GPIO_NUM_26
#define VFD_RS485_RTS_PIN        GPIO_NUM_4
#define VFD_RS485_RXD_PIN        GPIO_NUM_16
// RS485 Modbus In socket #4
// https://github.com/bdring/6-Pack_CNC_Controller/wiki/RS485-Modbus-Module
#define SPINDLE_TYPE            SpindleType::HUANYANG // default, check actual $Spindle/Type Setting
#define VFD_RS485_TXD_PIN        GPIO_NUM_14
#define VFD_RS485_RTS_PIN        GPIO_NUM_13
#define VFD_RS485_RXD_PIN        GPIO_NUM_15

Socket # 5 cannot be used because all pins are output only.

Clone this wiki locally