Welcome! Log In Create A New Profile

Advanced

Hacking LinuxCNC's HAL layer in to your Arduino

Posted by dewy721 
Hacking LinuxCNC's HAL layer in to your Arduino
January 21, 2013 05:14PM
If anyone is interested, HAL2Arduino has been released.

Its a communications framework that exposes the HAL interface pins from LinuxCNC to the Arduino (or multiple Arduinos simultaineously).

Its intended for people that wish to write their own firmware but don't want the headaches if creating a gCode interpreter and communications protocol from scratch.

Features supported:
    - Automatic scanning for proper serial port(s) to use.
    - Allows for one or more Arduinos to be used at the same time.
    - Arduino to PC, Arduino to Arduino bidirectional communications and broadcast messaging.
    - Error correction.
    - Easily expandable with example mods.
    - Arduinos can be pre-assigned individual IDs.

Relevant uses:
    - LinuxCNC/Arduino integration.
    - 3D Printing
    - CNC Machining
    - Robotics
    - Teaching

If anyone has questions, please check out our FAQ page or just ask. Either here or on my blog.

Edited 2 time(s). Last edit at 01/23/2013 01:23AM by dewy721.
Re: Hacking LinuxCNC's HAL layer in to your Arduino
July 17, 2013 03:37PM
Quick ?;
Reading the FAQ I come across this:

Question: Can I make “Das Uber” CNC machining center work using HAL2Arduino to handle the whole thing over USB?

Answer: Yes, but please don’t. Instead, use the parallel port for moving the machine’s axes and reading the encoders. Why? Be cause its easier to configure that part traditionally AND it will perform faster too. If you have that class of machine chances are the general motion controls are intact and very well documented. HAL2Arduino should be sufficient to handle everything else like switches, DRO’s, jog wheels, joysticks, pumps, lights, tool-changers, indexers, control panels, touch probes, part shuttles, or even that 3-phase line conveyer.

My ? is how would one use the parallel port to move their machine axes, with my arduino I have no parallel port, I have USB only and my motor drivers are on the arduino. Or am I mistaken and this answer is pertaining only to Das Uber?

Thank You,

J. Padilla
Re: Hacking LinuxCNC's HAL layer in to your Arduino
July 17, 2013 07:10PM
You can drive most common stepper drivers boards from a old-school PC's printer port directly. LinuxCNC (aka, EMC2) users have been doing it for literally decades.

Also, if needed you can buy LPT printer port expansion cards off of ebay for 10~20$US. General rule of thumb is that you will need one DB25 per 3 axis (stepper driven). So a 9 axis machine would need a PC with 3 parallel ports installed.

However with some coding skills, a python script can be made control one or more Arduinos to approximate a CNC machine with more advanced features like ethernet, record/playback, machining clusters, etc; at the cost of real-time super-fast performance.

But honestly, if I'm plodding around in my shed with a hand build scrap-bot CNC machine, I won't be trying to break the sound barrier of machine productivity anyway.
Re: Hacking LinuxCNC's HAL layer in to your Arduino
June 24, 2014 07:42AM
Quote
dewy721
You can drive most common stepper drivers boards from a old-school PC's printer port directly. LinuxCNC (aka, EMC2) users have been doing it for literally decades.
And that is the problem, usually something that has been done for decades is the very definition of obsolete.

Quote
dewy721
Also, if needed you can buy LPT printer port expansion cards off of ebay for 10~20$US. General rule of thumb is that you will need one DB25 per 3 axis (stepper driven). So a 9 axis machine would need a PC with 3 parallel ports installed.
If i am going to put more than one card of same type in my pc, is going to be sli / crossfire, and *not* 3 parallel cards. Coz well, i live in this century not the one that just passed.
Re: Hacking LinuxCNC's HAL layer in to your Arduino
June 24, 2014 05:35PM
Last time I checked, both SLI & Crossfire pertained to memory bus sharing between Video cards. Not that GpGPU processing fundemenatly couldn't be harnessed to do it, but you *would* need some one-off custom hardware to get that "this century" processing power connected via the DVI Jacks (the real-world lowest latency interface for a video card). Or hardware that can at least read/write to your GPUs vram directly.

