# Computer for CNC Machine



## cjones6108 (Sep 2, 2017)

It seems a waste to me to have a complete workstation attached to the CNC machine, and generally speaking, PC's, laptops, other sensitive electronics and power machinery are not good mixes.  I'm wondering if anyone has tried the Raspberry Pi with the Raspberry Pi CNC board from Protoneer (total cost about $100)?  This would seem to be a more appropriate alternative as it can easily be attached in the control enclosure and accessed by ethernet or WiFi.  The idea would be to run your heavy computations at your desk (Mach3 or Fusion360) and send the G-code file to the controller for execution.  Might want a tablet or other monitor to provide some DRO function.

Thoughts/comments?

caj


----------



## Karl_T (Sep 2, 2017)

Used PCs are really cheap and still reliable. there's a HUGE installed base of folks using mach 3 or Linux CNC. Go this route and you can get a lot of help.

Go with Pi and there's only a few others doing it. You'll be almost on your own.


----------



## spumco (Sep 3, 2017)

Yes you can, but...

1. The problems you bring up about computers being sensitive to RFI/EMI are real, but the computer itself isn't really a problem if you use a separate ethernet-based motion controller or other isolating device(s).  The components sensitive to EMI are the parts like limit switches or some of the components on BOB's or cheaper stepper drivers that are directly connected to the noise-generating parts.  If you follow good electrical grounding practices (star grounds, no ground loops, shield high-power/frequency VFD -type things from signal wires) you'll likely be fine and your PC will be stable as a rock.

2. Do you want to use GRBL for your G-code execution?  Remember, the various hobby & commercial g-code software/firmware systems all have fine(ish)-tuned motion/trajectory planners to figure out the appropriate motor acceleration/deceleration while doing 'look-ahead' calcs.  I don't know enough about GRBL to know if it's really stupid or awesome.  Recommend you investigate further and see if there are any commercial products based on this code interpreter, or if everyone using GRBL is basically a basement nerd with a home-built toy.  What (very) little I have gleaned indicates it's pretty nice, but takes quite a bit of programming.

Ask yourself - do you want to make parts ASAP, or do you want to spend your time learning C+ or some other programming language and loads of time fiddling before you can make trinkets?

3. Consider the computational speed of a Pi and see if it will process/send step & direction pulses fast enough for your particular system.  If you're still in the planning stage I suggest using 'worst case' values for the inputs:

