HAL2Arduino 0.4 – preRelease

Well, after looking around for a good non-blocking multi-instance stepper library that has hooks I can exploit with input speeds from LinuxCNC (a very tall order) I found one that could do it. AccelStepper, so I put my coding hat on, brewed some coffee and banged out rough implementation of HAL2Arduino 0.4 (the preRelease version).

For those of you that have been waiting ever so patiently for the next generation of EMC2Arduino, here is the first version of HAL2Arduino that is actually useful to the average end-user.

This version has a couple of bug fixes:

  • Bi-directional communications fix. (Coding typo)
  • Init spam bug fixed.

Added features:

  • Support for plugin based mod files, for drag-n-drop/compile add on features.
  • Pre-compiler optimized code (modFiles too!) to keep the memory footprint lower, saving more room for your code. Unused code won’t be added to your final build.
  • Added “Green Light” signal so Arduino clients can synchronize with each other.

Added modFiles:

  • modAccelStepper: 0~9 axises of speed sensing motion control, default config is for 3-axis machine suitable for routers, plasma tables, basic mills, etc.
  • modLimSwitch: support for min/max/home switches, both physical and/or virtual (based on stepper positions).
  • modLcd: Updated to run on HAL2Arduino-0.4 (Still just a basic example of a DRO.)

In the pipeline:

modButtons: A control panel collection for the basics like E-Stop, start, stop, pause, step, etc.

Config LinuxCNC from Arduino. ie: Edit/upload HAL2Arduino to your arduino, run the host side python script and the custom.hal files get generated for you, based on the configuration of the arduino(s).

If you like, you may grab an early copy of it here.

About these ads