The premise for using old school LPT ports was for its low-latency interface to the CPU via the south-bridge chip. If memory serves, 586 class CPUs or older have them direct wired to the CPU itself.

But if you really prefer bleeding-edge hardware then you might wish to step away from the PC platform altogether, luckly there exists projects that can accommodate you there too. smiling smiley

For example, you could load a Beagle Bone Black with a version of LinuxCNC (known as MachineKit) that has already been pre-compiled to run on the BBB's ARM processor. Plug in an HDMI monitor and a usb keyboard/mouse and off you go.

Oh and if that's still not enough, you could run HAL2Arduino on it as well. Hehe.

Edited 1 time(s). Last edit at 06/24/2014 05:37PM by dewy721.
Re: Hacking LinuxCNC's HAL layer in to your Arduino
June 25, 2014 08:23AM
No, i did not meant i wanted to use sli/xfire to run cnc smiling smiley I was just trying to put emphasis on the parts with requirementss like "put 3 parallel cards" or "use an old computer" are just a mark of obsolescence. Emc is so old its a wonder it did not died of old age already. When it was born there were no microcontrollers capable of doing what it did, and it made sense to compute on the pc itself. Now many uC are quite powerfull and ofc the future will evolve in this direction. There is currently no need to do any kind of "lifting" -heavy or not- on the pc itself.

The restrictions imposed by the emc arhitecture, parallel ports, realtime os, etc, they are too big compared to the solution of delegating everything externally, which is quite cheaper and more flexible today. EMC has to learn that, or it will slowly fade away. The efforts to make it run on beagle bone or rpi are *the* (*only*) way to go. Ofc imo, thats just an opinion and its mine. There is and always will be an opposition to change, even when not changing endangers existence, and that is because this sort of opposition is not rational. Its just the ppls getting used to something thats all, and that has a blindness factor because they emphasise too much their old experience even when its not relevant anymore.

Again imo the time when used to daisy chain multiple paralel cards should of been over many years ago. I dont think i can make you feel how this concept really feels to my ears. I admit it could of been a sweet deal sometimes in the past. But nowadays putting "3 parralel cards", to me just sounds half ridiculous and half preposterous. Again this is ofc my opinion.
Re: Hacking LinuxCNC's HAL layer in to your Arduino
June 25, 2014 09:28PM
I agree wholeheartedly that embedded controllers are the way to go. They're cheaper, better performing in most cases (with the RIGHT uC) than the "good' ol' days" config shackled a modern multi-core PC. Arguably more reliable too.

Food for thought:
A BeagleBone Black (Rev B.) is $55
+8gb micro SDcard $10
+MachineKit distro (free)
+5v,2A(10watt) regulated power 'brick' @ $10
+Probotix PBX-BB breakout board @ $69 (optional, but very handy)
+Cheap HDMI monitor @ $100
+Cheap USB Keyboard/Mouse Combo @ $35
=$279 Done! smiling smiley
Try doing that with a PC.
Oh, and the BBB could STILL run HAL2Arduino to further expand GPIO options.

BUT I digress, for budding scrapbot builders that have multiple old PCs/Arduinos laying around (like me) H2A is a free alternative, and really meant for those that actually LIKE to tinker with everything.
Plus, that subjective "no-cost of entry" adds a lot of "investment courage" to the otherwise "would-be" Makers out there. winking smiley

PS: This thread is old and H2A is as well. These days I work mostly with the BBB anyhow. grinning smiley
Re: Hacking LinuxCNC's HAL layer in to your Arduino
June 26, 2014 01:59PM
Yup that is exactly what i was thinking also. I reached this forum because i was looking into BBB to replace my current router controller. I would of gone with BB-xM instead and i saw some distributors sell an touchscreen lcd, while a bit more expensive it does look quite nice.

I looked at machine kit, and sadly it uses debian, which i again i would avoid if i can, so i'd rather go arch arm instead and compile all the rest coz this way feels much better to me. Although dunno how smooth this path would be, i am under the impression things are not quite there yet. But i think i will give it a shot later this year.
Re: Hacking LinuxCNC's HAL layer in to your Arduino
July 02, 2015 01:10AM
Can you help make the settings for the ramps 1.4 to EMC2?
Sorry, only registered users may post in this forum.

Click here to login