587,793 active members*
3,714 visitors online*
Register for free
Login
Results 1 to 8 of 8
  1. #1
    Join Date
    Jul 2008
    Posts
    35

    EMC2 Configuration

    I successfully converted my turnkey IHCNC mill to use EMC2 running on Linux. Unless I am mistaken, the mill runs smoother now (axis movements are quieter), and the computer it is running on is nothing to brag about. I commandeered the PC that came with the mill to use as my CAD/CAM/EAD/web surfboard/... machine (now multibooting Linux and XP) and I pushed an older machine out into the workshop. I couldn't be happier. I love Linux!!!

    Anyhow, it took me a while to get EMC2 configured, so I'm sharing my configuration files in this post in the offhand chance someone else would like to try out Linux to control their mill. Look in the attached files for information regarding my mill and control PC.

    I just got things working this weekend, so I haven't spent much time with the mill since moving over to Linux, but I'm confident that the configuration files are accurate...maybe not so confident about the low end PC that's controlling the mill, but I haven't had any problems yet...

    Be nice, I'm just trying to share (I get a lot of slack about being a Linux enthusiast...).

    Here's the config file text for those that just want to peek...
    **************************************************
    IndustrialHobbies.ini
    **************************************************
    # IndustrialHobbies 4 Axis Turnkey Mill with VFD
    # Model: 7045FG, SN: 1300, DOM: 11/23/2008
    # Linux 2.6.32-122-rtai Ubuntu 10.04 (linuxcnc.org)
    # Shuttle XPC SK43G
    # AMD Sempron 2800+ (2GHz)
    # 512 Mb shared with video, 434 Mb available

    [EMC]
    MACHINE = IndustrialHobbies
    DEBUG = 0

    [DISPLAY]
    DISPLAY = axis
    EDITOR = gnome-terminal -e vim
    POSITION_OFFSET = RELATIVE
    POSITION_FEEDBACK = ACTUAL
    MAX_FEED_OVERRIDE = 1.5
    INTRO_GRAPHIC = emc2.gif
    INTRO_TIME = 2
    PROGRAM_PREFIX = /home/robertb/emc2/nc_files
    INCREMENTS = .1in .05in .01in .005in .001in .0005in .0001in

    [FILTER]
    PROGRAM_EXTENSION = .png,.gif,.jpg Greyscale Depth Image
    PROGRAM_EXTENSION = .py Python Script
    png = image-to-gcode
    gif = image-to-gcode
    jpg = image-to-gcode
    py = python

    [TASK]
    TASK = milltask
    CYCLE_TIME = 0.010

    [RS274NGC]
    PARAMETER_FILE = emc.var

    [EMCMOT]
    EMCMOT = motmod
    COMM_TIMEOUT = 1.0
    COMM_WAIT = 0.010
    BASE_PERIOD = 27777
    SERVO_PERIOD = 1000000

    [HAL]
    HALFILE = IndustrialHobbies.hal
    HALFILE = custom.hal
    POSTGUI_HALFILE = custom_postgui.hal

    [TRAJ]
    AXES = 4
    COORDINATES = X Y Z A
    MAX_ANGULAR_VELOCITY = 100.00
    DEFAULT_ANGULAR_VELOCITY = 10.00
    LINEAR_UNITS = inch
    ANGULAR_UNITS = degree
    CYCLE_TIME = 0.010
    DEFAULT_VELOCITY = 0.18
    MAX_LINEAR_VELOCITY = 1.80
    NO_FORCE_HOMING = 1

    [EMCIO]
    EMCIO = io
    CYCLE_TIME = 0.100
    TOOL_TABLE = tool.tbl

    [AXIS_0]
    TYPE = LINEAR
    HOME = 16.0
    MAX_VELOCITY = 1.71004788134
    MAX_ACCELERATION = 15.0
    STEPGEN_MAXACCEL = 18.75
    SCALE = 20000.0
    FERROR = 0.05
    MIN_FERROR = 0.01
    MIN_LIMIT = -0.01
    MAX_LIMIT = 31.0
    HOME_OFFSET = 0.000000
    HOME_SEARCH_VEL = 0.050000
    HOME_LATCH_VEL = 0.025000
    HOME_IGNORE_LIMITS = YES
    HOME_SEQUENCE = 1

    [AXIS_1]
    TYPE = LINEAR
    HOME = 6.0
    MAX_VELOCITY = 1.71004788134
    MAX_ACCELERATION = 15.0
    STEPGEN_MAXACCEL = 18.75
    SCALE = 20000.0
    FERROR = 0.05
    MIN_FERROR = 0.01
    MIN_LIMIT = -0.01
    MAX_LIMIT = 12.0
    HOME_OFFSET = 0.000000
    HOME_SEARCH_VEL = 0.050000
    HOME_LATCH_VEL = 0.025000
    HOME_IGNORE_LIMITS = YES
    HOME_SEQUENCE = 2

    [AXIS_2]
    TYPE = LINEAR
    HOME = 10.0
    MAX_VELOCITY = 1.7
    MAX_ACCELERATION = 15.0
    STEPGEN_MAXACCEL = 18.75
    SCALE = 20000.0
    FERROR = 0.05
    MIN_FERROR = 0.01
    MIN_LIMIT = 0.0

    *************************************
    IndustrialHobbies.hal
    *************************************
    ################################################## #
    # IndustrialHobbies 4 Axis Turnkey Mill with VFD
    # Model: 7045FG, SN: 1300, DOM: 11/23/2008
    #================================================= =
    # Linux 2.6.32-122-rtai Ubuntu 10.04 (linuxcnc.org)
    # Shuttle XPC SK43G
    # AMD Sempron 2800+ (2GHz)
    # 512 Mb shared with video, 434 Mb available
    ################################################## #

    loadrt trivkins
    loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
    loadrt probe_parport
    loadrt hal_parport cfg="0x378 out "

    setp parport.0.reset-time 3500

    loadrt stepgen step_type=0,0,0,0,0 ctrl_type=p,p,p,p,v

    addf parport.0.read base-thread
    addf stepgen.make-pulses base-thread
    addf parport.0.write base-thread
    addf parport.0.reset base-thread

    addf stepgen.capture-position servo-thread
    addf motion-command-handler servo-thread
    addf motion-controller servo-thread
    addf stepgen.update-freq servo-thread

    ################################################## #
    # Output pin assignments
    ################################################## #
    setp parport.0.pin-01-out-invert 1
    net coolant-flood => parport.0.pin-01-out
    net xstep => parport.0.pin-02-out
    setp parport.0.pin-02-out-reset 1
    net xdir => parport.0.pin-03-out
    setp parport.0.pin-03-out-invert 1
    net ystep => parport.0.pin-04-out
    setp parport.0.pin-04-out-reset 1
    net ydir => parport.0.pin-05-out
    setp parport.0.pin-05-out-invert 1
    net zstep => parport.0.pin-06-out
    setp parport.0.pin-06-out-reset 1
    net zdir => parport.0.pin-07-out
    setp parport.0.pin-07-out-invert 1
    net spindle-cw => parport.0.pin-08-out
    setp parport.0.pin-08-out-invert 1
    net spindle-out => parport.0.pin-09-out
    setp parport.0.pin-16-out-invert 1
    net adir => parport.0.pin-16-out
    setp parport.0.pin-17-out-invert 1
    net astep => parport.0.pin-17-out
    setp parport.0.pin-17-out-reset 1

    ################################################## #
    # Input pin assignments
    ################################################## #
    net min-home-x <= parport.0.pin-10-in
    net min-home-y <= parport.0.pin-11-in
    net max-home-z <= parport.0.pin-12-in
    net shared-limits <= parport.0.pin-13-in
    net estop-ext <= parport.0.pin-15-in

    ################################################## #
    # Flood control
    ################################################## #
    net coolant-flood <= iocontrol.0.coolant-flood

    ################################################## #
    # X-Axis
    # Gecko G320 controller
    ################################################## #
    setp stepgen.0.position-scale [AXIS_0]SCALE
    setp stepgen.0.steplen 1
    setp stepgen.0.stepspace 0
    setp stepgen.0.dirhold 16700
    setp stepgen.0.dirsetup 16700
    setp stepgen.0.maxaccel [AXIS_0]STEPGEN_MAXACCEL
    net xpos-cmd axis.0.motor-pos-cmd => stepgen.0.position-cmd
    net xpos-fb stepgen.0.position-fb => axis.0.motor-pos-fb
    net xstep <= stepgen.0.step
    net xdir <= stepgen.0.dir
    net xenable axis.0.amp-enable-out => stepgen.0.enable
    net min-home-x => axis.0.home-sw-in
    net min-home-x => axis.0.neg-lim-sw-in
    net shared-limits => axis.0.pos-lim-sw-in

    ################################################## #
    # Y-Axis
    # Gecko G320 controller
    ################################################## #
    setp stepgen.1.position-scale [AXIS_1]SCALE
    setp stepgen.1.steplen 1
    setp stepgen.1.stepspace 0
    setp stepgen.1.dirhold 16700
    setp stepgen.1.dirsetup 16700
    setp stepgen.1.maxaccel [AXIS_1]STEPGEN_MAXACCEL
    net ypos-cmd axis.1.motor-pos-cmd => stepgen.1.position-cmd
    net ypos-fb stepgen.1.position-fb => axis.1.motor-pos-fb
    net ystep <= stepgen.1.step
    net ydir <= stepgen.1.dir
    net yenable axis.1.amp-enable-out => stepgen.1.enable
    net min-home-y => axis.1.home-sw-in
    net min-home-y => axis.1.neg-lim-sw-in
    net shared-limits => axis.1.pos-lim-sw-in

    ################################################## #
    # Z-Axis Vertical
    # Gecko G320 controller
    ################################################## #
    setp stepgen.2.position-scale [AXIS_2]SCALE
    setp stepgen.2.steplen 1
    setp stepgen.2.stepspace 0
    setp stepgen.2.dirhold 16700
    setp stepgen.2.dirsetup 16700
    setp stepgen.2.maxaccel [AXIS_2]STEPGEN_MAXACCEL
    net zpos-cmd axis.2.motor-pos-cmd => stepgen.2.position-cmd
    net zpos-fb stepgen.2.position-fb => axis.2.motor-pos-fb
    net zstep <= stepgen.2.step
    net zdir <= stepgen.2.dir
    net zenable axis.2.amp-enable-out => stepgen.2.enable
    net max-home-z => axis.2.home-sw-in
    net max-home-z => axis.2.pos-lim-sw-in
    net shared-limits => axis.2.neg-lim-sw-in

    ################################################## #
    # A-Axis Rotary Table
    # Gecko G210 controller
    ################################################## #
    setp stepgen.3.position-scale [AXIS_3]SCALE
    setp stepgen.3.steplen 1
    setp stepgen.3.stepspace 0
    setp stepgen.3.dirhold 36500
    setp stepgen.3.dirsetup 17500
    setp stepgen.3.maxaccel [AXIS_3]STEPGEN_MAXACCEL
    net apos-cmd axis.3.motor-pos-cmd => stepgen.3.position-cmd
    net apos-fb stepgen.3.position-fb => axis.3.motor-pos-fb
    net astep <= stepgen.3.step
    net adir <= stepgen.3.dir
    net aenable axis.3.amp-enable-out => stepgen.3.enable

    ################################################## #
    # Spindle cnc4pc C6 Variable Speed Controller
    ################################################## #
    loadrt scale count=1
    setp scale.0.in 0
    setp scale.0.gain 0.86
    addf scale.0 servo-thread

    setp stepgen.4.position-scale [SPINDLE]SCALE
    setp stepgen.4.maxvel [SPINDLE]MAX_VELOCITY
    setp stepgen.4.steplen 1
    setp stepgen.4.stepspace 0
    setp stepgen.4.dirhold 20000
    setp stepgen.4.dirsetup 20000
    setp stepgen.4.maxaccel [SPINDLE]STEPGEN_MAXACCEL
    net spindle-enable <= motion.spindle-on => stepgen.4.enable
    net spindle-cmd motion.spindle-speed-out => scale.0.in
    net spindle-freq <= scale.0.out => stepgen.4.velocity-cmd
    net spindle-out <= stepgen.4.step
    net spindle-cw <= stepgen.4.dir

    ################################################## #
    # Emergency Stop
    ################################################## #
    net estop-ext => iocontrol.0.emc-enable-in

    ################################################## #
    # Tools
    ################################################## #
    loadusr -W hal_manualtoolchange
    net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change
    net tool-changed iocontrol.0.tool-changed <= hal_manualtoolchange.changed
    net tool-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number
    net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared
    Attached Files Attached Files

  2. #2
    Join Date
    Jun 2005
    Posts
    1015
    i love this idea. i have been toying with an emc conversion for a while. i haven't had to time to navigate through their stuff, but from everything i've read it seems like the way to go. i'm used to running pro cncs, so we don't have alot of the graphical features mach has anyway.

  3. #3
    Join Date
    Jul 2008
    Posts
    35
    linuxcnc.org has a live CD iso image that you can burn to disk (if you have a cd/dvd burner) and then boot your computer from CD without having to install. You can look around at the software, and you should run the latency test to determine if your computer is capable of running the software to control the mill (available from the drop down CNC menu at the top). I did, and my first computer couldn't do it, but my second worked fine. You won't be able to actually control the mill until you install and then setup a configuration file, and that is the hardest part, but I've already done that for you!!! Couldn't be easier.

    If you're not familiar with Linux and multi-booting, there are plenty of websites that provide instructions for doing that, so you can install Linux without removing your windows installation. The linuxcnc solution uses Ubuntu's Linux distribution, and ubuntu feels something like MS Windows, so that's good for people who like that OS. I hate ubuntu's look and feel, but that's because I don't like Windows, and I have been running Linux since 1995 so I don't need it to feel like Windows (although I have extensive experience with Windows too). But I only use ubuntu for EMC, so it works great in that regard.

    Although the software looks spartan, it's all there as far as I have yet been able to determine. Even has wizards, although I haven't played around with them yet. I like spartan, as long as all of the features are there, and they all appear to be there... Besides, Artsoft hasn't bothered to release a Linux version of Mach3, and I try to avoid Microsoft.

  4. #4
    Join Date
    Jan 2012
    Posts
    57
    Many thanks for posting the EMC2 config! I've been running linux since the late 90s and use it for darn near everything. Im thrilled that EMC can be used in place of Mach3 here. I've got one of these mills on the way and searched around to see if anyone had gotten it running on EMC2 but did not see anything until I came across this.

    If you don't mind me asking, what CAM package are you using, and have you been able to get it running under linux?

    thanks in advance

  5. #5
    Join Date
    Jul 2008
    Posts
    35

    HEADS UP!!!

    The config file I provided has a problem with the homing configuration. No biggy, but EMC wants the homing velocity to also specify the direction. So, in the .ini configuration file, the HOME_SEARCH_VEL needs to be negative for the x and y axis because the home switches have been specified as sharing the negative limit switches for those axises (in mach3 and in my emc configuration files too).

    I am playing around with the mill today, just started working with homing the machine when I discovered the discrepancy (EMC moved the wrong way to search out the home switch). Silly that EMC can't figure out which way to go without being told, but there you have it.

    I will post new configuration files tomorrow, after I work through any other unforeseen issues and cut my first part.

    Sorry, but I use Windows for CAD/CAM, I haven't found much in the way of CAD/CAM on linux, yet...

  6. #6
    Join Date
    Jul 2008
    Posts
    35

    Latest emc configuration files

    I successfully cut my first part today using emc2. I discovered a few items that I incorporated into the emc configuration files attached to this message. Do not use the earlier configuration files (in post #1) as they have the HOME_SEARCH_VELOCITY set wrong (they are 'positive', but they should be 'negative' for x and y to reflect the direction the table needs to move towards the home switches). The attached files have been corrected.

    Things to consider:
    Rename the files by removing the '.txt' and then change the '_' to a '.'. The filenames are mangled to allow uploading to the forum.

    You can play with max velocities and max accelerations in IndustrialHobbies.ini. Pin assignments and polarities are in IndustrialHobbies.hal. I set them to 'reasonable' values according to my experimentation, but they can, and I suspect should, be tweaked to your preferences/experience/machine specifics.

    I enabled support for preserving axis locations on shutdown and loading on startup by adding a line to the ini file that stores the data in 'positions.txt' which will be located in the emc2/configs/IndustrialHobbies directory (where you will probably put IndustrialHobbies.hal and IndustrialHobbies.ini assuming you call your emc configuration 'IndustrialHobbies'). You can edit that file to reflect your machine's actual position when emc2 is not running, and that is the only way to manually set machine coordinates without actually running the homing sequence which uses the limit switches. By adding support for saving the axis position on shutdown, and loading on startup, I am able to use simple g-code at startup, but keep in mind that if you move the axes during shutdown, emc2 will not have a proper notion of the machine's position on start up.

    The travel is configured to be (30", 12", 17.5"), yours may be different: edit the ini file to reflect your configuration. Homing is configured to occur at 0, 0, 17.5 (spindle at top of column positioned over left/front of table), and I configured the machine to move to 15, 6, 10 (middle) after the homing sequence (called 'home' in the ini file), you can adjust that to your preference as well.

    emc2 recommends that you home the machine, and the default configuration is to force you to home the machine every time that you start emc2 before you can do anything else. I added a line to the ini file to disable that feature. I still home my machine, but I like to be able to jog over close to the home switches using g-code to shorten the time required for homing. Disabling forced homing allows me to do that, but it is not the default behavior. If you would rather do it the default way, you can remove the 'NO_FORCE_HOMING = 1' line from the ini file to enable the default behavior.
    Attached Files Attached Files

  7. #7
    Thanks for posting this -- I'm still waiting on a working Mach3 license from IH so I might end up going the EMC2 route instead.

    About the auto-homing at start -- do you have any sort of one-shot lube system? I figured part of the going-to-home startup was a chance to pre-lube everything as part of warming up the box.

  8. #8
    Join Date
    Jul 2008
    Posts
    35

    One shot lube.

    The homing is not quite automatic: emc2 forces you to press the home button in the dialog before you can do anything else. By the way, the emc2 dialog is actually the 'Axis' GUI that interfaces to emc2, but I'll probably just keep calling it emc2...

    Yes, I do have a one-shot, and it is a good opportunity to lube the machine, but my needs may be a little different than yours. I am a hobbyist, so I don't leave my machine running very much. I often, during any given day, start the machine up and turn it off multiple times, and I don't need to lube it every time, just once a day or so. However, I have found that by leaving emc2 running, even after I shut off the mill, I am not forced to re-home, and that may be a good way to handle the forced homing 'issue'.

    Personally, I prefer to home each axis individually at my own leisure, when I feel motivated to do so, not when the software 'automatically' determines that I need to do so. But I'm an ass, you may be more agreeable...

Similar Threads

  1. EMC2 Configuration File for G540
    By CoAMarcus in forum LinuxCNC (formerly EMC2)
    Replies: 8
    Last Post: 06-05-2013, 08:55 PM
  2. HELP!!! Sherline/Ubuntu 6.06/EMC2 - Configuration
    By Telle in forum Benchtop Machines
    Replies: 16
    Last Post: 06-23-2012, 06:58 AM
  3. EMC2 configuration
    By acondit in forum LinuxCNC (formerly EMC2)
    Replies: 6
    Last Post: 03-11-2012, 06:36 AM
  4. EMC2 and X axis configuration with 2 sevro's
    By BWay in forum LinuxCNC (formerly EMC2)
    Replies: 2
    Last Post: 11-28-2010, 03:12 PM
  5. Replies: 1
    Last Post: 07-12-2010, 01:45 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •