- 1. About this page
2. User Contributed Components
- 1.1. Purpose
- 1.2. How to add your component
- 1.3. How to compile and install a component
- 1.4. Legal
- 2.1. Realtime Components
2.2. Userspace Components
- 2.1.1. Hardware Drivers
- 22.214.171.124. EtherCAT Digital I/O
- 126.96.36.199. CandCNC UBOB breakout board drivers and sample config
- 188.8.131.52. Mesa 7i32 micro-stepping motor driver
- 184.108.40.206. Boxford Lathe ATC toolchanger component
- 220.127.116.11. Denford Orac Lathe ATC toolchanger component
- 18.104.22.168. Emco Turn 120 / Compact 6 Lathe ATC toolchanger component
2.1.3. Other Components
- 22.214.171.124. millkins -- trivial kinematics extended by XY skew correction
- 126.96.36.199. XYZACkins -- 5-axis kinematics for a milling machine
- 188.8.131.52. linear8 -- Piecewise Linear interpolation with up to 8 data points
- 184.108.40.206. PRBS (Pseudo-Random Binary Sequence) signal generator
- 220.127.116.11. idb -- Inverse Deadband
- 18.104.22.168. toggle2nist -- Toggle button to nist logic
- 22.214.171.124. modmath -- Modmath functions, only mod_dir so far
- 126.96.36.199. enshu -- enshu toolchanger component
- 2.2.1. Userspace Hardware Drivers
2.2.2. Other Userspace Components
- 188.8.131.52. Arduino: ADC, PWM, and digital I/O
- 184.108.40.206. USB HID device interface - hidcomp
- 220.127.116.11. Toshiba VF-S11 VFD driver - vfs11_vfd
- 18.104.22.168. Generic component with support for multiple clients, Michael Haberler flavor
- 22.214.171.124. Generic component with support for multiple clients, Les Newell flavor
- 126.96.36.199. Altivar ATV71 VFD driver - atv
- 188.8.131.52. USB thermometer Microdia TEMPer1V1.2
- 184.108.40.206. Latching Shift Register I/O as a Port Expander
- 220.127.116.11. Motherboard Sensors
- 18.104.22.168. Parameter Saver
- 2.3.1. Ladder Logic
- 2.3.2. Virtual Control Panel (pyvcp and halvcp)
1. About this page
This page is a place for users to contribute HAL components and other EMC2/HAL-related information in the hope that they will be useful to others.
See also: ContributedHalFiles
1.2. How to add your component
Follow the BasicSteps
so that you can edit the wiki. Use the "Upload" link at the top of this page to upload your component as a .c, .py, .comp, or .tar.gz file. Then add a new section to this page with a short description of your component and a link to the file you uploaded.
1.3. How to compile and install a component
First, install the emc2-dev
(sudo apt-get install emc2-dev) and build-essential
packages (sudo apt-get install build-essential). If the component does not provide specific installation instructions, then try these general instructions:
- If a file called 'Makefile' is included:
- make && sudo make install
- Userspace component ending in .py:
- chmod 755 component.py && sudo cp component.py /usr/local/bin/component
- Userspace component ending in .comp or .c:
- sudo comp --install --userspace component.comp
- Realtime component ending in .comp or .c:
- sudo comp --install component.comp
Clearly label each submission with its license. Submissions hosted on linuxcnc.org must be as free or freer than emc2. This means approximately that they have a license accepted under the [Debian Free Software Guidelines]
. GPL and LGPL are two examples of permitted licenses. "Free For Noncommercial Use" is an example of a non-permitted license.
- For all types of file, include the standard license block indicated by the license being used.
- For ".c" components, also specify MODULE_LICENSE("...");.
- For ".comp" components compatible with EMC2.1 and later, also specify MODULE_LICENSE("...");.
- For ".comp" components compatible with EMC2.2 and later, also specify license "...";
2. User Contributed Components
2.1. Realtime Components
2.1.1. Hardware Drivers
22.214.171.124. EtherCAT? Digital I/O
This component uses the IGH [EtherCAT Master library] to talk to a EtherCAT? connected [DigIO Terminal]. A Description can be found in this wiki at etherlab
126.96.36.199. CandCNC? UBOB breakout board drivers and sample config
There are two components in this file and a sample config for using the [CandCNC] UBOB breakout board. The config is currently missing some important features such as using the external E-stop signal, but will show the basics needed to set up these breakout boards. The components drive the multiplexed inputs and the serialized outputs.
188.8.131.52. Mesa 7i32 micro-stepping motor driver
Component to convert step and direction signals from a step generator to current intensity for a dac that drives the 7i32 hardware.
currently does 1/2 and 1/8 micro stepping
Possible to compensate for angular error by changing the intensity ramp data
I haven't used this to move anything important -it is experimental- improve it!
Chris Morley c/o firstname.lastname@example.org
184.108.40.206. Boxford Lathe ATC toolchanger component
Component controls 8 station ATC fitted to Boxford 240, 160 and 125
Works on degrees of movement, with ATC defined as rotary axis, so does not require index sensors.
Should be able to be adapted for any lathe using a 'rotate past pawl and reverse to lock' methodology.
Amount of rotation configurable for fine tuning, see README and notes in .comp file for details
220.127.116.11. Denford Orac Lathe ATC toolchanger component
Component controls 8 station ATC fitted to Orac lathe
Reads greyscale optical disc and compares to 3 sensor truth table to determine tool position
See header of comp file for full details and specimen hal file linkage
18.104.22.168. Emco Turn 120 / Compact 6 Lathe ATC toolchanger component
Component controls 8 station ATC fitted to Emco lathe
Reads greyscale optical disc and compares to 4 sensor truth table to determine tool position
Sample .hal file and connection pinout in file also
22.214.171.124. millkins -- trivial kinematics extended by XY skew correction
Info from a recent IRC discussion
compile & install millkins.c as per instructions at top of page
change 'loadrt trivkins' to 'loadrt millkins' in hal file
add a 'setp millkins.skew #.###' to set the amount of correction to apply
'#.### is unitless and derived from mm/mm of skew or in/in of skew
126.96.36.199. XYZACkins -- 5-axis kinematics for a milling machine
Two rotary joints have been added: A around x-axis and C around z-axis. They may have offsets Y-offset and Z-offset.
A vismach gui called XYZACgui is included to show actual machine movements. A sample Gcode file is included.
See README file for instructions to install and run a simulation of the Flange.ngc file
2.1.3. Other Components
188.8.131.52. linear8 -- Piecewise Linear interpolation with up to 8 data points
This component is useful for obtaining a closer relationship between S- speed commands and spindle speed when the spindle's response to a PWM input is nonlinear.
184.108.40.206. PRBS (Pseudo-Random Binary Sequence) signal generator
upload:prbs-fixed.c (the original above lacked a call to hal_ready()).
prbs.c is an HAL module for generating the PRBS (Pseudo-Random Binary Sequence)
signal. This signal is basically used as an excitation signal at the reference
input. PRBS is used because of its rich frequency spectrum. This "prbs.c" is
based on the algorithm provided in the following book,
Landau, Digital Control Systems,
It has been used to identify to the axial dynamics in closed loop ( the book
site provide the tools). With the model, it is possible to design advanced controllers rather
than PID controllers for the axial servo drive. Thus, the positioning
and tracking accuracy of the servo drive can be improved, the final
accuracy of the parts can also be improved. But much work needs to be
220.127.116.11. idb -- Inverse Deadband
Useful for torque-mode servo amplifiers that don't respond to DAC output in some interval around zero.
18.104.22.168. toggle2nist -- Toggle button to nist logic
useful for setting things like coolant from a momentary-on pushbutton.
22.214.171.124. modmath -- Modmath functions, only mod_dir so far
Useful for tool changers, especially carousels that wrap, such as when the last tool wraps to tool one, or tool one to the last.
In .hal use:
loadrt modmath mod_dir=N
addf mod-dir.0 servo-thread
addf mod-dir.N servo-thread
This will create these pins:
halcmd show pin mod-dir
Owner Type Dir Value Name
8 s32 IN 0 mod-dir.0.actual
8 s32 IN 0 mod-dir.0.desired
8 bit OUT FALSE mod-dir.0.down
8 s32 I/O 15 mod-dir.0.max-num
8 s32 I/O 0 mod-dir.0.min-num
8 bit OUT TRUE mod-dir.0.on-target
8 bit OUT FALSE mod-dir.0.up
8 bit I/O TRUE mod-dir.0.wrap
"up", "down", and "on_target" are bit outputs that tell whether to go up, down, or nowhere. Exactly one of those will be "1" at any time.
"actual" and "desired" are integer inputs that tell where the carousel is and where you want it, respectively.
"max" and "min" are the highest and lowest tool slot numbers. Note that tool numbers actually start with 1, so you may need to fiddle with the desired/actual values and/or the requested slot output to the tool changer) to get the tool you really want.
"wrap" is a bit input which you probably want to set true, if the changer is a carousel. If set true, then it's assumed that max is next to min and you can get from min to max by going "back" one and wrapping around.
(modmath end KW 2010/03/10)
126.96.36.199. enshu -- enshu toolchanger component
2.2. Userspace Components
2.2.1. Userspace Hardware Drivers
188.8.131.52. Arduino: ADC, PWM, and digital I/O
"Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software". The Arduino diecimila board offers 6 ADC channels, 6 PWM channels, and 6 digital I/O channels. 'arduino' is a HAL driver and associated firmware for this device.
See http://axis.unpy.net/01198594294 for more information and to download the driver.
184.108.40.206. USB HID device interface - hidcomp
hidcomp provides an interface to USB HID (Human Interface Device) devices. This includes joysticks, games pads, multimedia controlers, etc. A GUI program is used locate, test and configure the devices.
See http://www.franksworkshop.com.au/EMC/hidcomp/hidcomp.htm for more information and to download the applications.
220.127.116.11. Toshiba VF-S11 VFD driver - vfs11_vfd
vfs11_vfd controls an VF-S11 through a serial Modbus connection. See the man page at http://mah.priv.at/src/vfs11_vfd/vfs11_vfd.html
The VF-S11 doesnt have a standard RS-232 port - here is a little converter to connect a VF-S11 to an RS-232 port [upload:vfs11-rs232.pdf], based on a note from Toshiba support: [upload:VFS11-RJ45_e.pdf]
The current stable version can be found at http://git.mah.priv.at/gitweb/vfs11-vfd.git .
I also wrote a utility to explore Modbus clients, which helped to write the vfs11-vfd driver. It is available at: http://git.mah.priv.at/gitweb/modio.git
Update: vfs11_vfd is now integrated into master. see src/hal/user_comps/vfs11_vfd .
18.104.22.168. Generic component with support for multiple clients, Michael Haberler flavor
This is an starting point for folks who would want a modbus driver for multiple identical modbus clients (in this case, modbus-capable servo amplififers):
22.214.171.124. Generic component with support for multiple clients, Les Newell flavor
This driver <http://www.shootspammers.org.uk/modbus.zip> I wrote some
time back will work with multiple modbus clients. They can be different
or identical. You can even use multiple ports. All parameters are
configured via an ini file.
126.96.36.199. Altivar ATV71 VFD driver - atv
This is a Modbus driver for An Altivar ATV71 VFD contributed by Martin Kaplan.
See http://git.mah.priv.at/gitweb/emc2-dev.git/shortlog/refs/heads/altivar-vfd-comp .
188.8.131.52. USB thermometer Microdia TEMPer1V1.2
This is HAL component for USB thermometer Microdia TEMPer1V1.2
184.108.40.206. Latching Shift Register I/O as a Port Expander
This HAL component drives 74LS595 and 74LS597 latching shift registers (or equivalent) for a cheap and easy way to add I/O lines to your port. The shift registers can be daisy-chained together to provide pins in multiples of 8. As currently configured, the component will create 16 input and 16 output lines, requiring only 3 output and 1 input pin on your existing port.
For a complete write-up, see http://www.shafferhouse.org/linuxcnc/LinuxCNCShiftRegisters.pdf
2.2.2. Other Userspace Components
220.127.116.11. Motherboard Sensors
This is a python component that will extract all the sensor readings for the motherboard/CPU/fan and make them available as HAL pin values. These Temperature, RPM, Voltage readings can then be displayed in a pyVCP, or used in any other interesting manor. When the script starts up, it will parse and create the various output pin values on the fly based on what it finds in the output from the 'sensors' command.
18.104.22.168. Parameter Saver
This userspace component will generate unlimited pairs of IN pins and OUT pins of each, of types float, s32 and bit.
The OUT pins can be overwritten by reading from a file, enabling components or widgets attached to those pins
to be initialised to known or saved values.
The IN pins can be connected to any suitable component pin or widget pin
The values received at the IN pins can be saved to file making settings persistent between shutdowns.
This comes into its own if you use my amended pyvcp_widgets
Then you can link say the hal-pin of a spinbox to paramsaver.invalueF-00 and the new param-pin of the spinbox to paramsaver.outvalueF-00
Set paramsaver.writetrigger to true and create a file
Set paramsaver.readtrigger to true and the value will be inserted back into the spinbox.
loadusr -W paramsaver f=NN s=NN b=NN filename=xxxxxxx onstart=0/1 onexit=0/1
See man page (paramsaver.9) in zip for full details
2.3.1. Ladder Logic
Upload a screenshot of the ladder logic rung(s) and an explanation of the inputs and outputs. and add the .clp file
also see: ClassicLadderExamples
for other examples
2.3.2. Virtual Control Panel (pyvcp and halvcp)
A testpanel and script for the m5i20 using hostmot4 driver.