Making progress…

For my friends and family that have been wondering what I’ve been working on these past months.

As we are nearing the roll-out our kick-starter campaign, I’m proud to finally be able to show-off something that my friends & I have been working so very hard to make a reality….


36 Responses to Making progress…

  1. Brian Everett says:

    Thanks for your mail, I am trying to locate software that will drive my 3d printer’s Arduino ramps electronics as a CNC stepper controller, my printer is a conversion from it’s original status as an experimental light duty milling machine and now wish to use it in both guises without re-flashing the memory each time. Having written a Gcode program to mill my printing table (5mm aluminium) when it gets distorted by abuse or accident I found that works fine with the printer software using X, Y & Z axis’s with no complicated or special codes, so PCB tracking and drilling can be done at present, some G & M codes are changed in Marlin firmware for printing use so their correct CNC use is out.

    My query is about your Emc2 work, can this be used with an Arduino/ramps set-up and does it need re flashing to do so, I have a second Arduino mega so I could flash that and attach the ramps on it Β to attain the emc2 capability if ramps is compatable. I apologise for disturbing you and hope you can spare the time to answer this trivia.Β  I thank you in anticipation, My best regards.Β Brian Everett.

  2. dewy721 says:

    Actually, EMC2Arduino is the defunct predecessor of HAL2Arduino.

    Both of them only act as breakout interfaces for LinuxCNC. HAL2Arduino is highly modular, supports mods as plugins. Just like the older EMC2Arduino it requires some manual configuration to get it going. Neither are g-code interpreters, they just act as raw IO connections for a PC running Linuxcnc. But you could run 200+ Arduinos (running HAL2Arduino) off of one PC, each Arduino could be customized on a per-task basis.

    If you can program, you’ll want HAL2Arduino anyways. It gives room for adaptations; ie: adding a custom set of g/m-codes then internally switch profiles from additive to subtractive machining.

    It’s written in such a way that you can opt-in/out whole sections of code to permit you to tailor it to exactly what you need.

    Comparing Marlin to HAL2Arduino is like comparing a Ferrari to the whole trucking industry. One is nearly a turn-key solution that is polished, and shines well in 3d-printer racing circles. The other, could use one truck haul a dozen Ferrari’s; while another paves the road, while yet another carries away the construction debris, others could be dressed up as a car haulers, wreckers, Mad Max tankers, Oscar Meyer Weiner mobiles, you name it.

    Essentially, while you ‘could’ give HAL2Arduino a split personality and make it do both, the Marlin firmware is much better at the one thing that it does, hands down.

    But I digress, probably the best solution would be to write a much simpler python script to handle g-code files and parse them to make LinuxCNC temporarily act as a 3d-printer and/or mill as needed (on the fly). Then use HAL2Arduino (as many as you like) to physically handle the hardware of the machine. That would give you the ability to do hybrid machining with additive AND subtractive machining. Heck, you could throw in a plasma cutter and a mig welder as well if you’re into it enough. πŸ˜‰

    So for Frankenstien-machines, HAL2Arduino is the answer, but you’ll HAVE to hack into it.

    PS, one the pins are configured, RAMPs (or any other arduino-compatible) stepper driver setup is compatible with HAL2Arduino, if it’s not, send me one to develop code against and then it will be. πŸ˜‰

  3. Alex Chiosso says:

    Hi ….
    Very nice project your PocketNC , just amazing.
    One information (or two πŸ™‚ ) is the module HAL2Arduino 0.5 the last version available ?
    Is there a specific hardware module (Arduino xxx + additional custom hardware) that I can try/buy
    to test the functionalities.



  4. dewy721 says:

    Well thank you for the compliment, I’ll pass them onto Matt & Michelle over at
    They are the one’s that make such well crafted hardware. I’m just helping with a little coding.

    The last (beta) version is 0.6 and while it’s faster but very, very touchy about how to configure it.

    There is no specific hardware built expressly for HAL2Arduino since by design, it is meant to be edited by the user to meet their own hardware layout.
    For example: You could get pretty much any run of the mill stepper drivers for adafruit, sparkfun, pololu, panucatt, even gecko drivers and configure HAL2Arduino to use them. Throw in some momentary switches, and you have a basic controller for converting old shop machinery to cnc machinery.

  5. M. Barsalou says:

    I had the Hal-2-Arduino interface working, but not it doesn’t seem to work any more….connecting directly to the Arduino to issue commands (EX 996 0 0 996) provides no output whatsoever.

    I’ve loaded GRBL to the arduino and was able to turn a motor, so it is something specific to the Hal-2-Arduino code on the Arduino.

    What sort of troubleshooting hints can you provide?

    I’m using 0.6d that you had provided. It was the one that was working for me.

    It does give me an ‘ok’ when I connect directly to the Arduino using minicom.

    Thanks for any ideas or thoughts on the matter.

    • M. Barsalou says:

      What a dork I am!!! I forgot the ; at the end of the command…. 996 0 0 996; is the valid command.

      So this is working as expected when talking directly to the Arduino through minicom (motor turns when issuing a command 224 0 10000 10224;)

      However, I get the error “linear move in MDI would exceed joint 0’s positive limit” when issuing G0 X13 in the MDI window after homing the axis.

      Have any thoughts on things to check?

      This did work at one time, and I haven’t modified any of the linuxcnc files since it was working.

      Thanks again for your time.

      • M. Barsalou says:

        I’m on a dork roll!!!!

        After poking around in the .ini file for linuxcnc, I noticed that the max limit was set to 8…so indeed I was issuing a command past the positive limit!!!

        All is well.

        I’m not sure when or how it got changed…that’s a different problem though.

  6. M. Barsalou says:

    Where is the best place to find information regarding what to set the unitspersecond, accelpersecond and leadtime values of the modaccelstepper module?

    I’m using pololu stepper motors (#1476) if that matters.

    Thanks for any thoughts.

  7. M. Barsalou says:

    Thanks for the guidance.

    It isn’t clear what to do with the numbers that come out of the motor calculator, and how they apply to unitspersecond, accelpersecond and leadtime values.

    So the code seems to work, but linuxcnc seems out of sync with the actual motors.

    What are the important elements to get linuxcnc and the driver on the arduino board to work together?

  8. dewy721 says:

    For unitspersecond you’ll need to figure out how much travel an axis has per revolution of its stepper motor shaft. Say the calculator spits out 3.72rev/sec and you’ve measured that your x-axis travels 1.35 inches per rev. The math is simply 3.72*1.35= 5.022 inches per second. That’s the bleeding-edge top-speed at full strength you can ever hope to get out of that particular stepper motor at that voltage. While you can go somewhat faster, you won’t get the full torque output stamped on the tin. πŸ˜‰

    accellpersecond depends on two things, A: how hefty your axis is. B: how much torque can you supply to move it. Force/Mass=Acceleration (in units per second) So if your X-axis weighs 12lbs and your motor/leadscrew(and/or belt) combo produces 5lbs of ‘push’ then the math breaks down to 12/5=2.4 units/sec max acceleration.

    Now for the leadtime. Er, leadtime? Where are you getting leadtime from?

  9. M. Barsalou says:

    Leadtime comes just after the settings for accelpersecond in the modAccelStepper code.

    Wasn’t sure if it was important.

  10. M. Barsalou says:

    What if I don’t know the weight and “push” of my axis? Is there a safe acceleration number? How will I know it is too much, or too little?

  11. dewy721 says:

    Too little and it will take forever to reach top speed, causing many rounded corners; too much and it’ll skip steps getting to speed and blow your work-piece dimensions.

    Super conservatively you could set it to just 33% of your top speed. That will make it take 3 seconds to reach max velocity. If you set it to your top speed it will take 1 second to go from ‘coffee break’ to ‘break-stuff’ speed. 200% would be 0.5secs to full throttle.

    I’d default to 100% and tweak from there for an unknown machine.

  12. M. Barsalou says:

    200 steps Per revolution – from motor spec
    2.6 revolutions per second – from calculator at

    X = travels 3.5 inches in one revolution
    Y = travels 8 inches in one revolution

    X stepsperunit = 200 steps goes 3.5 = 200/3.5 = 57.14
    Y stepsperunit = 200 steps goes 8 = 200/8 = 25

    X Unitspersecond = 3.5*2.6 = 9.1
    Y unitspersecond = 8 * 2.6 = 20.8

    X accelpersecond = 9.1 * .33 = 3
    Y accelpersecond = 20.8 * .33 = 6.86

    Does this look right?

    NOTE: I used your conservative value just to be clear that I understand things.

    • M. Barsalou says:

      I should have tested it before posting…those numbers did not work…the motors made sounds, but nothing moved…

      Obviously I’m misunderstanding something….

      • M. Barsalou says:

        Just to be thorough, these are the numbers that do work, but there are still problems with these numbers as well:

        x stepsperunit = 909
        y stepsperunit = 416

        X unitspersecond = 3
        Y unitspersecond = 6

        X accelpersecond = 2
        Y accelpersecond = 4

        I don’t remember off the top of my head how I came up with the stepsperunit numbers…but they are an order of magnitude different from the calculations shown in the previous comment.

        Also, I’m not sure I’ve matched up these entries with the ones that go into the linuxcnc entries very well….not sure I really understand how the two connect. So any help there would be appreciated as well.

  13. M. Barsalou says:

    Further contemplation made me realize that the reason the above numbers work is that the shield was set for 1/16 step, so if I use my first numbers above and include that value I get:

    X stepsperunit = 200 steps goes 3.5 = 200/3.5 = 57.14 * 16 = 915
    Y stepsperunit = 200 steps goes 8 = 200/8 = 25 * 16 = 400

    So it may just be the issue of getting these numbers ‘synced up’ with the linuxcnc software…then I’ll be in business.

    So again, your thoughts would be appreciated.

  14. dewy721 says:

    Ah, yeah… don’t feel bad I forgot about stepmode settings as well.

    Synced LinuxCNC settings:
    Actually, HAL2Arduino doesn’t connect at all to the step settings within 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.

    • M. Barsalou says:

      OK. I thought I would at least be able to match the drawing of the picture while linuxcnc works with the actual machine….

      So then we could just send the G-codes directly to the arduino and it would work the same?

      Doesn’t the linuxcnc software handle the trajectory planning?

      I was under the impression that it makes calculations based on the settings in the config files, then sends those to the machine.

      Or does the software on the arduino do path planning as well?

      I’m not sure how I decide if I have enough torque or not, and the micro-step settings were how I got the board.

    • M. Barsalou says:

      Are any of the other entries besides stepsperunit affected by the microstep mode? I assume not.

  15. jacouser says:

    Could you help in the configuration the Arduino to ramps 1.4? Thanks

  16. ejs says:

    Hi Duane,
    The PocketNC project is very cool. It’s about time someone hit on a subtractive machine that compliments desktop 3D printing. This video and some pieces of documentation have me wondering a couple things I hope you could help me understand.
    I’d like to convert my simple GRBL 3 axis mill into a 4 axis with tool changer. One question is whether your call to porting your work over to the Beagle Bone Black came to be. The thread in Machinekit’s Googlegroup is only about a year old. I spent a couple dozen hours last week trying to get some motor movement via Machinekit and HAL2Ard and only came across that Groups thread this morning. So I’m simultaneously wondering if it’s possible to get it working as HAL2Ard currently stands, and why it wouldn’t be just like any other implementation of LinuxCNC on a full fledged desktop.
    Second, I also see reference and pics of a 5-axis cape for the BBB on the PocketNC site. That leads me to ask if HAL2Ard was used for their project. Machinekit’s documentation makes it sound like 4 axes on a BBB is possible, but 5 would take some serious wizardry.
    Thanks for your time and efforts. I hope 6d is not the last we see of you in this arena.

    • Duane says:

      I think that all you would need to do to get HAL2Arduino to run on a BBB would be to choose which serial port you’d like to use. I have a prototype control panel built for it, logic level’d to a hardware serial port. But I haven’t had time to try and write code yet (two jobs, wife, new fixer-up truck, yada yada).

      Actually 5-axis motion on the BBB is cake since it’s main cpu can run the OS and its two mpu cores run at 200mhz. I think I recall the thread and if memory serves, 5-axis motion only requires “serious wizardry” if positioning encoders are involved.

  17. Classsic says:

    Hi, I really want to run mega 2560+ramps with linuxcnc, there is a .ini .hal base for that? And what about the pins config with mega 2560 and drivers. Thanks for all, but I think is good idea create a forum.

  18. dab says:

    Hi, I’m giving a try to hal2arduino 0.6b because I need to move just one axis other than 4 moved by a parallel port,but it doesn’t have to mill, neither is time critical.
    Since I really need to transmit wirelessly to this single motor, my question is: what about your progress with ethernet connection? is there something that I can try out?
    thanks, dab.

  19. dewy721 says:

    Well, with all honesty I haven’t written any code for it in nearly two years.

    But with that said; I do still have intentions of adding ethernet support. As soon as I can set my lab back up, that is.
    It’s been in boxes ever since I moved across country, helped some friends open their doors at and have been building machines non-stop ever since.

    But wireless to serial, hmm…. Shop around, I think there is some wireless serial links out there that would allow you to bypass the ethernet (and wifi) altogether. You’d have to tinker a bit I’m sure, but it would be the least troublesome after it’s all setup.

  20. dab says:

    Thank you very much for reply. I’d like to use a wireless bridge using two 2,4GHz NRF24L01, between two arduino.
    Which part of your code should I keep on the pc-side arduino?
    I tried yesterday with one axis over hal2arduino, and the movements start with almost 1 second of delay. Do you know if there’s room to enhance?
    at the end I should only pass 4 signals, if I understood correctly. axis.A.joint-pos-cmd, axis.N.joint-vel-cmd and then two signals for direction and velocity of XY (mmm, maybe 3).
    Do you have any suggestions?
    Thank you, dab.

    • Duane says:

      Actually, the axis.N.joint-vel-cmd is optional. You can define a max speed on the arduino and that would cut the required bandwidth by 50%.

      As far as the arduino to arduino data goes, I imagine you could have the pc arduino just pipe the data from the usb-link to the wireless-link. Set the remote arduino to use the wireless link like it sounds like you have done already.

      Laggy connection? Hmm, take a look at the wireless serial library your using, look for something like wireless.serial_timeout=1000 Try turning it down 25%, then 50%, more if possible. Just be sure to set the same timout on both arduinos.

      Interesting project by the way.

    • Duane says:

      Also, just found a speed optimized library for what I think might work for you.

      • dab says:

        Thanks for your suggestions.
        By the way, the connecton with arduino happens once every 3-4 times. Is that normal?

      • dewy721 says:

        Actually, now that I think about it… That WAS a bug. However, a while back another user (Matt W.) ran into the same problem and emailed me a patch to fix it. So I just did. πŸ™‚

        Here is a link to the updated file. Hopefully, it should fix the issue for you.

        Just make sure you set the file type to be an executable before use.


      • dab says:

        Thank you. I’ll try as soon as possible.

Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )

Connecting to %s

%d bloggers like this: