About to embark on writing my first HAL for Chinese VFD - Need Help

More
30 Jan 2020 18:23 #156192 by willkallio
Hello:
I bought a Chinese "SXCNC" CNC6040, with 1.5kW VFD (Model# MK100-1S1.5G-DK) that I want to control via LinuxCNC.

I haven't been able to find documentation for my exact VFD model, but I found the manual for a similar VFD that has the same modbus registers (Model# MK100-2S2.2G-DK ) 1drv.ms/b/s!AlWEvfzVs336oREF9zNq6qcxH5kF

I'm not sure, but it may be similar to E100 VFD as well.

If anyone has any pointers on how to get started, I'd love to hear em... there is so much out there when I search that is is super confusing. I am familiar with writing code for modbus, just not how that all ties into linux CNC. Ideally I would use the relay output on the VFD to turn the water pump on automatically too, or do it based on motor temp.

Thank You in advance!

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

More
30 Jan 2020 19:02 #156195 by Todd Zuercher
My personal take on a spindle cooling water pump. If the machine is on, the pump should be running, regardless of whether or not the spindle is actually running. And a flow detector to detect if the water is actually moving and sets an alarm when/if it isn't, is a good idea to.

There are two generic ways to do modbus communication in Linuxcnc that I know of. The first is Mb2hal, the other is using Classicladder. A third option would be to write your own driver similar to the ones made for other drives.

You configure Mb2hal using a separate INI file that configures all of the modbus transactions. Then there are a few lines of hal code. Setting it up is all done by hand editing text files.

Using Classicladder's modbus communications are set up from within Classicladder's gui.

When I first tried to set up the machine that I use modbus on, I used Classicladder to test the modbus comunication with the VFDs. However CL's limit of only 16 transactions would only let me control half of the 8 VFDs I needed to run. Lucky for me (since I have no coding skills to write my own driver) this was about the same time that Mb2hal was first released and I was able to use it instead.
The following user(s) said Thank You: willkallio

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

More
30 Jan 2020 21:17 #156207 by willkallio
Due to my application, it does not make much sense to leave the water running all the time.. but the flow detector is a good idea, cheap insurance

If I use the MB2HAL, would I still be able to get those cool gauges that show set rpm and spindle load in Amps? If not, no biggie

I see a sample HAL and INI configs here:
www.forum.linuxcnc.org/media/kunena/atta...YL620_2019-12-24.ini
www.forum.linuxcnc.org/media/kunena/atta...nts/19222/custom.hal

So I have this right:
1) go through settings on VFD and write down default parameters
2) manually change the registers to allow for modbus control
3) set up INI with serial info
4) write a 'transaction' for each thing I want to do:
- initial setup
- set RPM
- get load in Amps
- start and stop spindle
5) edit the HAL to link HAL 'pins' to MB2HAL 'transactions'

do i have this right?

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

More
31 Jan 2020 18:30 #156265 by Todd Zuercher
Just rember that the need for cooling doesn't stop the moment the spindle does. (it should run for another 10-15 min after.)

Yes you can get all the info the VFD supplies and send it to what ever gui displays you wish to set up.

Some of the things you read or write can be rolled into a single transaction if they are in contiguous registers.

If you look at the transactions in the Mb2hal ini, you should see where the data from them are given a name that will correspond to the name of the hal pin(s) Mb2hal will create.

You may find that you will need to perform some mathematical gymnastics to convert the data the VFD sends and reads. Such as extracting bits from integers, or converting bits to integers, or converting floats and integers. Most all of which should be possible using different hal components and a little creativity.

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

More
11 Feb 2020 13:20 #157048 by andypugh
There are some very cheap flow meters on eBay:
www.ebay.co.uk/itm/153602320747
You can connect one to an encoder counter and then use the velocity output in HAL.

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

Time to create page: 0.066 seconds
Powered by Kunena Forum