Welcome to Our Community

Some features disabled for guests. Register Today.

Hal2Arduino v2

Linuxcnc, USB, Machinekit

  1. Instructions for Hal2ardunio

    Timothy March
    The following instructions apply to CNC users. ( Robotics enthusiasts can just upload the sketch and play. :)
    How to get going in 6 easy steps:

    1. Install LinuxCNC or Machinekit on an old (USB enabled) computer.
    You can get LinuxCNC for free at LinuxCNC.org

    For Debian based Linux distros (Ubuntu, Mint, etc.), you might want to check out the precompiled .deb packages available here:
    http://buildbot.linuxcnc.org/

    When using them you easily get a 'simulation-only' install of LinuxCNC, but this is sufficient for using HAL2Arduino in most cases. You don't get the realtime kernel extensions that guarantee timing and responsivness, but it significantly broadens the install targets for LinuxCNC and makes life generally easier. Use at your own risk.

    You can get Machinekit for free at Machinekit • Moves. Controls. Things. follow compile or install instructions on web site.

    2. Open the HAL2Arduino firmware adjust to suit following directions in files, upload it to your UNO, Mega 2560 or Due.
    It can be done with an UNO if your really clever about pin managment.

    You'll need to get a library for your Arduino IDE to include with HAL2Arduino. Download it here (AccelStepper: AccelStepper library for Arduino), unzip and put it in the ‘libraries’ subfolder of your arduino IDE (ex. /home/user/arduino-1.0.2/libraries/AccelStepper).

    3. Run the "Machinekit or LinuxCnc Stepconf Wizard" to setup your machine, it will by default create a folder
    on your desktop called "my-mill".

    4. Edit the included custom.hal file, adjust to suit your needs.

    5. Copy the files in included LinuxCNC file folder into said "my-mill" folder.
    6. Play with your CNC for a while tuning and tweaking it by editing the my-mill.ini file
    in the my-mill folder. (Use tuning LED to help determine max speed.)


    Tips: Inside the my-mill.ini the following settings <> to english are:

    MAX_VELOCITY = 2.33 <> Maximum speed limit for an axis (in feet or meters per second).
    HOME = 2.0 <> Where your home SWITCH is located for that axis. (in inches or mm)
    HOME_OFFSET = 0.0 <> Where to move to after it finds the switch. (in inches or mm)

    If you don't have a paralell port (or aren't using the realtime extensions to Machinekit or LinuxCNC), you might need to comment out all lines with references to 'parport' in the Stepconf generated .hal. You aren't using this to control your CNC, so you don't need them.

    For example, in my-mill.hal, the line 'loadrt probe_parport' changes to '#loadrt probe_parport'. Do that (add a '#' to comment) for every line that you find with the word 'parport'. Remember that this gets overwritten each time you run Stepconf, so be careful with that.

    Note:
    Synced Machinekit and LinuxCNC settings:
    Actually, HAL2Arduino doesn’t connect at all to the step settings within Machinekit or Linuxcnc’s config files.

    The actual stepping is handled entirely by the Arduino. Why is that? Sending every single step/direction pulse for each motor over a serial link is a non-starter. There is just not enough bandwidth, plain and simple. Instead what it does is pay attention to the coordinate variables, much, MUCH less data to send. Bare in mind that linuxcnc has been around for over 20 years. It’s an existing software platform that HAL2Arduino hacks into and eavesdrops on, and maybe taps on the glass now and then. So there is a lot of required but now useless settings in the config files that are there explicitly for making Linuxcnc happy enough for you to fire it up and play around with it.

    For what it’s worth, linuxcnc assumes that you still have an old school LPT printer port(s) to give it access to for wiring up stepper drivers/switches directly; and that’s why it has stepper settings (that we completely ignore).

    BTW, if you find you don’t have enough torque, reduce your microstep mode. A commercial-grade “bridgeport knee mill” won’t hold a 1/1,000th inch tolerance without extreme patience.
    George Negret likes this.
Return to update list...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice