This is a userspace HAL program for the GS2 series of VFD’s at Automation Direct.

This component is loaded using the halcmd "loadusr" command:

loadusr -Wn spindle-vfd gs2_vfd -n spindle-vfd +
(loadusr, wait for named to load, component gs2_vfd, named spindle-vfd)

The command-line options are:

  • -b or --bits <n> (default 8) Set number of data bits to <n>, where n must be from 5 to 8 inclusive

  • -d or --device <path> (default /dev/ttyS0) Set the name of the serial device node to use

  • -g or --debug Turn on debugging messages. This will also set the verbose flag. Debug mode will cause all modbus messages to be printed in hex on the terminal.

  • -n or --name <string> (default gs2_vfd) Set the name of the HAL module. The HAL comp name will be set to <string>, and all pin and parameter names will begin with <string>.

  • -p or --parity {even,odd,none} (default odd) Set serial parity to even, odd, or none.

  • -r or --rate <n> (default 38400) Set baud rate to <n>. It is an error if the rate is not one of the following: 110, 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200

  • -s or --stopbits {1,2} (default 1) Set serial stop bits to 1 or 2

  • -t or --target <n> (default 1) Set MODBUS target (slave) number. This must match the device number you set on the GS2.

  • -v or --verbose Turn on debug messages. Note that if there are serial errors, this may become annoying. At the moment, it doesn’t make much difference most of the time.

Pins where <name> is the name given during loading with the -n option.

  • <name>.DC-bus-volts (float, out) The DC bus voltage of the VFD

  • <name>.at-speed (bit, out) when drive is at commanded speed

  • <name>.err-reset (bit, in) reset errors sent to VFD

  • <name>.firmware-revision (s32, out) from the VFD

  • <name>.frequency-command (float, out) from the VFD

  • <name>.frequency-out (float, out) from the VFD

  • <name>.is-stopped (bit, out) when the VFD reports 0 Hz output

  • <name>.load-percentage (float, out) from the VFD

  • <name>.motor-RPM (float, out) from the VFD

  • <name>.output-current (float, out) from the VFD

  • <name>.output-voltage (float, out) from the VFD

  • <name>.power-factor (float, out) from the VFD

  • <name>.scale-frequency (float, out) from the VFD

  • <name>.speed-command (float, in) speed sent to VFD in RPM
    It is an error to send a speed faster than the Motor Max RPM as set in the VFD

  • <name>.spindle-fwd (bit, in) 1 for FWD and 0 for REV sent to VFD

  • <name>.spindle-rev (bit, in) 1 for REV and 0 if off

  • <name>.spindle-on (bit, in) 1 for ON and 0 for OFF sent to VFD

  • <name>.status-1 (s32, out) Drive Status of the VFD (see the GS2 manual)

  • <name>.status-2 (s32, out) Drive Status of the VFD (see the GS2 manual)
    Note that the value is a sum of all the bits that are on. So a 163 which means
    the drive is in the run mode is the sum of 3 (run) + 32 (freq set by serial)
    + 128 (operation set by serial).

Parameters where <name> is the name given during loading with the -n option.

  • <name>.error-count (s32, RW)

  • <name>.loop-time (float, RW) how often the modbus is polled (default 0.1)

  • <name>.nameplate-HZ (float, RW) Nameplate Hz of motor (default 60)

  • <name>.nameplate-RPM (float, RW) Nameplate RPM of motor (default 1730)

  • <name>.retval (s32, RW) the return value of an error in HAL

  • <name>.tolerance (s32, RW) speed tolerance (default 0.01)

An example of using this component to drive a spindle is in the Hardware Examples section of this manual.