100 Responses to HAL2Arduino 0.4 – preRelease

  1. Hello
    Where do I change / configure the pins of the arduino?

    • dewy721 says:

      Inside the HAL2Arduino_0_4.ino file.

      Once you open that file (using the Aduino IDE) the other files will show up as ‘tabs’ inside the window.

      Each tab that starts with ‘mod’ is where you’ll want to look for pin assignments.

      Also, each mod-file is an optional addon feature that can be safely excluded, should you not have a need for it.

      • Ok I understand, thank you. Regarding the setting in millimeters (mm) instead of inches, how do I?

      • dewy721 says:

        Your welcome. :)

        Setting inch/mm: In the my-mill.ini file search for: LINEAR_UNITS = inch
        change to: LINEAR_UNITS = mm
        (inside arduino consider stepsPerInch as stepsPerMillimeter)

  2. dumbeng says:

    Does this allow the arduino to handle the real time stepper control from LinuxCNC?

    Basically I am interested in having the LinuxCNC be a front end running on a computer and then send down commands to Arduino for real time control of the stepper motors, with some periodic feed back to LinuxCNC to keep GUI updated.

    I was going to start my own project to do this, however if this is the goal of this project I am willing to help out.

    thanks

    • dewy721 says:

      Actually it offloads (more like duplicates) the stepgen in the arduino, but since its over USB it can’t actually do “real-time” since USB has a slight latency.

      But it does do bi-directional communications, however I would recommend for tight-timing IO constraints to opt for the standard controller setups.

      Really its best used for control-boxes, general IO, toolchangers, hobby-grade wood routers, etc.

      If you want to dig in and help I’m all for it. :)
      Its all written in standard Arduino IDE, has a Python script for a pc-side backend.

      Right now this old mechanic is banging his head trying to fully add in support for the Arduino Due. (At the moment it only works on the Due’s programming port.)

  3. Bill says:

    Had play with this today but the switches bit is confusing me.

    #Define useLimitSwitches true. If set to false does that ignore the switches tab completely ?

    // 0 + axisEnabled = individually disabled switches. is that if, i.e xMinSwitch 0 and XaxisEnabledSwitches false then you will be using the virtual limit switches for that axis.

    Had a qiuck look at the code for the accel stepper and it seems to be the same as the test I was using to prove steppers wroked and the wiring was ok when I got my motors. If I can get the swiches thing sorted I might be able to run a motor with this code and see what its like.

    • dewy721 says:

      That is correct.

      It just tells the compiler whether or not to include that section of code for uploading to the arduino. You can see this when you verify/upload the sketch.

      If set to true then the uploaded program becomes bigger, as it now include the associated code for those functions.

      If false, the program is stripped of the unused functions and thus is smaller in result.

      Each modFile is built with this idea in mind.
      For example, say you have no use for a modFile named “modBathtub”. Why waste any memory space on it when that same precious space could be used for your own code.

  4. Bill says:

    ARRRRGh dont know wht I’ve done, but now I cant get Hal2 to work. Every time I click on the launch icon it comes up with various messages about the Hal2Arduino-0.4.py. From cant find the file or directory, Permission denied to Hal2Arduino-0.4.py exited without becoming ready.

  5. dewy721 says:

    You might need to edit the custom.hal file; line two of the example file says:
    /home/dewy/Desktop/my-mill/HAL2Arduino-0.4.py
    should be edited to:
    /home/YourUserNameHere/Desktop/my-mill/HAL2Arduino-0.4.py

  6. Bill says:

    Been there, seen that, made the change. I’m just demented with it, more so because I have had it going of a sort, just never managed to get on comms going. I could get ok in the arduino serial monitor but that was all, no other info so that was telling me there was no comms going from the axis to the arduino. I might just un-install everything and try from scratch.

  7. Bill says:

    Duh, Got it to run now, my problem was I wasnt copying files into my-mill folder but was making a new one, seems that there are some files that dont copy or are not in the correct path.

    Now I cant get the axis to home. No matter what I set the modlimswitch to the homing just zips right past the home setting.

    How do I configure it so it just uses virtual switches, still havnt got my rigs limit switches sorted yet, I blew my last driver playing with the zero state and enable options, so I am waiting for new ones to arrive.

    • dewy721 says:

      With some math; since the Arduino doesn’t compute floats efficiently the python script needs to scrub the output coordinates by multiplying the decimal out of them with a fixed value of 10000. ie: 1.2345″ x 10000 = 12,345(10000ths inch.)

      So if your desired home on your Z axis is at 7inches x 10000 = adjusted value of virtual switch is 70000.
      Also:
      Make sure that ZaxisEnableSwitches is set to true
      –and– zHomeSwitch is set to 0 (to enable virtual switch)
      –and– zVirtualHome is set using the math applied above.

  8. Bill says:

    If I read your comments in the code properly I wouldnt have to ask stupid questions.

    • dewy721 says:

      Hey, don’t sweat it.

      People see things in different ways; there is no such universal vision that allows one to perceive everything instantly and accurately.

      That’s why we share ideas, we learn together, and together we grow. :)

      • Bill says:

        Hey I must be doing something right for a change. I can now get it to home on the virtual switches no problem and even run a cnc program, all virtual of course. Next thing I tried was to assign a pin for x min and max which I did pin 27, but no matter what I do I cant get it to register a switch break. I tried to look at it using the serial monitor but all I get get is either repeat ,or if I comment out that repeat print statement in the program tab I can get “got 0,0,0,0″. Is there any thing else I need to set in the modlimits tab other than use limitswitches true, axis_enabledswitches true then the axis min and max limit set to 27 for the pin switch break. Do I need to set the vitual switch to 0 for the axis I’m playing with. Out of curiosity what are the 3 elements in the array for the use limit switches. I know that the 9 blocks are for the nine axis and I can see that two cells are for the axis enabled switch and limit switch but whats the third one for, or am I totally off base and it all something else.

      • dewy721 says:

        Your missing the trailing ;

        Also, a command of 0 0 0 0; has no usage, so it won’t return anything meaningful.

        Instead, try 224(jointPosCommand) 0(xAxis) n(someValueJustBelowXminLimitSetting) 224+0+n(checkSum);
        ie: 224 0 9999 10223; (if xMinLimit = 10000, will return xMinLimitSignal true)
        224 0 10001 10225; (if xMinLimit = 10000, will return xMinLimitSignal false)

        Note: you can toggle the debug output on/off with 995 0 0 995;

      • Bill says:

        additional to the comment I did set the debug to true in the program tab so I can see the output

  9. Edu says:

    Hi!, because when checking HAL2Arduino Sketch 0.4, downloaded from here, shows me this error?

    modAccelStepper:41: error: ‘AccelStepper’ does not name a type
    modAccelStepper:44: error: ‘AccelStepper’ does not name a type
    modAccelStepper:47: error: ‘AccelStepper’ does not name a type
    modAccelStepper.ino: In function ‘void stepperSetup()’:
    modAccelStepper:109: error: ‘stprX’ was not declared in this scope
    modAccelStepper:112: error: ‘stprY’ was not declared in this scope
    modAccelStepper:115: error: ‘stprZ’ was not declared in this scope
    modAccelStepper.ino: In function ‘void runSteppers()’:
    modAccelStepper:231: error: ‘stprX’ was not declared in this scope
    modAccelStepper:234: error: ‘stprY’ was not declared in this scope
    modAccelStepper:237: error: ‘stprZ’ was not declared in this scope
    program.ino: In function ‘void processCommand(long int, long int, long int)’:
    program:35: error: ‘stprX’ was not declared in this scope
    program:41: error: ‘stprY’ was not declared in this scope
    program:47: error: ‘stprZ’ was not declared in this scope
    program:98: error: ‘stprX’ was not declared in this scope
    program:103: error: ‘stprY’ was not declared in this scope
    program:108: error: ‘stprZ’ was not declared in this scope

    Thank you, best regards

  10. Edu says:

    Hi!, excuse my questions, I’m new to Arduino and is complicated for me.
    I installed the library AccelStepper and is now better, but I still have errors.
    He says:
    Line 109, 112 and 115
    modAccelStepper: error: call of overloaded ‘setPinsInverted (int, int, int)’ is ambiguous

    and

    C:\Program Files(x86)\Arduino\libraries\AccelStepper/AccelStepper.h: 389: note: candidates are: void AccelStepper :: setPinsInverted (bool, bool, bool)
    C:\Program Files(x86)\Arduino\libraries\AccelStepper/AccelStepper.h: 397: note: void AccelStepper :: setPinsInverted (bool, bool, bool, bool, bool)

    You can help me with this? Thank you!

  11. Bill says:

    Only way I have got past that is to set pin inversion to false at the tope of the ModAccelStepper tab

    • dewy721 says:

      It seems that I have some coding to do.

      The accellStepper library has been updated and I need to update my code as well. I’ll post a new version HAL2Arduino as soon as I can.

      • Edu says:

        Thanks Bill. Thanks dewy721. I will be alert and waiting for the new version. Best regards.

  12. Edu says:

    Hi, sorry, my English is very bad, use the google translator. I am Argentinian but I’m in Spain.
    I have AccelStepper 1.30 Library and now the sketch is good. When starting LinuxCNC says: Connection Error!. and can not find the problem … : (
    Print file information:
    RUN_IN_PLACE=no
    LINUXCNC_DIR=
    LINUXCNC_BIN_DIR=/usr/bin
    LINUXCNC_TCL_DIR=/usr/lib/tcltk/linuxcnc
    LINUXCNC_SCRIPT_DIR=
    LINUXCNC_RTLIB_DIR=/usr/realtime-2.6.32-122-rtai/modules/linuxcnc
    LINUXCNC_CONFIG_DIR=
    LINUXCNC_LANG_DIR=/usr/share/linuxcnc/tcl/msgs
    INIVAR=inivar
    HALCMD=halcmd
    LINUXCNC_EMCSH=/usr/bin/wish8.5
    LINUXCNC – 2.5.2
    Machine configuration directory is ‘/home/edu/linuxcnc/configs/my-mill’
    Machine configuration file is ‘my-mill.ini’
    INIFILE=/home/edu/linuxcnc/configs/my-mill/my-mill.ini
    PARAMETER_FILE=emc.var
    TASK=milltask
    HALUI=halui
    DISPLAY=axis
    Starting LinuxCNC…
    Starting LinuxCNC server program: linuxcncsvr
    Loading Real Time OS, RTAPI, and HAL_LIB modules
    Starting LinuxCNC IO program: io
    Starting HAL User Interface program: halui
    Wait, something is not right here.
    Shutting down and cleaning up LinuxCNC…
    Killing task linuxcncsvr, PID=8288
    Removing HAL_LIB, RTAPI, and Real Time OS modules
    Removing NML shared memory segments
    Cleanup done

    Debug file information:
    Can not find -sec MOT -var MOT -num 1
    Can not find -sec IO -var IO -num 1
    Can not find -sec LINUXCNC -var NML_FILE -num 1
    Can not find -sec EMC -var NML_FILE -num 1
    Waiting for component ‘Hal2Arduino’ to become ready………………………………………………………………………………………………………………………………………………………………………………………
    custom.hal:2: /home/edu/linuxcnc/configs/my-mill/HAL2Arduino-0.4.py exited without becoming ready
    8288
    PID TTY STAT TIME COMMAND
    Stopping realtime threads
    Unloading hal components

    Kernel message information:
    [22690.959174] I-pipe: Domain RTAI registered.
    [22690.959187] RTAI[hal]: mounted over IPIPE-NOTHREADS 2.6-03.
    [22690.959190] RTAI[hal]: compiled with gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5) .
    [22690.959197] RTAI[hal]: mounted (IPIPE-NOTHREADS, IMMEDIATE (INTERNAL IRQs DISPATCHED), ISOL_CPUS_MASK: 0).
    [22690.959200] PIPELINE layers:
    [22690.959203] de131e20 9ac15d93 RTAI 200
    [22690.959206] c085cb20 0 Linux 100
    [22690.986447] RTAI[malloc]: global heap size = 2097152 bytes, .
    [22690.986629] RTAI[sched]: IMMEDIATE, MP, USER/KERNEL SPACE: , kstacks pool size = 524288 bytes.
    [22690.986634] RTAI[sched]: hard timer type/freq = APIC/12507048(Hz); default timing: periodic; linear timed lists.
    [22690.986638] RTAI[sched]: Linux timer freq = 250 (Hz), TimeBase freq = 1800913000 hz.
    [22690.986641] RTAI[sched]: timer setup = 999 ns, resched latency = 2944 ns.
    [22690.986744] RTAI[usi]: enabled.
    [22691.094191] RTAI[math]: loaded.
    [22719.096934] RTAI[math]: unloaded.
    [22719.178079] SCHED releases registered named ALIEN RTGLBH
    [22719.193715] RTAI[malloc]: unloaded.
    [22719.292027] RTAI[sched]: unloaded (forced hard/soft/hard transitions: traps 0, syscalls 0).
    [22719.295994] I-pipe: Domain RTAI unregistered.
    [22719.296034] RTAI[hal]: unmounted.

    Best regards

  13. dewy721 says:

    Try reconnecting the USB cable and then restarting the Axis GUI. Sometimes the connection between the Arduino and the python script does not start correctly.

  14. Edu says:

    ok, I’ll try and see the result … Thank you, best regards.

  15. Edu says:

    Hi! another question! to see if my error is from the beginning!
    When LinuxCNC Stepconf Wizard asks “Parport First Base address: 0×378″ This is correct? Or I have to put ttyACM0 for example?. Thank you.

    • Edu says:

      … and in Advanced Settings: check “Include Halui user interface component”, check “Include custom GUI PyVCP panel” then that option? Blanck, Spindle or Existing? and finally leave marked “Include connections to Hal”?
      Sorry for so many questions … :) Thanks.

      • dewy721 says:

        The Parport is not used by HAL2Arduino, this is because HAL2Arduino gets its data over the USB serial link.

      • dewy721 says:

        Also, Yes: You do want to include Halui, the PyVCP and others are extras that are not important to HAL2Arduino either way. You can optionally install them if you like extra things to configure and/or play with.

  16. Bill says:

    I have never touched the parport base address but left it as is. You need to check include HAL user interface to get to the screen where you can select the pins for your axis, limit and home switches.

    The pin numbers next to the option you choose for it, are the parallel port pins which will be converted to the Arduino pins used. For example you may select pin 10 as the all limits option on the HAL user interface but use pin 33 on you Arduino. Selection of pin 33 is done in the Arduino sketch under the modlimitswitch tab.

  17. Edu says:

    Hi Bill! Thanks for responding, but I still find a solution to my problem. Continue the following error and do not understand. custom.hal error: 2: the path is correct …!

    Debug file information:
    Can not find -sec MOT -var MOT -num 1
    Can not find -sec IO -var IO -num 1
    Can not find -sec LINUXCNC -var NML_FILE -num 1
    Can not find -sec EMC -var NML_FILE -num 1
    custom.hal:2: execv(/home/edu/Escritorio/my-mill/HAL2Arduino-0.4.py): No such file or directory
    custom.hal:2: /home/edu/Escritorio/my-mill/HAL2Arduino-0.4.py exited without becoming ready
    3310
    PID TTY STAT TIME COMMAND
    Stopping realtime threads
    Unloading hal components

    • dewy721 says:

      Looks like it can’t find the HAL2Arduino-0.4.py file (or the file is not executable.)

      Copy HAL2Arduino-0.4.py to my-mill folder.
      Then right-click the file, select “Properties”, then click the “Permissions” tab, then check the box labeled “Allow executing as a program”.

      See if that helps.

  18. Edu says:

    Yes! Yes! Yessss! The software it worked!! Thanks Dewy, Thanks Bill for the feedback!
    I only had to open the file Hal2Arduino and “save as” (Unix / Linux) and it worked!.

    Now … I have two tasks to do … Knowing that the engines are always blocked. When I connect the power supply to the Arduino Uno, Pololu A4988 drivers and motors, the power supply indicates 2 Amp. approx.

    also see the possibility to convert from inches to millimeters. Here you have to make modifications to the Arduino sketch?. or just have to modify the file my-mill.ini?

    Thank you guys! Best regards.

    • dewy721 says:

      Stepper motors:
      Yes, the stepper motors require power to lock in place, this keeps the machine from drifting out of position.

      Locking is necessary since basic stepper-based machines lack encoders to read the real-life position of an axis. If encoders are added, then it becomes possible to “recover” the proper position of the machine after being interrupted, moved by hand, then resumed.

      Inch/mm:
      The arduino sketch holds the inch/mm controls, you’ll find them in the modAccelstepper tab.

      How they work is not truly “steps per inch”, more like “steps per unit of measure.” So if you use millimeters then change the numbers to match steps per millimeter.

      Just be sure to configure LinuxCNC to use mm also!

      You could set it to any other unit of measure such as well, such as: foot, kilometer, mile, stone, kilogram, parsec, light-year, etc.

      As long as LinuxCNC unit of measure = HAL2Arduino steps per unit. It will work.

      • Edu says:

        Okay, I’ll go testing, anyway I’m waiting for an Arduino Mega, because Arduino Uno my mill does very bad movements, something I’m doing wrong with the pin configuration …

  19. Edu says:

    Hi!, I see in the sketch to Arduino Mega the following pins:
    Step / Dir
    X = 41, 43
    Y = 40, 42
    Z = 35, 33

    Enables
    X = 2
    Y = 3
    Z = 5

    SLP / RST (my example)
    X = 22, 51
    Y = 23, 52
    Z = 24, 53

    I do not understand if defined MS1, MS2 and MS3 or that pin.
    Thank you.

    • Edu says:

      Has anyone connected the display 16 x 2?, Because only said analog pins 0, 1, 2, 3, 4 and 5 but does not comment to that pin the display…
      Thanks again…

      • dewy721 says:

        MS1, MS2 & MS3 are only used to setup micro-stepping mode. It is called only during setup. For people that like to experiment with different stepping modes and entirely optional. If your machine has the step mode manually wired, then MS1, MS2 & MS3 will have no effect.

        LCD, I made it mostly as a coding example. That said, it only show the X, Y & Z coordinates. Your correct, it needs more comments to explain what is going on.

  20. Edu says:

    ok, keep trying, because it’s very abrupt movements without coordination … Thank you.

  21. Bill says:

    trying lowering the speed. I found wit hte 07b version that above a certain speed my setup started missing steps. Start slow and work your way up.

  22. John says:

    I downloaded HAL2Arduino 0.4 today. I already own an Arduino Duemilanove and so I want to use it to play around with. I know I saw somewhere, some code changes — I thought they were for digitalwritefast but I can’t find them anymore.

    Do I have to make any changes to the program (other than those mentioned in Instructions.txt) to use the current program with Arduino Due?

    Also, do I also need to download AccelStepper 1.32 or is it already updated in the current program version?

    • dewy721 says:

      HAL2Arduino does not use digitalWritefast so no worries. :)

    • John says:

      Ooops…just found it — It was under FAQ for EMC2Arudino found here – http://emc2arduino.wordpress.com/faq-2/faq-emc2arduino/

      It says – You have to edit the sketch and replace every “digitalFastWrite2″ with “digitalWrite

      • John says:

        Our replys — happened at the same time.

        So, I don’t have to make any changes to use my Due

        Also, do I need to download and install a new AccelStepper 1.32 — I see now the latest version is 1.34

      • dewy721 says:

        The Arduino Due is supported experimentally. (As I have one here I’m trying to develop code for.)

        Notes: Although the sketch has an option for using the Due’s native USB port, I have yet to make it work successfully; It hangs after a few seconds. (data-overload?)

        Just stick to the regular serial port (programming port) for the Due for now.

        Also in the works is eithernet support for LAN-based print server-like setups.

      • dewy721 says:

        It’s no problem, I just wish I had more time to work on it.

        I’m always in demand. Wife,Family and community. <:)

        For example: Right now I'm putting together a (DIY-rebuild) parts list to repair/upgrade my kid neighbor's blown Razor e-bike. He smoked the electronics pretty bad.

    • dewy721 says:

      Also, you will need a copy of the accelStepper library, I always recommend the latest version.

      • John says:

        Thanks, for your two replys — I am sorry that I was typing at the same time you were it.

  23. John says:

    Cabling from LinuxCNC to Arudino Duemilanove AT328. What kind of cabling are you using to go from your Linux box (with LinuxCNC loaded on it) to your Arduino. My Linux machine does not have a printerport cable, so I know I will have to do something. What works best?

    • dewy721 says:

      Well, I use a USB A-B cable. (The common usb printer cable.)

      Also, I’m using the UNO, Mega2560 or Due micro-contollers.

      I could be mistaken but I think the Duemilanove uses a 9-pin serial?

  24. John says:

    My Arduino Duimilanove has the same usb connector as this Arduino Uno (https://www.sparkfun.com/products/9950). I also did a search of usb cable Type A male to Type B male : and it is the same cable that I use to upload by sketch to my Duemilanove.

    I am still a little lost on cabling. So your LinunCNC program can talk to your Arduino through the USB cable instead of the parallel port DB25 port. How do you do that?

    • dewy721 says:

      The overall concept is pretty straight forward.

      A Python script reads LinuxCNC’s variables (via HAL) and translates them into ascii text; then ships the text over serial-link to one or more arduinos.

      LinuxCNC>Python script>USB-Serial link>Arduino.

      If your into scripting grab a copy of EMC2Arduino and have a look at the .py (text) file. You’ll see that is actually kinda simple to hack into.

      HAL2Arduino is a bit more complicated but the concept is the same.

  25. John says:

    I just had a thought…and now I am looking at Hal2Arduino.py. is the following correct: Instead of sending the command out through the parallel port; somehow Hal2Arduino.py is getting the command. Hal2Arduino.py is sending the command to Arduino which outputs the necessary steps to the stepper motors.

    Maybe I will be wiser after reading through Hal2Arduino.py?

    • dewy721 says:

      Actually your right on the money. :)

      The arduino is acting as a slaved motion controller that listens for positional commands and also returns feedback from limit switches,etc.

      I know that it is possible to incorporate a TCP/UDP connection as well. A feature that I do intend to add, but at the moment my python-foo is not quite strong enough.

  26. André says:

    Hey, I’m fairly new to the whole CNC thing. I tried Hal2Arduino on my Leonardo.
    I copied all the config files into the “my-mill” folder as said. But I get this error, whatever I do:

    Debug file information:
    Can not find -sec MOT -var MOT -num 1
    Can not find -sec IO -var IO -num 1
    Can not find -sec LINUXCNC -var NML_FILE -num 1
    Can not find -sec EMC -var NML_FILE -num 1
    Waiting for component ‘Hal2Arduino’ to become ready…………………………………………………..
    custom.hal:2: /home/ubuntu/linuxcnc/configs/my-mill/HAL2Arduino-0.4.py exited without becoming ready
    6044
    PID TTY STAT TIME COMMAND
    Stopping realtime threads
    Unloading hal components

    What can I do?

    • dewy721 says:

      Hello André,

      custom.hal:2: /home/ubuntu/linuxcnc/configs/my-mill/HAL2Arduino-0.4.py exited without becoming ready

      Hmm…
      Did you chmod the HAL2Arduino-0.4.py file to make it executable?

      Example 1: The old-school way. From a console window type…
      sudo chmod +x /home/ubuntu/linuxcnc/configs/my-mill/HAL2Arduino-0.4.py
      *prompt for password*

      Example 2: The new-school way…
      Open your my-mill folder icon on the desktop.
      Right the HAL2Arduino-0.4.py file.
      Click the permissions tab.
      Select the check-box labeled “Allow executing as program“.
      Click close.

  27. dewy721 says:

    Did it help?

    Also, by default the HAL2Arduino-0.4.py will search /dev/ttyACM0 through /dev/ttyACM9 for an arduino loaded for HAL2Arduino ver. 0.4 (or higher.)

    • André says:

      Sorry, I didn’t make it clear. I made the python script executable before I posted here. I just checked “sudo ls /dev” and I only see ttyAMC0 when my leonardo is in bootloader mode. If it is just on and ready booted I can’t find it in /dev. Any ideas?

  28. dewy721 says:

    Hmm. Help me, help you. Walk me through this…

    With the HAL2Arduino firmware loaded on your Leo; open up a serial monitor and watch the output.

    You should see “ok” (within 3 seconds!)
    type in:
    990 0 0 990;
    enter.

    Should return:
    HAL2Arduino

    If you get that far the Leonardo is doing its part.
    Let me know what you get.

    • André says:

      Yeah, and there is the problem. I just installed the Arduino IDE and when I now go to Tools -> Serial Port is greyed out. If you have any suggestions I’ll give it a try. If not, my just ordered Uno will surely arrive before weekend.

      • dewy721 says:

        Yeah, there’s the problem. It’s not being recognized correctly. I have the same problem with the Arduino Due’s Native (high-speed) port.

        Alas, I have yet to muster the motivation to resolve my PC’s issue with it.

        My UNO and Mega2560 both work perfectly though.

  29. André says:

    At least with the Uno the *.py shows a reaction:

    Debug file information:
    Can not find -sec MOT -var MOT -num 1
    Can not find -sec IO -var IO -num 1
    Can not find -sec LINUXCNC -var NML_FILE -num 1
    Can not find -sec EMC -var NML_FILE -num 1
    Waiting for component ‘Hal2Arduino’ to become ready………………………………………………………………………………..
    Traceback (most recent call last):
    File “/usr/bin/axis”, line 3078, in
    vcpparse.create_vcp(f, comp)
    File “/usr/lib/pymodules/python2.6/vcpparse.py”, line 177, in create_vcp
    read_file()
    File “/usr/lib/pymodules/python2.6/vcpparse.py”, line 47, in read_file
    doc = xml.dom.minidom.parse(filename)
    File “/usr/lib/python2.6/xml/dom/minidom.py”, line 1918, in parse
    return expatbuilder.parse(file)
    File “/usr/lib/python2.6/xml/dom/expatbuilder.py”, line 922, in parse
    fp = open(file, ‘rb’)
    IOError: [Errno 2] No such file or directory: ‘custompanel.xml’
    4252
    PID TTY STAT TIME COMMAND
    4354
    PID TTY STAT TIME COMMAND
    Stopping realtime threads
    Unloading hal components
    Traceback (most recent call last):
    File “/home/ubuntu/linuxcnc/configs/my-mill/HAL2Arduino-0.4.py”, line 2002, in
    commandHandler(str(listOfCommands), str(listOfAxis))
    File “/home/ubuntu/linuxcnc/configs/my-mill/HAL2Arduino-0.4.py”, line 1173, in commandHandler
    sleep(0.001)
    KeyboardInterrupt
    Unhandled exception in thread started by
    Error in sys.excepthook:

    Original exception was:
    Unhandled exception in thread started by
    Error in sys.excepthook:

    Original exception was:

    I just updated the python2.6, libpython2.6, python2.6-minimal and python2.6-dev packages but I still get this error.
    Any ideas?

    • dewy721 says:

      Try with the UNO being the only arduino connected. If plugged-in, Leo might foil the handshake.

      I always just run the stock distro of LinuxCNC. Even though its based off of Ubuntu, updating it using the Ubuntu repositories will break things.

      You mileage may vary though.

      From a console try running it and see what comes back. ie run: linuxcnc /home/ubuntu/linuxcnc/configs/my-mill/my-mill.ini

      • André says:

        The UNO is the only arduino I have connected to the PC because there are no usb ports left. So the Leo can’t be the Problem.

        I did try running it, and then I got the error above. Then I updated the packages. Wich got me the same error.
        Before I did install open jdk to run the arduino IDE, so I tried a fresh install now.

        Even on this fresh install and running the command from console gives me the same error.

        Could it be a problem because of running linux in persistent mode from usb flash drive?
        Hmm, whatever. I will try installing and tell you about the results!

      • dewy721 says:

        Hmm, let me know.

        My setup: Running LinuxCNC ver.2.5 inside a virtual machine. Using VirtualBox (freeware from Oracle.)

        On an i7, I can run multiple OS’s simultaneously this way.

      • André says:

        Very strange… I’m using the latest release wich is LinuxCNC2.5. I tried installing it on my Netbook but no luck. Even installing it in my VBox doesn’t work. I always get the exact same error.

        Could you maybe upload your exported vbox files? I know that doesn’t solve the problem, but I could start trying if the software works for me.

        I just found your post on google:
        http://emc2arduino.wordpress.com/2013/01/19/hal2arduino-0-1-released/#comment-174

        this clears the first 4 python errors but

        File “/home/ubuntu/linuxcnc/configs/my-mill/HAL2Arduino-0.4.py”, line 2002, in
        commandHandler(str(listOfCommands), str(listOfAxis))
        File “/home/ubuntu/linuxcnc/configs/my-mill/HAL2Arduino-0.4.py”, line 1173, in commandHandler
        sleep(0.001)

        they remain.

      • André says:

        I just saw, I use LinuxCNC2.5.2 but I’m looking for a 2.5.0 download…

  30. André says:

    It seems there is no chance of getting the old images from LinuxCNC. Would you try a setup with a fresh 2.5.2 install, please?

    • dewy721 says:

      Sure, let me pull down a copy.

    • dewy721 says:

      Looks like they ‘boke’ it. :-/ *puts coding hat on* back to work.

      Here is what I’ve done so far.

      Installed LinuxCNC 2.5.2 ie: http://www.linuxcnc.org/iso/ubuntu-10.04-linuxcnc3-i386.iso (As a VirtualBox VM)
      Intsalled VirtualBox extensions. (Graphics drivers.)
      Installed HAL2Arduino v0.4 sudo apt-get update downloaded & extracted http://arduino.googlecode.com/files/arduino-1.0.5-linux32.tgz
      failed to run, needs java installed…
      sudo apt-get install default-jre
      arduino IDE runs.
      open serial monitor at 115200, verified linux can indeed speak to my mega2560 & UNO.

      Run stepconf wizard Checked the box labled “Include Halui user interface component” (I opted to also include the spindle speed applet.)
      Save config.

      *** VirtualBox compatablity mods ***
      BEFORE Running LinuxCNC Edit the my-mill.hal file.
      Comment-out all entries regarding “parport” (For me, lines: 6,7,8,12,14 & 15)
      Save it.

      *** Annoying message reduction. ***
      Edit the my-mill.ini file.
      Change BASE_PERIOD to = 200000
      Change SERVO_PERIOD to = 2000000
      Save it.

      Now from the console run LinuxCNC to check that it will run naked, ie: no HAL2Arduino or parallel port pins used.
      It runs fine.

      Setup the HAL2Arduino-0.4.py file for a simulated test run.
      copy it to our my-mill folder.
      in console:
      chmod +x HAL2Arduino-0.4.py (make executable)
      chmod 777 HAL2Arduino-0.4.py (lazy set permissions)

      gedit HAL2Arduino-0.4.py on line #67 change simulation = False to simulation = True save file.

      back in console…
      ./HAL2Arduino-0.4.py and watch the output to make sure it can communicate with the Arduino(s).

      It ‘should’ find it/them. re-edit HAL2Arduino-0.4.py file and return to non-simulated mode, save, run LinuxCNC for win.

      • André says:

        I just saw, that I get
        “avrdude: stk500_recv(): programmer is not responding”
        from the arduino IDE when I try uploading something.
        I’m about to solve this, but this may take a while because at the moment I don’t know what to do…

  31. dewy721 says:

    That’s an upload error. Try cycling your USB cable and restarting the IDE. It always works for me anyways.

  32. Got the python script working after a few modifications…i just had to 1) set a different serial read timeout before and after getting the “ok” from the arduino and 2)adding a delay before sending the “ok” from the arduino once its reset on connection..this was needed for me as the script would take time to load on my net-book(yeah i know i shouldn’t be using it) and miss the “ok” signal somehow……..

  33. when running from terminal the print statements refuse printing after a certain “linkMsg=”” any workaround ?

  34. Cristhian Carrascal says:

    Hi, i’m using a EasyDriver, Arduino Mega and a Stepper motor Nema 17, I change the value MAX_VELOCITY = 100, so the motor runs faster for the test, and I’m using mm as units, in LinuxCNC i try the axis manually but I got an error in X axis when i reach 12.0 says that “Joint 0 Limit Switch Error”, this is the configuration for X axis:

    [AXIS_0]
    TYPE = LINEAR
    HOME = 0.0
    MAX_VELOCITY = 100.0
    MAX_ACCELERATION = 30.0
    STEPGEN_MAXACCEL = 37.5
    SCALE = 1.0
    FERROR = 1
    MIN_FERROR = .25
    MIN_LIMIT = -400.0
    MAX_LIMIT = 400.0
    HOME_OFFSET = 0.0

    What values I have to change in the Arduino Program or in the my-mill.ini to avoid the limit of 12.0? or you have standar values for my configuration Arduino Mega+EasyDriver+Nema17

    Thanks for your help

    • Cristhian Carrascal says:

      Hi, I found the Virtual Switch in Arduino Programm…
      Now I have another problem, when I test the X axis the motor move smoothly, but the Y axis and Z axis Vibrate, I change X axis for the Y axis in Arduino and EasyDriver but i have the same problem, so I need to know if there something else in my_mill.ini that I have to change.
      Thanks for your help.

      • dewy721 says:

        Sounds like Y and Z might have a crossed wire on the stepper motors. (Moves in a jerky manner.) Try swapping two of the wires on your Y axis and test it. If that works them do the same for Z.

      • Cristhian Carrascal says:

        Thanks for you reply, but it’s not the wiring because I used the same motor, the same EasyDriver and the same pins in Arduino (Changing the program), it seems to be something in the arduino program when it receives the commands from LinuxCNC, I commented all the lines of MaxSpeed leaving them constant and that works but I lost some quality, i’m still trying to understand the program

      • dewy721 says:

        *Hmm, try this…* *In modAccelStepper* *Change:* * * #if stepperY AccelStepper stprY(1, 40, 42); #endif #if stepperZ AccelStepper stprZ(1, 35, 33); #endif

        To: #if stepperY AccelStepper stprY(1, 40, 42); stprY.setMinPulseWidth(100); // Time in microseconds. #endif #if stepperZ AccelStepper stprZ(1, 35, 33); stprZ.setMinPulseWidth(100); // Time in microseconds. #endif

        See if that helps.

  35. arne says:

    Hey a big !thank you! for all the people who worked on this nice project. I am using Linuxcnc Version 2.5.0 and Accelstepper Library 1.37 and an Arduino Uno. I recently tried to reproduce your methods and got in a bit of trouble very similar to edu:

    If i run Axis GUI it won’t start displaying the following error:

    Print file information:
    RUN_IN_PLACE=no
    LINUXCNC_DIR=
    LINUXCNC_BIN_DIR=/usr/bin
    LINUXCNC_TCL_DIR=/usr/lib/tcltk/linuxcnc
    LINUXCNC_SCRIPT_DIR=
    LINUXCNC_RTLIB_DIR=/usr/realtime-2.6.32-122-rtai/modules/linuxcnc
    LINUXCNC_CONFIG_DIR=
    LINUXCNC_LANG_DIR=/usr/share/linuxcnc/tcl/msgs
    INIVAR=inivar
    HALCMD=halcmd
    LINUXCNC_EMCSH=/usr/bin/wish8.5
    LINUXCNC – 2.5.0
    Machine configuration directory is ‘/home/arne/linuxcnc/configs/my-mill’
    Machine configuration file is ‘my-mill.ini’
    INIFILE=/home/arne/linuxcnc/configs/my-mill/my-mill.ini
    PARAMETER_FILE=emc.var
    TASK=milltask
    HALUI=halui
    DISPLAY=axis
    Starting LinuxCNC…
    Starting LinuxCNC server program: linuxcncsvr
    Loading Real Time OS, RTAPI, and HAL_LIB modules
    Starting LinuxCNC IO program: io
    emc/iotask/iocontrol.cc 751: can’t load tool table.
    Starting HAL User Interface program: halui
    Shutting down and cleaning up LinuxCNC…
    Killing task linuxcncsvr, PID=7212
    Removing HAL_LIB, RTAPI, and Real Time OS modules
    Removing NML shared memory segments
    Cleanup done

    Debug file information:
    Can not find -sec MOT -var MOT -num 1
    Can not find -sec IO -var IO -num 1
    Can not find -sec LINUXCNC -var NML_FILE -num 1
    Can not find -sec EMC -var NML_FILE -num 1
    Waiting for component ‘Hal2Arduino’ to become ready…………………….
    Traceback (most recent call last):
    File “/usr/bin/axis”, line 3078, in
    vcpparse.create_vcp(f, comp)
    File “/usr/lib/pymodules/python2.6/vcpparse.py”, line 177, in create_vcp
    read_file()
    File “/usr/lib/pymodules/python2.6/vcpparse.py”, line 47, in read_file
    doc = xml.dom.minidom.parse(filename)
    File “/usr/lib/python2.6/xml/dom/minidom.py”, line 1918, in parse
    return expatbuilder.parse(file)
    File “/usr/lib/python2.6/xml/dom/expatbuilder.py”, line 922, in parse
    fp = open(file, ‘rb’)
    IOError: [Errno 2] No such file or directory: ‘custompanel.xml’
    9924
    PID TTY STAT TIME COMMAND
    10008
    PID TTY STAT TIME COMMAND
    10008 ? S 0:00 milltask -ini /home/arne/linuxcnc/configs/my-mill/my-mill.ini
    PID TTY STAT TIME COMMAND
    Stopping realtime threads
    Unloading hal components
    Traceback (most recent call last):
    File “/home/arne/Desktop/my-mill/HAL2Arduino-0.4.py”, line 2002, in
    commandHandler(str(listOfCommands), str(listOfAxis))
    File “/home/arne/Desktop/my-mill/HAL2Arduino-0.4.py”, line 1173, in commandHandler
    sleep(0.001)
    KeyboardInterrupt

    Kernel message information:
    [ 4884.063132] I-pipe: Domain RTAI registered.
    [ 4884.063138] RTAI[hal]: mounted over IPIPE-NOTHREADS 2.6-03.
    [ 4884.063140] RTAI[hal]: compiled with gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5) .
    [ 4884.063238] RTAI[hal]: mounted (IPIPE-NOTHREADS, IMMEDIATE (INTERNAL IRQs DISPATCHED), ISOL_CPUS_MASK: 0).
    [ 4884.063241] PIPELINE layers:
    [ 4884.063243] fd815e20 9ac15d93 RTAI 200
    [ 4884.063246] c085cb20 0 Linux 100
    [ 4884.080922] RTAI[malloc]: global heap size = 2097152 bytes, .
    [ 4884.081573] RTAI[sched]: IMMEDIATE, MP, USER/KERNEL SPACE: , kstacks pool size = 524288 bytes.
    [ 4884.081578] RTAI[sched]: hard timer type/freq = APIC/16667158(Hz); default timing: periodic; linear timed lists.
    [ 4884.081582] RTAI[sched]: Linux timer freq = 250 (Hz), TimeBase freq = 2400477000 hz.
    [ 4884.081585] RTAI[sched]: timer setup = 999 ns, resched latency = 2943 ns.
    [ 4884.081693] RTAI[usi]: enabled.
    [ 4884.107406] RTAI[math]: loaded.
    [ 4884.303179] tty_port_close_start: count = -1
    [ 4899.578278] RTAI[math]: unloaded.
    [ 4899.592931] SCHED releases registered named ALIEN RTGLBH
    [ 4899.657269] RTAI[malloc]: unloaded.
    [ 4899.757011] RTAI[sched]: unloaded (forced hard/soft/hard transitions: traps 0, syscalls 0).
    [ 4899.759356] I-pipe: Domain RTAI unregistered.
    [ 4899.759469] RTAI[hal]: unmounted.

    Any suggestions?
    Arne

    • dewy721 says:

      Hmm, looks like a connection issue. Open the HAL2Arduino-0.4.pyfile with a text editor and make sure the comport label scheme matches your machine.

      Go line 2128 and edit “/dev/ttyACM” to match your device label scheme. (For my setup, my arduino(s) appear as /dev/ttyACM0~/dev/ttyACM7).

      By default it will search/interrogate any arduino on ports /dev/ttyACM0~/dev/ttyACM10 (search range can be configured on line# 56).

      Also Note: It may be possible for a rouge serial connection such as another Arduino (non-HAL2Arduino) lurking about to confuse the HAL2Arduino-0.4.pyscript, causing it to bork.

  36. arne says:

    Hey dewy thanks for the fast answer, I tried your solution but all I get is: “Connection error – Please reload the host application”.

    Print file information:
    RUN_IN_PLACE=no
    LINUXCNC_DIR=
    LINUXCNC_BIN_DIR=/usr/bin
    LINUXCNC_TCL_DIR=/usr/lib/tcltk/linuxcnc
    LINUXCNC_SCRIPT_DIR=
    LINUXCNC_RTLIB_DIR=/usr/realtime-2.6.32-122-rtai/modules/linuxcnc
    LINUXCNC_CONFIG_DIR=
    LINUXCNC_LANG_DIR=/usr/share/linuxcnc/tcl/msgs
    INIVAR=inivar
    HALCMD=halcmd
    LINUXCNC_EMCSH=/usr/bin/wish8.5
    LINUXCNC – 2.5.0
    Machine configuration directory is ‘/home/arne/linuxcnc/configs/my-mill’
    Machine configuration file is ‘my-mill.ini’
    INIFILE=/home/arne/linuxcnc/configs/my-mill/my-mill.ini
    PARAMETER_FILE=emc.var
    TASK=milltask
    HALUI=halui
    DISPLAY=axis
    Starting LinuxCNC…
    Starting LinuxCNC server program: linuxcncsvr
    Loading Real Time OS, RTAPI, and HAL_LIB modules
    Starting LinuxCNC IO program: io
    emc/iotask/ioControl.cc 751: can’t load tool table.
    Starting HAL User Interface program: halui
    Wait, something is not right here.
    Shutting down and cleaning up LinuxCNC…
    Killing task linuxcncsvr, PID=1835
    Removing HAL_LIB, RTAPI, and Real Time OS modules
    Removing NML shared memory segments
    Cleanup done

    Debug file information:
    Can not find -sec MOT -var MOT -num 1
    Can not find -sec IO -var IO -num 1
    Can not find -sec LINUXCNC -var NML_FILE -num 1
    Can not find -sec EMC -var NML_FILE -num 1
    Waiting for component ‘Hal2Arduino’ to become ready…………………………………………………………………………………………………………………………………………………………………………………………………………………………….
    custom.hal:2: /home/arne/Desktop/my-mill/HAL2Arduino-0.4.py exited without becoming ready
    1835
    PID TTY STAT TIME COMMAND
    Stopping realtime threads
    Unloading hal components

    I noticed the first command you suggested was not in the line you mentioned. In my Hal2Arduino-0.4.py file the command “dev/tty/ACM” was in line 1970. Do I use a non up to date version?

    Ah and I restarted my computer, changed the file to “executable” just like edu did. I am a bit concerned as the error message “emc/iotask/ioControl.cc 751: can’t load tool table.” did not occur at edu’s problem.

    • dewy721 says:

      More than likely *I’m* looking at the wrong version of the file. I have a ton of them in various slightly different states of development. I keep backups but it’s a messy affair, I often get lost looking for anything older than the actual live copy I’m working on. (Bare in mind that my “Live copy” hasn’t been looked at for months, as I’m in college atm.)

      The tool table is not part of HAL2Arduino, the log is telling about a separate problem.

      If I recall the tool table is actually a text file that EMC2 looks at during program start. The log mentions that in the file “emc/iotask/ioControl.cc” [line#]751 it cant properly read or even find the “tool.tbl” file. Try looking for it manually, should be found at: “/home/arne/linuxcnc/configs/tool.tbl” use a text editor and see if the file looks ok.

      • arne says:

        Ok, thanks! Fixed the line 751 issue by copying the tool.tbl file into /home/arne/linuxcnc/configs/my-mill folder. Updated Linuxcnc Version 2.5.0 to Linuxcnc 2.5.3. Only problem remaining is the following

        Print file information:
        RUN_IN_PLACE=no
        LINUXCNC_DIR=
        LINUXCNC_BIN_DIR=/usr/bin
        LINUXCNC_TCL_DIR=/usr/lib/tcltk/linuxcnc
        LINUXCNC_SCRIPT_DIR=
        LINUXCNC_RTLIB_DIR=/usr/realtime-2.6.32-122-rtai/modules/linuxcnc
        LINUXCNC_CONFIG_DIR=
        LINUXCNC_LANG_DIR=/usr/share/linuxcnc/tcl/msgs
        INIVAR=inivar
        HALCMD=halcmd
        LINUXCNC_EMCSH=/usr/bin/wish8.5
        LINUXCNC – 2.5.3
        Machine configuration directory is ‘/home/arne/linuxcnc/configs/my-mill’
        Machine configuration file is ‘my-mill.ini’
        INIFILE=/home/arne/linuxcnc/configs/my-mill/my-mill.ini
        PARAMETER_FILE=emc.var
        TASK=milltask
        HALUI=halui
        DISPLAY=axis
        Starting LinuxCNC…
        Starting LinuxCNC server program: linuxcncsvr
        Loading Real Time OS, RTAPI, and HAL_LIB modules
        Starting LinuxCNC IO program: io
        Starting HAL User Interface program: halui
        Wait, something is not right here.
        Shutting down and cleaning up LinuxCNC…
        Killing task linuxcncsvr, PID=4853
        Removing HAL_LIB, RTAPI, and Real Time OS modules
        Removing NML shared memory segments
        Cleanup done

        Debug file information:
        Can not find -sec MOT -var MOT -num 1
        Can not find -sec IO -var IO -num 1
        Can not find -sec LINUXCNC -var NML_FILE -num 1
        Can not find -sec EMC -var NML_FILE -num 1
        Waiting for component ‘Hal2Arduino’ to become ready……………………………………………
        custom.hal:2: /home/arne/Desktop/my-mill/HAL2Arduino-0.4.py exited without becoming ready
        4853
        PID TTY STAT TIME COMMAND
        Stopping realtime threads
        Unloading hal components

      • arne says:

        Oh and I found out, that when I change the Hal2Arduino-0.4.py file to its original state with the “/dev/ttyACM” command I get a completely different debug information which I think looks more promising:

        Print file information:
        RUN_IN_PLACE=no
        LINUXCNC_DIR=
        LINUXCNC_BIN_DIR=/usr/bin
        LINUXCNC_TCL_DIR=/usr/lib/tcltk/linuxcnc
        LINUXCNC_SCRIPT_DIR=
        LINUXCNC_RTLIB_DIR=/usr/realtime-2.6.32-122-rtai/modules/linuxcnc
        LINUXCNC_CONFIG_DIR=
        LINUXCNC_LANG_DIR=/usr/share/linuxcnc/tcl/msgs
        INIVAR=inivar
        HALCMD=halcmd
        LINUXCNC_EMCSH=/usr/bin/wish8.5
        LINUXCNC – 2.5.3
        Machine configuration directory is ‘/home/arne/linuxcnc/configs/my-mill’
        Machine configuration file is ‘my-mill.ini’
        INIFILE=/home/arne/linuxcnc/configs/my-mill/my-mill.ini
        PARAMETER_FILE=emc.var
        TASK=milltask
        HALUI=halui
        DISPLAY=axis
        Starting LinuxCNC…
        Starting LinuxCNC server program: linuxcncsvr
        Loading Real Time OS, RTAPI, and HAL_LIB modules
        Starting LinuxCNC IO program: io
        Starting HAL User Interface program: halui
        Starting TASK program: milltask
        Starting DISPLAY program: axis
        waiting for s.axes
        waiting for s.axes
        waiting for s.axes
        waiting for s.axes
        waiting for s.axes
        waiting for s.axes
        waiting for s.axes
        Shutting down and cleaning up LinuxCNC…
        Killing task linuxcncsvr, PID=5172
        Killing task milltask, PID=5269
        Found device on /dev/ttyACM0
        Asking for firmware info.
        Firmware: HAL-2-Arduino
        Unit: ’0′
        Version: 0.4
        comThread: port=/dev/ttyACM0 arrayPos:0 Queue:0x9deac4c
        makePins: creating: ‘axis_0_home-sw-in’
        makePins: creating: ‘axis_0_joint-pos-cmd’
        makePins: creating: ‘axis_0_joint-vel-cmd’
        makePins: creating: ‘axis_0_pos-lim-sw-in’
        makePins: creating: ‘axis_0_neg-lim-sw-in’
        makePins: creating: ‘axis_1_home-sw-in’
        makePins: creating: ‘axis_1_joint-pos-cmd’
        makePins: creating: ‘axis_1_joint-vel-cmd’
        makePins: creating: ‘axis_1_pos-lim-sw-in’
        makePins: creating: ‘axis_1_neg-lim-sw-in’
        makePins: creating: ‘axis_2_home-sw-in’
        makePins: creating: ‘axis_2_joint-pos-cmd’
        makePins: creating: ‘axis_2_joint-vel-cmd’
        makePins: creating: ‘axis_2_pos-lim-sw-in’
        makePins: creating: ‘axis_2_neg-lim-sw-in’
        commandList=['']
        linkData=”
        listOfPorts=['/dev/ttyACM0']
        listOfCommands=['215 224 226 231 233']comService: started.

        listOfAxis=['0 1 2']
        listOfUnits=['0']
        linkMsg=”
        comThread: Received 231 1 1 233
        comThread: Received 231 2 1 234;
        commandHandler: received 231 1 1 233
        commandHandler: interpreted as 231 1 1 233
        commandHandler: checkSum passed
        commandHandler: Got 231 1 1 233
        commandHandler: received 231 2 1 234;
        commandHandler: interpreted as 231 2 1 234
        commandHandler: checkSum passed
        commandHandler: Got 231 2 1 234
        Removing HAL_LIB, RTAPI, and Real Time OS modules
        Removing NML shared memory segments
        Cleanup done

        Debug file information:
        Can not find -sec MOT -var MOT -num 1
        Can not find -sec IO -var IO -num 1
        Can not find -sec LINUXCNC -var NML_FILE -num 1
        Can not find -sec EMC -var NML_FILE -num 1
        Waiting for component ‘Hal2Arduino’ to become ready……………………………………………………………………………..
        Traceback (most recent call last):
        File “/usr/bin/axis”, line 3078, in
        vcpparse.create_vcp(f, comp)
        File “/usr/lib/pymodules/python2.6/vcpparse.py”, line 177, in create_vcp
        read_file()
        File “/usr/lib/pymodules/python2.6/vcpparse.py”, line 47, in read_file
        doc = xml.dom.minidom.parse(filename)
        File “/usr/lib/python2.6/xml/dom/minidom.py”, line 1918, in parse
        return expatbuilder.parse(file)
        File “/usr/lib/python2.6/xml/dom/expatbuilder.py”, line 922, in parse
        fp = open(file, ‘rb’)
        IOError: [Errno 2] No such file or directory: ‘custompanel.xml’
        5172
        PID TTY STAT TIME COMMAND
        5269
        PID TTY STAT TIME COMMAND
        Stopping realtime threads
        Unloading hal components
        Traceback (most recent call last):
        File “/home/arne/Desktop/my-mill/HAL2Arduino-0.4.py”, line 2002, in
        commandHandler(str(listOfCommands), str(listOfAxis))
        File “/home/arne/Desktop/my-mill/HAL2Arduino-0.4.py”, line 1173, in commandHandler
        sleep(0.001)
        KeyboardInterrupt

      • dewy721 says:

        Ok, cool. You got the HAL2Arduino bit working. But now the log file mentions that it can’t find another file, this time the ‘custompanel.xml’ file has gone AWOL. check for the existance of said /home/arne/Desktop/my-mill/custompanel.xml file.

        Btw, you can some further debug&runtime info by opening up a console and executing the following command: linuxcnc ~/Desktop/my-mill/my-mill.ini

        That way you can watch the conversation between the PC and Arduino(s) while its running.

      • arne says:

        Ok, i got the Axis GUI starting properly. The files custompanel.xml and custom_postgui.hal needed to be transferred to my machines working folder (/home/arne/desktop/my-mill) and custom_postgui.hal needed to be edited by commenting out lines 15 / 18 / 21 / 24. Test phase if everything is working will be starting soon. Big thanks again to dewy721 for his efforts!

      • dewy721 says:

        Your very welcome. It’s always rewarding to see the effort of just one person benefiting so many others as well. :)

        Good luck with it, and let me know if you get stuck.

  37. arne says:

    Okay, I did it, and it just works fine! You made me quite happy with this solution! Dewy would you mind writing me an email?

  38. arne says:

    Okay another question, because I got stuck: After first hardware tests in the last days, I figured x-axis is only turning in one direction. For example when I click the + button above “reference run” everything works fine, when I click the – button the motor turns the same direction as when I click the + button. All the other axes are ok and turn both ways.

    • dewy721 says:

      Re-check your wires, Your driver might be stepping only one way due to the direction pin’s default [disconnected] power-on state. Check that the X-direction pin is indeed making contact. (The arduino blink example works good for ‘meter-checking’ that.) Also, make sure that step-rate for the arduino is set to the settings used by the old setup. I’ve overlooked that one several times myself.

      I haven’t changed anything with the accelStepper code between versions. So it should behave exactly the same there.

  39. arne says:

    Crazy, checked the wires, everything looks ok. For a good reason I used plugs instead of soldering every single cable. So I switched x and y axes. The same problem occured on y axis. Then I designated other pins (used 1-6): Use 2-7 now and everything works fine. Thanks again to Dewy our Hard- and Software expert :).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 31 other followers

%d bloggers like this: