Translate Chinesium for VFD to mb2hal

More
13 Aug 2023 21:56 #277883 by echristley
Could I get some help configuring Mb2hal to control a VFD?  Any hint would be appreciated.  I bought a Mollum VFD from Amazon, and so far I've been able to get LinuxCNC to run the spindle by loading mb2hal through the Halshow interface in gmoccapy, and setting the target_state pin to 1.

A link to the manual.  The pertinent part is page 44-47, with 45 being the most important.  It appears that it only supports commands 3 and 6 (page 47).
m.media-amazon.com/images/I/B1-VeHyD+gL.pdf


My mb2hal INI file:

#This .INI file is also the HELP, MANUAL and HOW-TO file for mb2hal.

#Load the Modbus HAL userspace module as the examples below,
#change to match your own HAL_MODULE_NAME and INI file name
#Using HAL_MODULE_NAME=mb2hal or nothing (default): loadusr -W mb2hal config=mb2hal_config.ini


# ++++++++++++++++++++++++
# Common section
# ++++++++++++++++++++++++
[MB2HAL_INIT]
INIT_DEBUG=3
SLOWDOWN=0.0
TOTAL_TRANSACTIONS=2

# ++++++++++++++++++++++++
# Transactions
# ++++++++++++++++++++++++

[TRANSACTION_00]
LINK_TYPE=serial
SERIAL_PORT=/dev/ttyACM0
SERIAL_BAUD=19200
SERIAL_BITS=8
SERIAL_PARITY=none
SERIAL_STOP=2
SERIAL_DELAY_MS=20
MB_SLAVE_ID=1
FIRST_ELEMENT=8192
PIN_NAMES=target_state
MB_TX_CODE=fnct_06_write_single_register
MB_RESPONSE_TIMEOUT_MS=500
MB_BYTE_TIMEOUT_MS=500
HAL_TX_NAME=spindle_set
MAX_UPDATE_RATE=0.0


[TRANSACTION_01]
LINK_TYPE=serial
SERIAL_PORT=/dev/ttyACM0
SERIAL_BAUD=19200
SERIAL_BITS=8
SERIAL_PARITY=none
SERIAL_STOP=2
SERIAL_DELAY_MS=20
MB_SLAVE_ID=1
FIRST_ELEMENT=12288
PIN_NAMES=current_state
MB_TX_CODE=fnct_03_read_holding_registers
HAL_TX_NAME=spindle_read
MAX_UPDATE_RATE=0.0
 

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

More
14 Aug 2023 02:20 #277903 by echristley
One update. If I set the target_state to 2, the spindle does run in the other direction. Any other value, and nothing will happen. And writing 1 or 2 after than doesn't result in the spindle moving either. So, it seems I'm writing to the correct memory address, but I can only write to it once.

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

More
14 Aug 2023 04:59 - 14 Aug 2023 05:04 #277911 by JPL

One update. If I set the target_state to 2, the spindle does run in the other direction. Any other value, and nothing will happen. And writing 1 or 2 after than doesn't result in the spindle moving either. So, it seems I'm writing to the correct memory address, but I can only write to it once.
 

Did you try sending 16 or 32 to stop the spindle?
Last edit: 14 Aug 2023 05:04 by JPL. Reason: chaged sent value from 4 to 16 or 32

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

More
14 Aug 2023 14:30 #277960 by echristley
Yes. Didn't work.

However, I've been messaging with the manufacturer through Amazon. I've not tested yet, but they say that writing the desired frequency to 1000H will control the speed. For me, it needs to be between 30 and 90. I'll write another transaction to set the speed, but I think I'll need to write a function to filter any value going to the resulting pin to only accept values in that range.

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

More
14 Aug 2023 15:08 #277964 by andypugh
You might find this HAL component useful: linuxcnc.org/docs/2.9/html/man/man9/enum.9.html

You are probably using 2.8 and it isn't in 2.8, but it should be possible to compile and install it with halcompile: github.com/LinuxCNC/linuxcnc/blob/master...al/components/enum.c

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

More
14 Aug 2023 16:30 #277978 by JPL
Just wanted to mention that those entries:

LINK_TYPE=serial
SERIAL_PORT=/dev/ttyACM0
SERIAL_BAUD=19200
SERIAL_BITS=8
SERIAL_PARITY=none
SERIAL_STOP=2
SERIAL_DELAY_MS=20
MB_SLAVE_ID=1

Only need to appear once unless it is a different setting for subsequent transactions.

 
The following user(s) said Thank You: echristley

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

More
14 Aug 2023 16:52 #277980 by echristley
I'll clean them up when I'm done, but for development (more appropriately called "exploration"), I've been shifting them around. Easier to cut-n-paste and duplicate the whole block.

About the enum component: Is that more a readabiity thing? I'd be able to send ON_FWD, ON_REV, STOP, etc instead of 1,2,3,4 or 1,2,4,8 (whichever the case may be)?

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

More
15 Aug 2023 23:47 #278098 by echristley
Well, it still isn't working, but a bit of good news. The Mollum appears to be a duplicate of the EV200 sold by StepperOnline. Has anyone had luck getting one of those running via RS485?

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

More
17 Aug 2023 01:19 #278220 by echristley
This is strange.

The USB-485 adapter has Power, RX and TX lights. Just the Power in on until I get LinuxCNC going. The RX and TX light up like Christmas then.

I'm able to send one command, and then it is back to just the Power. If I power cycle the computer, the TX flashes once when LinuxCNC comes up. And, then nothing.

Looking for ideas on what might be causing this. Something from the running VFD feeding back into the adapter, maybe?

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

More
18 Aug 2023 00:50 #278315 by echristley
OH! Happy Day!

I got control of the spindle. I ran the communication wire through a ferrite speed a couple times, and everything worked perfectly. Even the error counts went away.

I can start, stop, and change the speed by setting registers in Halshow interface. Now I just need to figure out how to put these nets together to get the VFD, halui, and my mechanical controls to all work together.

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

Time to create page: 0.086 seconds
Powered by Kunena Forum