Welcome
|
Created 29.12.2023
EazyCNC on Raspberry Pi with TOAD5EazyCNC now runs Raspberry Pi, as featured in the cover of Digital Machinist Fall 2022 Issue!Most of this page is re-cycled from that article but there is much more in DM about this so you should really check them out. Digital Machinist Winter 2021 Issue has more on TOAD5 and while I have your attention want to mention that there are other
Below of picture of the setup of one of my trusted pilot users Erik who converted his Mac based TOAD setup to use Raspberry Pi, just for the convenience.
Changing landscapeOne of the early goals or dreams I had with EazyCNC was to be able to utilise an Android tablet as the hardware platform for my CNC endeavours. Now, more than ten years later a lot in the world around my project has changed and some disillusionment has set in. The attraction of Android as a platform was that it offered a touch screen computer with almost hermetic enclosure instead of a dirt and chips sucking fan and a keyboard. All in a ready to use enclosure at unbeatable price. Over the years I've bought, for development purposes, several Android tablets which have been more expensive than the cheapest laptops that I've bought. A decent Android tablet costs about the same as a comparable laptop. Of course the price of the computer in a CNC system is a fraction of the cost of the complete system. At the end of the day it is false economy to compromise the system for a saving of one or two hundred dollars. But the real road block for Android is that it is more or less closed system, in spite of the hype to the contrary. Unless you are prepared to jump through hoops and you are a software wizard you are stuck with the Android versions that the tablet manufactured can be bothered to offer for your particular tablet. In practice they will forget all about your tablet in a year or so because there is no money in it. You are then stuck with that. Which brings me to the last nail in the coffin: the number of Android API (Application Programming Interface) versions. Last time I checked the Android OS version was 12 and the API 'level' was 31. My tablets are stuck at 3/11 and 7/25. So there is no way an individual like me can hope to keep up with this. As an aside, the Apple iOS and iPad ecosystem would be better in that respect but because of the Appstore it is way too difficult to release anything in a short order which is not well suited to a developing system where it essential to be able to release bug fixes at a short notice. And there is the additional cost of $99/year which is not an impetus for a 'product' I share freely. There is also a further technical issue with Android tablets. In the USB world there are Devices and Hosts. You can connect several Devices to a Host but you cannot connect a Device to a Device nor a Host to a Host. So for a tablet to be able to connect to a computer it needs to be a Device, because the computer is always a Host. And by the same logic TOAD5 is a Device by necessity. Thus you cannot connect a TOAD5 device to an Anroid device. You need a tablet with either both a Device and a Host connector (very,very rare) or tablet with USB OTG capabilety. But USB OTG comes with a problem. If the tablet is in host mode then most of them do not receive power from the USB connector so unless the tablet has an external power connector (very rare) then it will need to run on internal battery. Not an ideal scenario for a key component of a CNC system.
Enter Raspberry PiMeanwhile elsewhere outside of my bat cave the Raspberry Pi ecosystem and community had been growing and one day it dawned on me that I had had a bad case of tunnel vision. In hindsight Pi looks to be such an obvious platform for this sort thing: powerful, open, well supported, more than affordable, developing and forward moving. To test this I bought couple of the newly released Raspberry Pi 4B single board computers and a 7" and 10.5" inch touchscreen to experiment with. Thanks, once again, to the Java's "write once test everywhere" approach it was pretty trivial to run EazyCNC on Raspberry Pi. All I needed to do was to locate OpenJDK compiled for the ARM processor and rebuild my application. I could even run my favourite IDE Eclipse on Pi. I was amazed that all the low level USB and OpenGL interfaces just worked, out of the box. With little fine tuning of the screen layout I was very happy with the larger,10" screen. I also ended up incorporating a built in, on screen, virtual keyboard to EazyCNC because the user experience with the available virtual keyboards in Raspberry OS was less than satisfactory. As I expected, the 7" original Pi screen proved to be too small to run EazyCNC 'as is'. But I wanted to support that too because I envisioned a kind of small and compact mini CNC might be of interest so I created a screen layout option that work reasonably well with that small screen. Below my original test with the official Raspberry Pi 7 inch screen.
Installing and running EazyCNC on PiYou can download an experimental version of EazyCNC for Raspberry PI from my web site eazycnc.com. It has been tested it with Raspberry 4 B (8 GB) and 64 bit Pi OS only and I have no intentions to support anything older as trying to utilise some under powered old hardware is not rewarding for me or the user. Installation is basically as simple as downloading a gzip, uncompressing it and running the installation script that adds EazyCNC to the Pi Start -menu.
Self contained CNC machineMy philosophy is that ideally a CNC controller is an appliance (as opposed to a computer) without a keyboard or mouse. Just a box with a touch screen to load the G-code file and do the minimal necessary needed in machining. To this end the system should just boot up into EazyCNC on power up and to do that as fast as possible. To this end EazyCNC has number of features to enable this vision.
Auto startThe installation script that comes with EazyCNC automatically creates and installs the files necessary to start EazyCNC automatically.Fast boot-up is something I have not yet tried to achieve but I've read that you can tune a Raspberry to boot in less than two seconds.
Auto shutdownBecause Raspberry Pi writes all files to the SD-disk which also contains all the software there is always a risk of corrupting the SD card if you just rudely turn off the power. To shutdown in a civilised manner a keyboard or mouse is necessary, which is not what I wanted. To fix this I have incorporated in my software the option of shutting down the computer when you quit EazyCNC from the touch screen.
Virtual keyboardThere are number of virtual i.e. on screen keyboards available for Raspberry Pi / Linux. In my experience this sort of 'general purpose' virtual keyboards do not play optimally with any software as they tend to cover items on the screen that you'd like to see and the way they pop in and out can be distracting, not to mention 'keyboard focus' problems. So I integrated a custom virtual keyboard option to EazyCNC that is optimised for its task and which plays ball nicely with the rest of the application. True, it works only for EazyCNC machining tasks but then I don't expect any other tasks to be performed on the Pi. It also works nicely along with a real keyboard if you so desire.
USB Access RightsRaspberry Pi OS ie Linux is notorious for taking a strict approach to security. For example by default you are not allowed access to your own USB devices! Instead you have to write and install what is known as 'udev' rules. While this is not a major hassle EazyCNC (to live by its name) tries to take most of the pain away by detecting this situation (lack of udev rules) and writes to those rules for you.
MPG / CNC PendantDoing the necessary axis movements with touch screen (not to mention conventional keyboard or mouse) when setting up the milling machine for a milling job is not ideal. Fortunately EazyCNC supports a CNC Pendant aka Manual Pulse Generator which allows controlling any of the axis with a jog wheel. Currently EazyCNC supports a XHC WHB-04 which retails for about $100. This is available from various sources and while it has some short comings (the display layout is fixed and update slow, and the wheel sometimes skips a pulse) it is economical and convenient and feels rugged. It is wireless with magnets at the bottom for attaching to any flat steel surface. I find both of these features very handy.
Touch ScreenEazyCNC works with the official original 7" Raspberry Pi screen. Because that screen is rather low res and physically small EazyCNC operates in a flip screen mode where not everything is visible at the screen at the same time. This is workable but not the best option so I recommend a 10" or larger screen. Note that the minimum usable resolution for EazyCNC in Standard screen layout mode is 1280 x 800. For my system I selected Waveshare 10.1" 1280x800 HDMI touch screen, about $130. That screen has a large black border around the active area of the screen the HDMI and the USB connectors are placed stupidly. Because of the placement of the connectors you need an extra 1.5" minimum inside the enclosure to accommodate the cables. It is worth having the cables and connectors in hand before planning the enclosure. Hot tip: fpv-solutions.com sell an assortment of very light and small USB and HDMI cables for tight places. I later noticed COOLHOOD 10.1" 1280x800 LCD which seems to have much better connectors and connector placements. IMO it is worth checking out.
Steppers and DriversBecause TOAD5 uses external drivers you can basically use any size stepper motors. When selecting the drivers there are couple things you need to pay attention to. The STEP, DIR and ENABLE outputs are not isolated and are referenced to the TOAD5 ground, so the driver boards should have isolated inputs. The STEP pulse TOAD5 supplies is short, 20 µsec and it is essential that the driver works reliably with that. The STEP pulses are generated with a NCO algorithm running at 100 kHz. To keep the pulse jitter within reason you should not aim for higher than 20 kHz step rates which is a thing to keep in mind when planning for axis lead screw pitch and gearing ratios. Picture 8 shows a very cheap Chinese stepper driver module that I have used and which you can find from eBay for less than $10. In case you want something Made in USA there are more advanced and costlier driver modules that produce smoother motions and have harmonic suppression systems among other things. If that is what you want then you could do worse than to take a look at what Geckodrive offers, I have good experience with their drivers too.
Isolated InputsAll the inputs are isolated and compatible with most optical and proximity sensors, whether they have NPN or PNP outputs or have just plain contacts. The probe input is slightly different as it was designed to be compatible with Econo Probe and it supplies power to the probe LED through a simple two wire interface. But any opening or closing contacts type Renishaw style probe should work too. An isolated analog input on the TOAD5 board for implementing a torch height control for a plasma cutter is a works in progress at the moment.
Isolated OutputsThere are isolated outputs with open emitter/collector configuration to be used with Variable Frequency Drives to control a spindle motor. These outputs are compatible with both pull up or pull down inputs in VFDs. A VFD supplied voltage output (max 10v) referenced isolated analog output is also available to control the spindle speed. For controlling a plasma torch via a relay, there is an output that can directly drive a small relay without an external power supply.
Realtime aspectsI have mentioned this elsewhere but in the spirit of full disclosure I want to mention this again. Neither Linux nor Java (on which EazyCNC is based) are not what are known as real-time systems. Real-time means that a system is guaranteed to perform a task (such as generating a 20 µsec step pulse) in less than a fixed specified time. Why this is critical is that a too long delay in generating the pulses to the stepper motors that control the axis in a milling machine may cause them to loose positional accuracy or even stall. EazyCNC fights this issue by off loading all the realtime task to the TOAD5 firmware which is realtime capable. However, it is theoretically still possible that long pauses or delays in the Linux OS or Java Virtual Machine will spill into the TOAD5 world and cause problems. I have never witnessed this in the wild and given the certainty of something else occasionally going wrong in machining this is a risk I'm prepared to live with. YMMV. |