1. Ball screw or rack & pinion units (inch or mm) per turn.  [If you don't know whether you're using 5mm or 20mm per turn screws, do the math with 5mm as it will require more pulses per time unit to reach the speed in #4 below]
2. Stepper motor steps per rotation (including micro steps needed to get the resolution desired).
3. Figure steps/pulses per inch or mm from above
4. Determine maximum desired rapid speed, as well as maximum realistic feed speed for each axis
5. Now calculate how many pulses per second to achieve desired rapid & feed speeds
6. Now add up the 3 (or more) pulses per second that that is your target for the computing device (Pi, Arduino, other micro controller).  If the device can't process or send signals quickly enough, your machine will drop steps or not be able to move at the speeds you desire.

Quick example from my mill:
1. 0.1968" per rev (5mm screws)
2. 2000 steps per turn (200 steps, times 10x micro steps)
3. 10160 steps per inch (5.08 revs/in)
4. 400ipm rapids desired on X/Y, 200ipm on Z.  150ipm feeds for all axis.
5. 67.73 pulses per second (kHz) for X/Y, and 33.87kHz for Z.  25.4kHz per axis at max feed.  (10160 PPM x 400 IPM / 60 sec/min)
6. Max pulse demand is about 170kHz with all three at rapid.

Can the micro-controller you're considering send output signals on three (or more) pins at the speeds you need? I know the older Arduino I have set up as a DRO on my lathe is limited to about 32kHz or something.

I have two suggestions for your consideration as an alternate to either a big workstation or a Pi-type micro-controller:

First, you can purchase a micro windows (or Linux) computer used for gaming.  These are rather inexpensive, very fast, and some are fan-less to keep dust out.  I purchased a Zotac (I think that's the brand) for my mill and am quite pleased with it.  Less than $200, and I get everything you'd normally get with a big desktop (1gig drive, on-board graphics, ethernet, wifi, USB3.0, etc.) in a tiny package that simply mounts to the back of my monitor and connects to the motion controller via ethernet cable.

Get one with an SSD and they're essentially instant-on during start-up.  I now have internet, CAD/CAM, garage music, Youtube, and so forth right at my mill.  Having to pass a thumb drive between a separate computer and my mill (or even wifi) would drive me nuts now.  I can leave Fusion 360 open on my mill controller and adjust the model & CAM, post the file, and cycle start in seconds without getting off my rear end.

Most important - I didn't have to program anything in a computer language I don't understand.  Windows - _duh_.  $60 commercial CNC software - _duh_.  Plug in motion controller and tell windows to find it - _duh_.  Tell CNC software what pins do what - _duh_.  Game on, make some chips.

The other alternative is a stand-alone CNC controller such as the Masso.  https://www.hindtechnology.com/product-category/cnc-controllers

$550 or so is a bit higher, but it has _everything_ in one package.  Computer, CNC G-code interpreter, breakout-board, etc.  Just add a monitor and keyboard and you''re in business.  It even supports touch-screens.  If you're doing a bigger router, the 4 or 5 axis will drive/slave the A to the X or Y.  I seriously considered one of these and the only reason I didn't get one is that the step pulse frequency (110kHz), while perfectly suitable for stepper-based machines, would have been too low for my set up when I move to servos with high-resolution encoders.  I considered 200kHz to be my 'floor', so despite the Masso's advantages I had to go with a different arrangement.

Sorry - a bit long-winded.  Good luck.
-Spumco


----------



## JimDawson (Sep 3, 2017)

I have installed 70 0r 80 desktops, laptops, and micro PCs in horrible industrial environments and had very good success with them.  In the case of my machines, I really like having my CAD, CAM, and control software on the same PC.  I normally do my heavy duty CAD work and much of the CAM work at my desk in my office, then transfer the files via USB drive to the machine computers out in the shop.  Any tweaks needed are done on the machine computer.  Simple jobs are many times drawn right at the machine.


----------



## cjones6108 (Sep 3, 2017)

spumco said:


> Yes you can, but...
> 
> -Spumco



While brevity is considered an asset in email and especially text messaging, in a forum like this a more lengthy discussion is most welcome (by me anyway).  You make some good points and I will certainly be doing more research into the capabilities of my proposed system and other systems.  As it happens, I am a retired software developer with some electronics and microcontroller stuff thrown in, starting before the now ubiquitous PC was even on the market with languages like FORTRAN and ending up with relatively modern languages like Java, so programming, per se, does not scare me.  But you're right, of course; it's not what I want to do when I go into the workshop.

The platform I mentioned, the Raspberry PI and the RP CNC board, again, I haven't researched it so far other than to just skim the surface, but the RP CNC sounds roughly equivalent to Ethernet Smooth Stepper, except that the CNC board plugs right onto the R-PI.  I'll find out more, and look at some of the other things you mentioned. 

They always taught us in software development not to reinvent the brick (or wheel, if you like), so that's what I was hoping -- to find out from others who have tried that...

Again, thanks for your insights and I do appreciate the thoroughness of your reply.  I don't have to decide quite yet -- My mill was just delivered and I got it set up only yesterday.  I haven't even got it cleaned up or put a plug on it yet.

caj


----------



## spumco (Sep 3, 2017)

Well, now you've got me curious.  What mill?  I assume you're about to dive in to a manual to CNC conversion...

-S


----------



## JPigg55 (Sep 3, 2017)

If you decide to go with Raspberry Pi, I hope you start a thread on it.
What little I know of Raspberry Pi, I believe it's quite adequate to do the job.
One plus is you can easily add a parallel port to Raspberry Pi which many CNC kits require.
Many of the newer computers no longer come with parallel ports and I'm unsure how difficult it is to install one or if it's even possible.
I know a guy at work who bought a Harbor Freight CNC machine (might have been a conversion, don't remember).
Any way, he had to install a USB to parallel port conversion to be able to use the computer he had for it.
Another consideration would be Operating System compatibility between your computer and the Raspberry Pi.
I don't know enough to give you any advice on this just pointing it out.
Here's a blurb from https://lifehacker.com/the-best-operating-systems-for-your-raspberry-pi-projec-1774669829 about Raspberry Pi OS systems:

The Raspberry Pi itself doesn’t come with an operating system. For that, you need NOOBS, short for New Out of the Box Software. It’s an operating system manager that makes it easy to download, install, and set up your Raspberry Pi. When you first boot up NOOBS, you’ll get a selection of OSes to choose from. Which operating systems are available depends on which model of Raspberry Pi you are using. For this guide, we’ll stick to the most common OSesoperating systems available on the newest models of the Raspberry Pi. Right now, that’s Raspbian, OSMC, OpenELEC, Windows IoT Core, and RISC OS.

While downloading NOOBS is simple, you can buy an SD card with NOOBS preinstalled for around $12 at Adafruit. If you prefer the DIY route, the setup process is very straightforward and you’ll find a full guide over on the Raspberry Pi site. On the first boot, NOOBS greets you with a selection of operating systems. You can install as many as you want that’ll fit on your SD card. Let’s dig into which of those choices is best for your particular plans for your Raspberry Pi.

Good luck with your venture.


----------



## cjones6108 (Sep 4, 2017)

spumco said:


> Well, now you've got me curious.  What mill?  I assume you're about to dive in to a manual to CNC conversion...
> 
> -S



Yes, manual conversion.  The machine I settled on is the Precision-Matthews PM-932M.  Since I was planning to convert (or at least, start converting) straight away, I got the most basic, no frills model -- No X-axis motor, no power down feed, no DRO.  I made a quick run uptown a day prior to the delivery and bought an engine lift from Autozone -- Man, talk about a life saver!  Should have gotten one of those years ago.

caj


----------



## spumco (Sep 4, 2017)

_The machine I settled on is the Precision-Matthews PM-932M_

Rockin'.  I almost bought that one (actually, the 940 for the extra Z height) before I stumbled across something else last year.

If you haven't already done so, check out Jbolt's PM-932 build thread here.  I believe TomS also has one.  And there are plenty of Rong-Fu clone conversion threads on CNC Zone.

Looks like a great starting point.  Keep us up to date, especially if you do something strange and interesting with the control system...

-S


----------

