Help with Modbus needed
- viesturs.lacis
- Offline
- Premium Member
-
Less
More
- Posts: 112
- Thank you received: 3
03 Oct 2026 20:25 #350086
by viesturs.lacis
Help with Modbus needed was created by viesturs.lacis
Hello!
I need to control Invertek Optidrive E3 VFD from LinuxCNC. I have start/stop signal working from Mesa board output and I can set the speed from potentiometer but the actual user wants to set the speed from g-code to avoid potential mistakes, especially if there will be toolchange and different spindle speeds would be needed for different tools.
The thing is that all 4 analog outputs on Mesa 7i33 board are already used for servodrives, so I was thinking that I could hopefully set the frequency via modbus instead of getting new board just for analog output.
I have usb-to-rs485 converter, lsusb shows it as CH340 chip and I was able to determine that it is using ttyUSB0 port.
Here is the section of Optidrive E3 manual that describes the modbus message contents:
ibb.co/PzFsq8fP
And according to manual I can still have start/stop signal the way I have now even when the drive is in Modbus mode so what I would need is
to send the frequency value (optionally - read actual frequency to determine "spindle-at-speed" and "spindle-is-stopped"):
ibb.co/PGXK2gW5
I tried searching web of how to start and went for mb2hal route.
In HAL file I have:
loadusr -W mb2hal config=mb2hal.ini
Here is contents of mb2hal.ini file:
pastebin.com/h9qHcPR1
I tried looking at pins of mb2hal component in HalShow but the only thing that was changing was a pin that shows number of errors.
mb2hal.ini file has 2 entries about debug messages but I did not even understand where to find them so at the moment I have exactly no idea what is wrong and how to proceed so I would appreciate if someone could hold my hand and then gently poke in correct direction. It seems like a basic thing of what people are doing with VFDs over modbus but I have never done that.
I need to control Invertek Optidrive E3 VFD from LinuxCNC. I have start/stop signal working from Mesa board output and I can set the speed from potentiometer but the actual user wants to set the speed from g-code to avoid potential mistakes, especially if there will be toolchange and different spindle speeds would be needed for different tools.
The thing is that all 4 analog outputs on Mesa 7i33 board are already used for servodrives, so I was thinking that I could hopefully set the frequency via modbus instead of getting new board just for analog output.
I have usb-to-rs485 converter, lsusb shows it as CH340 chip and I was able to determine that it is using ttyUSB0 port.
Here is the section of Optidrive E3 manual that describes the modbus message contents:
ibb.co/PzFsq8fP
And according to manual I can still have start/stop signal the way I have now even when the drive is in Modbus mode so what I would need is
to send the frequency value (optionally - read actual frequency to determine "spindle-at-speed" and "spindle-is-stopped"):
ibb.co/PGXK2gW5
I tried searching web of how to start and went for mb2hal route.
In HAL file I have:
loadusr -W mb2hal config=mb2hal.ini
Here is contents of mb2hal.ini file:
pastebin.com/h9qHcPR1
I tried looking at pins of mb2hal component in HalShow but the only thing that was changing was a pin that shows number of errors.
mb2hal.ini file has 2 entries about debug messages but I did not even understand where to find them so at the moment I have exactly no idea what is wrong and how to proceed so I would appreciate if someone could hold my hand and then gently poke in correct direction. It seems like a basic thing of what people are doing with VFDs over modbus but I have never done that.
Please Log in or Create an account to join the conversation.
- tommylight
-
- Away
- Moderator
-
Less
More
- Posts: 21942
- Thank you received: 7471
03 Oct 2026 21:27 #350087
by tommylight
Replied by tommylight on topic Help with Modbus needed
Please upload pictures and config files here on the forum, not on 3'rd party sites, they contain way to much bad scripts.
Please Log in or Create an account to join the conversation.
- rodw
-
- Online
- Platinum Member
-
Less
More
- Posts: 12155
- Thank you received: 4148
04 Oct 2026 01:24 #350088
by rodw
Replied by rodw on topic Help with Modbus needed
Looks like register 2 sets the frequency. 7 is the actual frequency
at speed will use the near component to compare the two.
I did a detailed Youtube video showing how to use mb2hal recently. You will find it on my @MrRodW channel,
modbus lete you read concecutive registers in one call.
at speed will use the near component to compare the two.
I did a detailed Youtube video showing how to use mb2hal recently. You will find it on my @MrRodW channel,
modbus lete you read concecutive registers in one call.
Please Log in or Create an account to join the conversation.
Time to create page: 0.248 seconds