1. Hey guyz. Welcome to the All New Phlatforum!



    Sign Up and take a look around. There are so many awesome new features.

    The Phlatforum is a place we can all hang out and

    have fun sharing our RC adventures!

  2. Dismiss Notice

ECM Linux mini how to

Discussion in 'EMC' started by tvcasualty, Dec 8, 2008.

  1. tvcasualty

    tvcasualty New Member

    Offline
    Messages:
    637
    Trophy Points:
    0
    EMC2 is a FREE open source CNC program that DOES NOT have a limit on lines of G code.
    The website it can be found on is here: http://www.linuxcnc.org/

    So in reading the title most folk probably already ran for the hills. For you guys with a special PC for your CNC cutting I think this is worth trying out. If your still with me, I've been able to get over most hurdles. Here's how:

    I'm no expert on Linux, or CNC for that matter, but I have learned a few tricks in the past few days.
    I'm not a big fan of windows for data loss reasons, and the ole annual reformat issue that always seems to come up so I've mostly migrated to Linux.
    I particularly like the Ubuntu brand, as it makes things as easy as possible.

    This is relevant because it caused me problems when I tried to use EMC2.
    I've already had Ubuntu installed, so the first issue I ran into was that the Kernel was incorrect. DON'T PANIC!!
    Like most things in Linux this is an easy fix (once you know how). Linux installs multiple Kernels and they can be swapped when you boot up. This is NOT something you normally mess with so it threw me for a loop.

    If you are new to Linux, and you download the EMC LIVE CD, from LinuxCNC.org which is bootable, you should not run into this issue since it will do a fresh install and should install only the RTI Kernel. NOTE: I have now tested this on a Dell Optiplex SX260 Computer and it was flawless. (I have found the EMC RTI Kernel to be lacking for doing other sorts of computing in the past.)

    Part 1 install Linux

    As I use Ubuntu for my primary OS, installing Ubuntu and then EMC2 is very straight forward. If you've ever installed windows, Linux is a cake walk one you get one concept:

    Partition 1 is mounted here: /
    This is you file system. It is where the OS is stored, and where EMC and most other programs are installed. It can not be edited by normal means, and is protected.
    Partition 2 is mounted as SWAP
    This is the swap space for the OS (In windows it's built in to the normal HDD space so as you fill your drive performance decreases)
    Partition 3 is mounted as /home
    This is where your stuff goes. This is where your specific settings are saved and is what keeps things very smooth after a reinstall or upgrade. Files (like photos) and most program options go here as well.

    So given a 100 GB HDD you would want something like:
    20-30GB mounted to (and partitioned as EXT3) "/"
    2-5GB mounted to (and partitioned as SWAP) "SWAP"
    (note: really this partition is not mounted)
    and the remainder as EXT3 to "/home"

    And that is the hardest part...
    So if your still with me and you've gotten that far, and I have found Ubuntu to work "out of the box" for my network / sound / video (btw buy Nvidia) on to step 2...
     
  2. tvcasualty

    tvcasualty New Member

    Offline
    Messages:
    637
    Trophy Points:
    0
    EDIT: If you went with the live CD and just did a clean install, EMC is installed standard as well as the correct kernel. You can move on past this post. If you aleady have a version of Ubuntu installed, please read on.

    Going with the basic installation option (I'd stick with the latest Long Term Support (LTS) version, in this case Ubuntu 8.04) I used the following:
    The restart step is where the Kernel should automatically swap, but it wont if you started with Ubuntu then installed.
    So you need to edit the following file by going to the Terminal and typing this:
    sudo gedit /boot/grub/menu.lst
    It will prompt you for your password
    then change these lines:
    ## hiddenmenu
    # Hides the menu by default (press ESC to see the menu)
    #hiddenmenu <---------- Get rid of the #


    Also look for:
    title Ubuntu 8.04.1, kernel 2.6.24-16-rtai
    root (hd0,0)
    kernel /boot/vmlinuz-2.6.24-16-rtai root=UUID=2c2e3909-4b32-4326-805e-ae0598ca0d58 ro quiet splash
    initrd /boot/initrd.img-2.6.24-16-rtai
    quiet

    That is the Kernel you will need to boot from to get EMC2 to load. Mine happens to be number 5 in the list at the bottom and I can change the default to 4 if I wanted it to auto boot. Close and save, now reboot, select the rtai Kernel from the GRUB menu and wait for Linux to load. This is where I found some options lacking, since my sound and wireless cards now ceased to function. No matter, I wont need them for CNC work, and I can always go back to the top (latest) Kernel to get those functions back.

    Onto step 3....
     
  3. tvcasualty

    tvcasualty New Member

    Offline
    Messages:
    637
    Trophy Points:
    0
    EMC is vastly different from Mach 3 as far as calibration of the axis goes.
    The first step is to setup your hardware options.

    Going to the Stepper Mill Config Wizard you will have the option to make a new configuration, select that option and name your Phlatprinter. (the Default is My~Mill)
    Select the following options, which should be self explanatory.
    Axis = XYZ
    Units = Inches
    Driver = Other
    UPDATE!!!
    (If you want to Double check these numbers go here: http://www.chipcatalog.com/Allegro/A3977SED.htm scroll to bottom and open the PDF datasheet, info on page 8).
    Stepper Time = 1000 (Reference: A3977SED (this is the chip on the Mechatronics Board) Datasheet)
    Stepper Space = 1000 (Reference: A3977SED Datasheet)
    Direction Hold = 200 (Reference: A3977SED Datasheet)
    Direction Setup = 200 (Reference: A3977SED Datasheet)
    Parport Base Address = 0x378 (Default - mrbubbs provides good advice here)
    Latency test result = 25000 (I set this to match what Mach 3 has for the default, as the EMC2 Default was causing the program to dump at random times)
    A better number for your system can be found by running a latency test, consult the EMC manual.
    Uncheck Onscreen prompt for tool change
    Next Page -->
    Pins 2-7 are the only pins used by the Phlatprinter, and should be fine as default (check your stepper board manual), and the rest need to be Unused.
    Next Page -->
    X-Axis
    Motor Steps per revolution: 1600
    Driver Microstepping: 1
    Pully teeth (Motor:Leadscrew): 18:130
    Leadscrew Pitch = 1 divided by the Diameter of the roller times 3.14 = 0.089 (rev/inch)
    Maximum Velocity = 3 in /s (This number seems to represent a ratio, based on the other axis, and test function, you will need to adjust these to find exactly what works best
    )
    Max Acceleration = 30
    Home location = 0
    Table travel = 0 to 45 (I've found giving some negative here works better, give some g-code, so better number is -0.25 to 44.75)
    All other options, are left alone
    Next --->

    Y-Axis
    Motor Steps per revolution: 1600
    Driver Microstepping: 1
    Pully teeth (Motor:Leadscrew): 1:1 (room for improvment here Kram!
    ;))
    Leadscrew Pitch = 20, given 1/4-20 all thread (rev/inch)
    Maximum Velocity = .4 in /s (Again, play with this until you get an acceptable feed rate, it may require jumping back and forth
    )
    Max Acceleration = 8 (this what I set mine to, seems to work just fine
    )
    Home location = 0
    Table travel = 0 to 22 (I've found giving some negative here works better, give some g-code, so better number is -0.25 to 21.75
    )
    All other options, are left alone
    Next --->

    Z-Axis
    Motor Steps per revolution: 1600
    Driver Microstepping: 1
    Pully teeth (Motor:Leadscrew): 1:1
    Leadscrew Pitch = 20, given 1/4-20 all thread (rev/inch)
    Maximum Velocity = 0.3 in /s (I originally had this number 0.1, but my Z was way too slow at ~6 in / min
    )
    Max Acceleration = 8 (this what I set mine to, seems to work just fine
    )
    Home location = 0
    Table travel = 0 to 2 (I've found giving some negative here works better, give some g-code, so better number is -0.125 to 1.875
    )
    All other options, are left alone.
    Next -->
    Leave the spindle alone, and apply.
     
  4. tvcasualty

    tvcasualty New Member

    Offline
    Messages:
    637
    Trophy Points:
    0
    Next select the EMC2 from the application list, and hopefully everything will load.
    The first thing you'll need to do is home your printer.
    So take the machine out of lockout, then turn it on using the two red buttons. (if you have trouble here, you probably did not set your pins to unused)
    The X Y and Z should now be available and you can drive the printer using the arrows and pgup and pgdn keys.
    Drive the printer to where you want your zero, (adjust the jog speed at the bottom) and then click the home axis button for X, Y and Z.
    Load your g code and hit go, you can adjust the feed rate to get to best performance at any time while it's running.

    Now if you've accidentally homed and axis and you need to change it, I found that trying to jog it at the same time you hit home axis un-homes it.

    I'd like to get some pics up of all this to make it easier...
    I am still learning, but this is what I've got so far so so if there is any other advise or comments please ask!
    I've copied all this info over to the phlatforum
     
  5. rcav8r

    rcav8r Moderator Staff Member

    Offline
    Messages:
    1,193
    Trophy Points:
    38
    TV.... THANKS for the tutorial... Finally got Ubuntu installed( had a bad CDROM drive)

    Configured EMC to drive the steppers. I still have a bad Y stepper so I can't cut anything ( so close, yet so far ).
    I did have to change a few things. Not sure why, but I was getting a crash on start, and the debug indicated that it was looking for a tool change ( all unused pins were set to unavailable)
    Here is what I have... Only differences from yours are noted.
    Machine information Screen
    Check "on screen prompt for tool change.

    Parallel Port Setup Screen
    Un-check Include Hal Configuration
    Check Include customer PyVCP panel
    Reverse for Z axis. (not sure if needed, but it's that way in Mach3)

    I'll read through the man pages and see if I am missing anything.

    FWIW, I checked the calibration of the X axis, and at 23" it was spot on.

    THANKS again. I'm sure I'll have 1001 more questions once I get a chance to actually cut something :)
     
  6. JBourdon

    JBourdon New Member

    Offline
    Messages:
    101
    Trophy Points:
    0
    just wanted to let other users know:
    my startech Parallel card for laptop is detected in ubuntu 804 and 810 fine.
    but when I switch to the real time kernel, it is not detected anymore. shame really.
    I wonder if there is a way to load a module in the kernel or something
     
  7. tvcasualty

    tvcasualty New Member

    Offline
    Messages:
    637
    Trophy Points:
    0
    You know there has to be a way, but is way beyond my relm of knowing what I'm doing!
    Sorry about your luck.
     
  8. tvcasualty

    tvcasualty New Member

    Offline
    Messages:
    637
    Trophy Points:
    0
    Well my trusty new powersupply in my pp P C took a dump today.
    Tried to install EMC from the boot CD and it loads fine but the PC is so old that the network does not work... impossible to find support for an old compaq, let alone linux support. Well I either get a new supported nic card or powersupply for the other working PC....

    :/
     
  9. tvcasualty

    tvcasualty New Member

    Offline
    Messages:
    637
    Trophy Points:
    0
    UPDATE on stepper motor tunning!
    Found info for stepper chip here: http://www.chipcatalog.com/Allegro/A3977SED.htm

    Those settings have nothing to do with the actual stepper motors, but the driver instead... that's the board. (But if you are curious, I'm using the stock kit 23LM-C355 MINEBEA steppers from easy-cnc)

    Also found that with a little wax, a ZBN, and tunning the vref DOWN to about 0.60V I was able to get 36 IPM on the Y, that's a 0.6 inch/sec setting in ECM2, with my STOCK 1/4-20 all-thread (that had been cleaned to a shine). I just cut the second boom for my P38 on these settings with no problems / missed steps.

    Updated 3rd step above _____^
     
  10. mrbubbs

    mrbubbs New Member

    Offline
    Messages:
    50
    Trophy Points:
    0
    Location:
    Kalamazoo, Michigan, US
    tvcasualty,
    Hope this helps.

    You can get your parallel port base address in Linux with:

    [pre]dmesg | grep parport

    Mine says:

    parport_pc 00:0a: reported by Plug and Play ACPI
    parport0: PC-style at 0x378, irq 7 [PCSPP,TRISTATE]

    You can also try (if using a Linux 2.2 kernel):

    [pre]cat /proc/parport/0/hardware

    which gives:

    parport0: PC-style at 0x378, irq 7 [PCSPP,TRISTATE,EPP]
    parport0: cpp_mux: aa55f00f52ad51(86)
    parport0: Found 4 daisy-chained devices
    lp0: using parport0 (interrupt-driven).

    If you are using a Linux 2.6 kernel (most likely), you can do:


    cat /proc/sys/dev/parport/parport0/base-addr[/pre]

    which gives:

    888 0

    * Note that 888 in hexadecimal is 0x378.

    * Also note that if dmesg does not show any parport matches, or you cannot cat either of the files listed above, then you probably do not have a parallel port enabled in Linux.

    My kernel config contains these lines, which may be helpful for you:

    CONFIG_PARPORT=y
    CONFIG_PARPORT_PC=y
    CONFIG_PARPORT_PC_FIFO=y
    CONFIG_PARPORT_1284=y
    CONFIG_PNP=y[/pre]

    If that doesn't work, maybe you don't have a parallel port! Hope that helps someone.
    mrbubbs
    RCFC Addict
     
  11. tvcasualty

    tvcasualty New Member

    Offline
    Messages:
    637
    Trophy Points:
    0
    Thanks again, mrbubbs!
     
  12. TigerPilot

    TigerPilot Well-Known Member

    Offline
    Messages:
    1,578
    Trophy Points:
    48
    I wanted to see how EMC looks like so I booted from the CD. I tried first the 8.xx but something doesn't like my video card or what ever and I didn't get the main screen to show up readable. it's like a TV looks like when it is coded, before you connect a descrambler (sp). I then tried 6.xx and it came up fine (go figure).

    I thought I could get the EMC to run without installing but I couldn't figure out how to load it. I thought I'll try to install ubuntu but it asked me for format the drive and I didn't want to do this.

    Any idea why version 8.xx didn't work? How to run EMC without installing ubuntu?
     
  13. Flashsolutions

    Flashsolutions Active Member

    Offline
    Messages:
    1,123
    Trophy Points:
    38
    Location:
    Leesburg, Florida
    Question for you Linux guys..... I have Ubantu installed and have dual boot with Windows XP on the same computer.

    The default boots to Ubantu but I would like to change that to boot up in Windows XP.

    What do I have to do to make this change?
     
  14. gasmasher

    gasmasher New Member

    Offline
    Messages:
    402
    Trophy Points:
    0
    Location:
    Atlanta, GA
    Do you get the screen buffer (big penguin) while it is booting from the CD or is that garbled too? If you can see it then there is probably a problem in the detection of your video card. What card are you using? You can find out the model by running lspci -v from the command line and looking for your card. You could look in /var/log/Xorg.0.log to see if there are any errors starting up X and the settings used to initialize the video card.

    It is possible your monitor was incorrectly detected and the video resolution put out by the card is greater than your monitor can handle. Are you using a KVM by chance?

    I am using the 6.06 version right now but I'm downloading 8.04 now. I'll get it installed and see if I can give you a hand.
     
  15. gasmasher

    gasmasher New Member

    Offline
    Messages:
    402
    Trophy Points:
    0
    Location:
    Atlanta, GA
    I don't know the Ubuntu/Gnome way but you can open /boot/grub/menu.lst in a text editor and look for the 'default' line. It probably has a 0 after it now. Look towards the bottom of the file for all the entries that show up in the menu (they start with title). They are 0 indexed from top to bottom. Just change the 0 after default to the index of the one you want. Grub reads the file at boot time so there isn't anything else needed after that.
     
  16. TigerPilot

    TigerPilot Well-Known Member

    Offline
    Messages:
    1,578
    Trophy Points:
    48
    gasmasher, the video card is really an integrated part of the motherboard, but to answer your question, when I initially boot the version 8.xx I do see the screen clearly and it says 'unbutu' or something like that with a logo before it, It is only when the loading is finished and it is time to have the main screen, when things get weird.

    How do I get the EMC to run without install?
     
  17. tvcasualty

    tvcasualty New Member

    Offline
    Messages:
    637
    Trophy Points:
    0
    Did you dl ECM from their website, or did you just grab a copy of ubuntu?
    **I have not tried it, but if you dl the version from ECM, you should be able to boot from from the CD, w/ the RTI kernel, load up ECM, set your settings for the pp and run the code. (you might even be able to save your settings on some type of disk).

    btw, if it runs on version 6, that's good enough!
     
  18. gasmasher

    gasmasher New Member

    Offline
    Messages:
    402
    Trophy Points:
    0
    Location:
    Atlanta, GA
    My cutting machine is also using an integrated graphics chip. A Via Unichrome Pro if I remember correctly.

    I agree with tvcasualty
    , if 6.xx is running in LiveCD mode then I would just play with that for now. Once it is booted and you get to the desktop there should be a CNC menu when you click on Applications in the top left corner.

    I'm not sure how much experience you have with EMC but the first step will be to run the Stepconf wizard under that menu. After you have a configuration you can start it with the EMC2 item under Applications | CNC. When you first start a configuration it will prompt you to make a shortcut for it on the desktop.
     
  19. TigerPilot

    TigerPilot Well-Known Member

    Offline
    Messages:
    1,578
    Trophy Points:
    48
    Yesseribob that did the trick. Now I'll start playing around with it and see how it works. THANKS
     
  20. TigerPilot

    TigerPilot Well-Known Member

    Offline
    Messages:
    1,578
    Trophy Points:
    48
    My first impression of ubuntu is that I'm not impressed. I didn't go into EMC yet but just running ubuntu is slow like molasses and it even froze on my after just a few minutes. Also, I couldn't open my usb-stick in the EMC g-code file opening window (which is were it finally froze on my). Since I have a computer dedicated to the cnc the speed would not make a difference to me and the fact that I can't open the usb-stick is not a big deal either since I can copy it to a directory on the hard drive, which it does recognize.
     
  21. gasmasher

    gasmasher New Member

    Offline
    Messages:
    402
    Trophy Points:
    0
    Location:
    Atlanta, GA
    A lot of the problems you see are related to the realtime kernel that EMC requires. That is why they package it on a liveCD. I lost my on board network card (Rhine-II VT6102 chipset, known for problems in linux) so I resorted to transferring by USB until I can build up a Slackware install with the realtime patches and EMC2.

    Glad to hear you have it working. Make sure you look at /media/usbdisk in case you haven't already for that usb drive. Remember that if you are running as a liveCD your configuration will be gone when you reboot if you don't save it to a physical device (harddrive or usb drive).
     
  22. tvcasualty

    tvcasualty New Member

    Offline
    Messages:
    637
    Trophy Points:
    0
    Real shame it requires that RTI kernel, unbutu straight up runs great on every modern PC I've tried it on, especially the newer versions. Unfortunatly, it's gets flaky w/ the real time kernel.
    However, it's tough to argue with the price (if you can get it working)! :mrgreen:
     
  23. ttraband

    ttraband Member

    Offline
    Messages:
    44
    Trophy Points:
    8
    A few points of information from my EMC experience:

    The Ubuntu live-trial EMC disks are built on specific versions of the distribution (those flagged as "long term support") and it can be very tricky to get everything pulled together on other sets of kernel plus drivers plus real-time extensions, etc. I strongly recommend leveraging the effort the folks at linux-cnc have invested and starting from the live-trial cd.

    Integrated (on the motherboard) video can cause problems, particularly with the real-time extensions, double-especially if it's ATI (non-open source driver issues) or if they don't support OpenGL. Picking up a used NVidia card ($5-$15 on eBay or local swap meet) and using the NVidia drivers (not the generic) can go a long way toward resolving performance issues.

    The surplus Dell GX-240 that I got from the store-room at work had pretty bad latency scores, related to a motherboard "feature" called SMI which is apparently pretty common on Dell PC's. It required some additional tuning to disable SMI (more details on the issue and how to fix it here: http://wiki.linuxcnc.org/cgi-bin/emcinf ... gSMIIssues

    I'm happy to say that the system is running and stable, and I routinely copy code via USB-flash drives to the standalone PC (I don't have a wired network drop in the workshop ... yet). And the money I saved not buying Mach3 went toward the Mk1.5 belt-drive upgrade.
     
  24. TigerPilot

    TigerPilot Well-Known Member

    Offline
    Messages:
    1,578
    Trophy Points:
    48
    Not on your life. :D I have more problem with it than I had with any recent window installation.

    I decided to install it on the drive. I clicked install and tried to follow the instruction as they are on the ubuntu page under the 6.xx version. The sequence of my installation is not the same as it shows on the site. It shouldn't be a big deal except that I wanted to make it with two system on the disk and I couldn't get it to make the partitions. The only thing that I could do was to have it format the drive and use all of it. So I let it do it and then install ubuntu. When it was finished I rebooted it and after it asked for my password the screen went black (dark dark brown) and only the mouse was working. Nothing else on the screen. I reinstalled ubuntu from the beginning and the same thing happened the second time. It boots up but after the password it just goes blank.

    Any idea what to do?
     
  25. kyyu

    kyyu Active Member

    Offline
    Messages:
    1,183
    Trophy Points:
    36
    Location:
    Maryland
    I don't have an answer for your problems, but awhile back I did messed with it. It was easy as pie to install. Installed it a few times, on 2 different pcs. Both versions, too and did the multiple boot thing. Not one problem. Sorry, I don't really have any suggestions, except can you possible try another video card, not the on board one?

    -Kwok
     

Share This Page