[Resolved] Requesting help for VFD control over RS485

More
08 Sep 2020 18:35 - 10 Sep 2020 16:39 #181310 by TannerFrisby
See my third post for my implemented solution.

Hello all,

Goal:
I would like to control my Teco Westinghouse L510 VFD over RS485 using a USB-to-RS485 addapter.

Current state:
1. I can successfully send a command (packet?) to the VFD from a Window's machine (I'm slowly becoming more familiar with Linux) using ComDebugger which illicits a serial response and the change requested. The VFD soon errors out due to lack of communication, but I think that will be handled by LinuxCNC.

2. I have downloaded the GitHub L510_VFD files and transfered them from my window's machine to a new folder on my LinuxCNC machine. The folder is ~/linuxcnc/vfd/ (I appologise for not knowing the exact syntax).

3. In a terminal window, I (typed, ran, executed?) :~/linuxcnc/vfd/$ sudo halcompile --install l510_vfd.c
I did this based on what I have read here. This resulted in the following:

Compiling realtime l510_vfd.c
l510_vfd.c:39:20: fatal error: modbus.h: No such file or directory
#include <modbus.h>

Compilation terminated.

Furthermore, there are a lot more .h files that I don't think I have (or know how to point to) that will issue the same problem.

4. I have watched the Marco Reps video on setting up the Huanyang VFD here but I am not proficient enough to adapt this to my L510 VFD.

Resources:
VFD Modbus
Marco Reps VFD Video
Unresolved L510 Installation Thread
GitHub Files for L510?


Assitance Request:
Could somebody provide a little hand holding for me or point me in the direction of resources that I can use?

Thanks,
Tanner Frisby
Last edit: 10 Sep 2020 16:39 by TannerFrisby. Reason: Posting my selected solutions and marking the topic as resolved.

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

More
09 Sep 2020 17:01 #181466 by TannerFrisby
From wiki.linuxcnc.org/cgi-bin/wiki.pl?VFD_Modbus

Because each VFD maker implements Modbus differently, a custom HAL component will most likely be needed for each VFD model. Typical VFD HAL components will not be .comp files, which can be compiled and documented with the comp utility, but a C file needing its own Makefile and manual documentation. For compiling the C file, the emc2-dev (or linuxcnc-dev) package will need to be installed. This should be available using Synaptic. A Makefile can be copied from an existing sample and modified to use the new component name. The mobus.c and modbus.h files may be copied from existing examples, but it may be better to download the latest libmodbus package from the libmodbus website:
packages.ubuntu.com/search?keywords=libmodbus
libmodbus.org

Roughly, the procedure might be...
Create a directory under "/home/my_home/emc2" such as "/home/my_home/emc2/my_vfd"
Copy into "my_vfd" a sample vfd.c, modbus.c, modbus.h, and Makefile
Edit my_vfd-x.c and Makefile
Run "cp my_vfd-x my_vfd.c", "make", "sudo make install"
Copy sample linuxcnc config files in "/home/my_home/emc2/configs/myCNC/"
Edit the .hal file in "...myCNC/myCNC.hal" to "loadusr my_vfd ..." and connect HAL pins
Invoke emc2 and enjoy
Notes on using vfs11_vfd.c as the base for a new Modbus device C component -> New file from vfs11.


I placed the l510_vfd.c and submakefile on my desktop. I downloaded the GitHub src files for libmodbus to my desktop also. I then put the following into the command line:

cnc@cnc:~/Desktop$ halcompile --install l510_vfd.c
Compiling realtime l510_vfd.c
Linking l510_vfd.so
/usr/bin/ld:l510_vfd.ver:2: syntax error in VERSION script
collect2: error: ld returned 1 exit status
/usr/share/linuxcnc/Makefile.modinc:119: recipe for target 'l510_vfd.so' failed
make: *** [l510_vfd.so] Error 1


Assistance is still requested.

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

More
10 Sep 2020 16:38 #181656 by TannerFrisby
I have managed to reach my listed goal using an alternative solution.

I stumbled across a HAL userspace component written by aekhv. The title of aekhv's thread is "[ Vfdmod ] An easy VFD control over MODBUS RTU" and it deliveres on its promise.

An alternative is MB2HAL which appears to be older and more integrated. I compared the documentation between the two and determined Vfdmod to be more novice-friendly.

I was planning on writing up the steps I used to establish communication with my vfd, but aekhv's documentation is immaculate. The only things I can add are the hick-ups I encountered that only another complete novice would encounter. LinuxCNC is probably a gateway into linux for many familiar with only windows/mac, and I am slowly learning the ins-and-outs. This may not be the most efficient workflow, but it got me up and running:

1. Download the correct release. Also acceptable would be a thumbdrive transfer if your LinuxCNC computer is not connected to the internet. I am running Linux2.8 "stretch", so I downloaded the stretch release. The standard 2.7 (at the time of this writting) is wheezy.

2. Locate the download. For me, it downloaded to my "Downloads" folder.

3. Open a terminal window from inside the "Downloads" folder by right clicking and "Open terminal here". Alternatively, open a terminal window from anywhere and navigate to this folder ("directory?") using "cd" and "ls" commands.

4. The downloaded file is a .deb "package". I used the command "sudo dpkg -i <filename.deb>" where <filename.deb> is vfdmod-0.3.2-stretch-amd64.deb in my case. Enter your password if prompted.

And from this point, I yield to aekhv's Wiki .

I have attached my "my-config-file.ini" as a reference example for other Teco L510 users or those who want an example. Also reference the registers .

Warnings: your minimum and maximum rpm, as well as rpm scalars ("multiplier" / "divider") will likely not match mine. That is why I call this a reference example.

File Attachment:

File Name: my-config-file.ini
File Size:5 KB


Lastly, my USB-to-RS485 device plugged into the back of my machine, happens to use aekhv's default /dev/ttyS0. To determine yours, you may try the following command in terminal: " ls /dev/ttyS* " to list the available ttyS#'s. My machine has [0,3] available. An ignorant solution is to guess and check 0, 1, 2, and 3 until it "works".

I have written these instructions in terms I would give myself one week ago when I started bumbling through rs485 control. Hopefully these can help someone else in my former position.

-Tanner Frisby
Attachments:
The following user(s) said Thank You: tommylight, wesolowskig, Aciera, aekhv, mantimei

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

More
14 Sep 2020 15:12 #182091 by aekhv
Hi Tanner,

Nice work, thanks for sharing your config file!

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

Time to create page: 0.125 seconds
Powered by Kunena Forum