Control of an Omrom MX2 VFD via RS485 USB-adaptor

More
06 Jan 2020 16:36 #154152 by Domsku
I am running my milling machine with a Mesa 5i25 and an 7i76 daughter card. Up to now, I controlled my spindle by pushing the buttons on the front panel of the VFD. This I am trying to change now by controlling the VFD via a RS485 USB-adaptor.

I followed the tutorial on youtube of Marco Reps
. However, the VFD is doing nothing.

When I check the USB-ports with the command lsusb, the adaptor is displayed.
The Omrom MX2 VFD is set to be controlled via ModBus network input (A001 = 3, A002 = 3, termination resistor dip switch to the right).
RS485 Adaptor and VFD are connected with a twisted cable with a length of about one meter.

Now my question: Is there a simple way of testing the communication between the RS485-adaptor and my VFD to check if the connection works?

After adding the lines im my custom.hal and custom_postgui.hal I had an error message (attached). This is solved when I comment out the "net spindle-enable" in the hal file. But I guess, that there are more mistakes in my hal file than this one.

File Attachment:

File Name: Portalfraese.hal
File Size:10 KB

File Attachment:

File Name: Portalfraese.ini
File Size:4 KB

File Attachment:

File Name: custom.hal
File Size:0 KB

File Attachment:

File Name: custom_postgui.hal
File Size:0 KB

File Attachment:

File Name: error-message.txt
File Size:61 KB
Attachments:

Please Log in or Create an account to join the conversation.

More
06 Jan 2020 18:02 #154160 by cmorley
In your custom hal file change:

# net on motion.spindle-on => vfd.spindle-on
to
net spindle-enable => vfd.spindle-on

You can uncomment the other line in the sudtom_postgui file.

Chris

Please Log in or Create an account to join the conversation.

More
08 Jan 2020 19:51 #154341 by Domsku
Hi Chris,
the error message is now solved. But still the VFD does not react to the commands of LinuxCNC.
I'm not shure what you ment by "You can uncomment the other line in the custom_postgui file.", so I tried all kind of variation of uncommenting lines. Nothing helped.
I'll try another RS485 adaptor the next days. Is my main hal file ok in the Spindle section?
Dominik

Please Log in or Create an account to join the conversation.

More
09 Jan 2020 00:01 #154364 by cmorley
After adding the lines im my custom.hal and custom_postgui.hal I had an error message (attached). This is solved when I comment out the "net spindle-enable" in the hal file. But I guess, that there are more mistakes in my hal file than this one.
I meant you could reverse whatever you did here but maybe you already did.

i read a bit about usb to rs485 devices and apparently they are sometimes bad about the labeling/meaning of the pins.
I wonder if this could be a problem.
www.windmill.co.uk/rs485.html

Chris
The following user(s) said Thank You: Domsku

Please Log in or Create an account to join the conversation.

More
09 Jan 2020 01:59 #154389 by andypugh
The video looks like it uses the hy-vfd component. That uses registers specific to Huanyang, and also isn't _exactly_ modbus.

You would need a different component for an Omron VFD.

There are a bunch existing drivers:
linuxcnc.org/docs/2.8/html/man/man1/gs2.1.html
linuxcnc.org/docs/2.8/html/man/man1/hy_gt_vfd.1.html
linuxcnc.org/docs/2.8/html/man/man1/hy_vfd.1.html
linuxcnc.org/docs/2.8/html/man/man1/mitsub_vfd.1.html
linuxcnc.org/docs/2.8/html/man/man1/vfdb_vfd.1.html
linuxcnc.org/docs/2.8/html/man/man1/vfs11_vfd.1.html

Just because they are all different.

If your VFD uses real modbus then mb2hal might be the better bet as it is more adaptable.
forum.linuxcnc.org/24-hal-components/34193-vfd-mb2hal?start=0
is likely to be a good starting point.
The following user(s) said Thank You: Domsku

Please Log in or Create an account to join the conversation.

More
11 Jan 2020 20:15 #154636 by Domsku
It seems that the Omron MX2 could work with the Hitachi WJ200 driver:
forum.linuxcnc.org/10-advanced-configura...hi-wj200-over-modbus
However, this driver does not work with the USB-RS485 adaptor, as I understood from this post:
forum.linuxcnc.org/25-classicladder/3313...-wj200-setup?start=0

Now, I guess, I have 2 options:
1. get a serial port card and a RS232 -> RS485 converter and use the wj200 driver, or
2. become acquainted with mb2hal and continue with my USB adaptor.

Although I am not a programmer and have a hard time to understand what is written in the post you have linked above, Andy, but somehow I tend to take the challenge of option 2.

Today, I checked the modbus communication with "modpoll". It looks fine, except that modpoll returns negative values for the frequency, as soon as the frequency of the VFD exceeds 327.6 Hz. But I guess this is due to some kind of overflow.

Please Log in or Create an account to join the conversation.

More
11 Jan 2020 22:50 #154651 by rodw

Domsku wrote: .It looks fine, except that modpoll returns negative values for the frequency, as soon as the frequency of the VFD exceeds 327.6 Hz. But I guess this is due to some kind of overflow.


I would say internally it is using signed integers for the frequency and counting in units of 0.01 Hz.
Signed integer range is from -32767 to +32767 (pretty much exactly what you came up with - see the pattern?)

Please Log in or Create an account to join the conversation.

More
12 Jan 2020 17:51 - 12 Jan 2020 17:53 #154701 by andypugh

Domsku wrote: However, this driver does not work with the USB-RS485 adaptor, as I understood from this post:
forum.linuxcnc.org/25-classicladder/3313...-wj200-setup?start=0 .


Looking a bit deeper than last time (actually being at a LinuxCNC machine helps) it looks like you can select a USB to serial by loading the driver like this:

loadusr wj200_vfd --device /dev/ttyUSB0

Other options are:
--baud
--parity
--stopbits
--databits
--device
Last edit: 12 Jan 2020 17:53 by andypugh.

Please Log in or Create an account to join the conversation.

More
18 Jan 2020 09:26 #155094 by Domsku
It seems, as there is no option --device in this driver. I tested it and received an error message.

File Attachment:

File Name: message.txt
File Size:68 KB


Also in the manuals of this driver there is no option at all.
Attachments:

Please Log in or Create an account to join the conversation.

More
19 Jan 2020 17:52 #155166 by Domsku
Today I managed to set up the mb2hal.ini file. Everything looks very fine and it was actually fairly simple.

The MX2 only supports the mb2hal-functions "fnct_03_read_holding_registers", "fnct_15_write_multiple_coils" and "fnct_16_write_multiple_registers".

The first transaction in my ini file is to read out the actual frequency of the VFD. The register numbers for the output frequency monitor of the MX2 are 1001 hex for the high value and 1002 hex for the low value. The range is from 0 to 40.000 (0.01 Hz-steps). How can I generate a float variable, wich I can than use as input for motion.spindle-speed-in-rps?

And the same question I have for TRANSACTION_03, just the opposite way around: how do I convert the float variable of motion.spindle−speed−out into two variables, in order to write them into the registers 0001 hex for the hi value and 0002 for the low value?
Attachments:

Please Log in or Create an account to join the conversation.

Time to create page: 0.159 seconds
Powered by Kunena Forum