HAL2Arduino 0.5 – Released.

Happy Holidays everyone! :D

With that said, I would like to introduce you to a new version of HAL2Arduino version 0.5.

Our shiny new version has added support for:

  • Quadrature encoders for precise position control.
  • PID Servo control. For fine grain tuning.
  • Basic Jog Wheel support.
  • Internal and/or external feedback support. Allows servos/steppers to auto-correct positional errors.

Improvements:

  • Faster PC-Host side script.
  • Lock-step synchronization between microcontroller clients.

In the pipe-line:

  • I2C support for mcp23017 IO expander chips. To allow up to 112 additional pins, per client. Very useful for matrix keypads.
  • Analog joystick input. Some people prefer these to jog wheels, especially scrap-bot builders.
  • User definable M-Codes. This will allow users to add special commands right in to their G-Code that can signal the microcontroller(s) to perform specific tasks. (Like ‘Brew Coffee’, ‘tweet when complete’ etc.)

Enjoy the holidays.

dewy721

About these ads

21 Responses to HAL2Arduino 0.5 – Released.

  1. Adam says:

    Thank you for your holiday gift for us. Your work is very important for me for connecting LINUXCNC and complicated 3d printer that I build.
    Adam

  2. arne says:

    Another big thank you from me for your holiday gift :) I’ll test it soon :) 2014 looks more interesting now :)

  3. arne says:

    Hi Dewy,

    tried out the Hal 0.5 version today, and it works fine. But I had to comment out lines 52-54 of the custom.hal file in my working directory:

    net getXspeed Hal2Arduino.axis_0_joint-vel-cmd
    net getXspeed Hal2Arduino.axis_1_joint-vel-cmd
    net getXspeed Hal2Arduino.axis_2_joint-vel-cmd

    As these lines were in the 0.4 version, I wonder why there is the need to comment them out.

    If not commented out the error file says: custom.hal:52: Pin ‘Hal2Arduino.axis_0_joint-vel-cmd’ does not exist 9041

    Best regards
    Arne

    • dewy721 says:

      Sorry, I at some point had been experimenting with remote velocity control. While it is supported; I concluded that the additional expense was less productive than just re-tuning the host-side script to update faster. (I forgot to remove it from the .hal file.)

      Many thanks Duane

  4. Gava says:

    Hi, congratulations on your work is really excellent

    My question is whether there is any pin came out for handling the spindle motor?

    I might say that part of the programming is in located?

    Thank you.

    • dewy721 says:

      The code for it has not been made yet. Hence there is no pin assignment for it.

      However, the framework is in place to add it easily.

      Spindle codes are 129~138 and ideally they would be called from line #63 under the ‘program’ tab.

      From there, perhaps a function call could be crafted to accept 2 variables: SindleAxis and SpindleData (aka. RPM).

      Something like:

       byte spindleOutputPin={3,5,6,9,10,11}; // Six separate spindles for example. (ie. Turret lathe.) 
      #define spindleDriveType pwm 
      #define ratedSpindleSpeedMin 0 
      #define ratedSpindleSpeedMax 3260 // A common U.S. single-phase 120vac/60hz motor speed. 
      #define spindlePwmMin 50 // minimum power to rotate spindle. 
      #define spindlePwmMax 255 // full speed. 
      
      void setSpindleSpeed(byte axis, long speed){
         storedSpindleSpeed[axis]=speed;
         if(spindleEnabled[axis] && spindleDriveType==pwm){ // Did we receive code 133 to enable this spindle? // To be set by some other hypothetical function.
           byte spindleOutput=constrain(map(speed,ratedSpindleSpeedMin,ratedSpindleSpeedMax,spindlePwmMin,spindlePwmMax),spindlePwmMin,spindlePwmMax);
           analogWrite(spindleOutputPin[axis],output); // Apply the value to the motor drive pin.
         }else{
           // spindle is disabled, so do nothing here.
         }
       }
      

      I will try to get it added into the next release, this weekend.

      On Thu, Jan 30, 2014 at 10:24 PM, Emc2Arduino

  5. Robert Burns says:

    I am looking to use a Mega 2560 and RAMPS 1.4 with LinuxCNC, Will HAL2Arduino or EMC2Arduino do that?

    • dewy721 says:

      While yes, it ‘can’ be made to work for basic 3axis control (think simple router table).

      If you already own a mega2560 and just want make use of it that’s not a bad idea at all.

      However, if you’re still shopping for a microcontroller there is a much better solution for the same amount of money. For example the “BeagleBone Black” from beagleboard.org is the same price and can run LinuxCNC right on the microcontroller itself, which is a huge speed boost.

      • Robert Burns says:

        yes,BBB is cheap, but the io capes are like $150-$180. I’d like to get my feet wet with linuxCNC before buying one if possible….and practicable.

        a Deltabot would not be basic 3 axis though. I have the 2560/ramps combo, but it is underpowered cpu/memory wise for a kossel. I want to try EMC2Arduino, but I don’t know what have the stuff the config is asking for is, much less what to set them to. All the pin configs and such are kept in parts of the firmware the user never has to modify.

        I posted a thread on the Deltabot Google Group to see if someone more experienced then me would take a whack at it. I think there are a ton of people there running Marlin or Repetier that would love to run linuxCNC.

        I saw how helpful you are on shapeko and other CNC forums, My hope is you can help our group the same.
        -GRB352

      • dewy721 says:

        Well, actually HAL2Arduino is just a bridge to get linuxcnc to talk to an arduino. Effectively what it does is listen to a serial stream (ticker-tape style) for commands from a pc running linuxcnc.

        With that in mind, it’s not realtime. There is about a 10~50ms lead-time for communications overhead.

        With that said however, it does use the accelstepper library for movement.

        Some of its features: Has user selectable modules, cut out the stuff you don’t want. Allows ganging multiple arduinos to one pc. Each arduino can be configured to handle different sections of the machine. Can support multiple slave machines. (Farming) Supports multiple arduino types simultaneously, tested so far: Uno, Mege2560 and Due.

        Compared to the Uno & 2560, the Due will run circles around them. Uno = Run up to two steppers. Best used for buttons/lcds, not much else. 2560 = 3 steppers ok, 4 at best. Due = 9 or more steppers + cpu power to spare for encoder feedback etc.

        There are way too many configuration options to offer you any ‘silver bullet’ “copy & paste” config.

        The version I’m slowly developing (0.6a) as time permits (fulltime job +2hr commute +family +active developer for PocketNC.com) will adapt to varying speed/acceleration that linuxcnc likes to throw around. This solves a studdering issue that earlier versions have where the arduino races into a slowly moving set of coordinates, stops, races to the next coordinates, stops, repeat.

        So in a nut-shell if you like modifying code then HAL2Arduino might be what your looking for, however if your seeking a silver bullet solution then what your after is still yet beyond the level of what H2A currently is at the moment.

        Although, if your intent on running linuxcnc you’ll still have to roll up your sleeves and get your hands dirty, hand editing files regardless.

        The BBB can run generic stepper driver boards, can be loaded linuxcnc on-board and can also run the pc-side of H2A to control one or more arduinos. But the learning curve is high.

        That’s really the best answer I can provide you at the moment, since I don’t have a delta bot myself. That is unless you really, really wanna send me one to develop with that is. ;)

        On Wed, May 28, 2014 at 5:15 AM, Emc2Arduino wrote:

        >

      • dewy721 says:

        Oh, and a far as EMC2Arduino. Its depreciated as I haven’t looked at that code for over a year now.

  6. Jose San says:

    Hi Dewy, I am using a Arduino Uno board but I have problems. I could start linuxCNC. It works but I don’t have communication with arduino board through the serial port. The lights Rx y Tx don’t turn on when I put play in the program and the motors don’t work too. I just changed the digital outputs for stepPin and dirPin for each motor in the program modAccelStepper but I don’t know what should do it now.

    • dewy721 says:

      Hello Jose, I’m sorry for taking so long to respond. (Been buried with a new job, cnc collaboration project and helping Wife with med-school.) *:-)

      The problem is that the link between the computer running Linux and the Arduino are not talking.

      Try the following:
      Install the Arduino IDE for Linux and see if you can upload/run the “blink” sketch. This will verify that Linux has the ability to link with it.

      Let me know if you can get that established so I can help you further.

      I’ll try to respond faster this time tho. ;)

      • Don´t worry Dewy,

        I probed with 0.4 version and it works well. I have some problem with the continue speed but I hope to resolve that reducing the baud rate.

        Thanks for you reponse. Bye

  7. Adrien G. says:

    Hi,
    I’m a part of a FRENCH robotic club and I want to try H2A to run our CNC on USB with a laptop.
    I just have a doubt on the right card I have to choose. I want to manage 3 steppers, a LCD, 5 relays, 5 buttons and 3 sensor inputs (home position). I want to stay with an Arduino board. Is a Mega is sufficient or I should buy a Due board ?
    I’m quite new in arduino world but I’m familiar with PIC uC and C language so I’m not afraid to have hands dirty ;)
    Thank you !

    • Duane Bishop says:

      Hello Adrien, It is nice to hear from someone in Europe again. :)

      An Arduino Mega2560 could do what you want, and it is better supported by the community than the Arduino Due.

      However, the Arduino Due would be slightly faster than a Mega2560 for moving 3 steppers.

      With 4 or more steppers the Mega2560 will become slower for each additional stepper, this is where the Due becomes the better choice.

      Either way, H2A supports multiple simultaneous Arduino connections (even different kinds) at the same time. You could have one Arduino running an entire machine, or several Arduinos working to run the machine, together in concert.

      I have tested the Uno, Mega2560 and the Due. I can say that I know that all 3 or these will work, possibly other types as well.

      One performance challenge for you will be the LCD screen, the library for using the LCD is considered of a “blocking” type of code. It will cause the Arduino “wait for completion” and/or not allow it to move in a smooth fashion when updating the screen. I have tried to accommodate for this by setting the LCD updates to an IDLE priority. But the best solution would be to use a dedicated Arduino just for the LCD. That way all the motion control is smooth and proper.

      If you have yet to buy a uC, and can write some code…. I have been working on a newer project using the more powerful “BeagleBone Black” (same price as Mega2560/Due) to both run LinuxCNC AND move the steppers!

      The BBB can be found at http://beagleboard.org/
      The software at http://blog.machinekit.io/
      The new project I am working on is at http://www.pocketnc.com/

      • Adrien G; says:

        Thank you very much for your reply !
        I will buy an extra UNO board for the lcd screen, just to be sure. For now I still want to keep a computer to manage our CNC.

        I looked at your new project, it’s amazing ! Well designed, cute, I will follow this new project closely and share it with my friends !

      • Adrien G says:

        Hi,

        I received everything and I make some tests since a few day : it’s working !!

        Now I want to add some panel controls, a file “modControls” exists, but it is not complete, is that correct ?

        The Arduino software seems clear and pretty easy to modify, but and the python script it’s not that clear to me. So, for an “estop-indicator”, what should I do ?

        In HAL2Arduino-0.5.py, add a command like :
        if command = 320:
        c['ioncontrol_estop-indicator'] = val

        and after :
        if codesAcceptes.find(“320″) > -1:
        if simulation == True
        printf “creating : ioncontrol_estop-indicator”
        else:
        print “makePins: creating: %r % pinLabel
        c.newpin(“ioncontrol_estop-indicator”,hal.HAL_BIT,hal.HAL_OUT)
        Is that ok ?

        After, I should add something in custom.hal, but everything I have tried provokes an “KeyboardIterrupt, Error in sys.excepthook”

        Thanks

        Adrien G.

  8. dewy721 says:

    Its just a wordpress blog. There free from wordpress.com :)

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: