Introduction: CNC Machine for Shaping Large Pieces of Polystyrene Foam


This instructable shows how to shape polystyrene foam, using a CNC machine. Starting with a brief introduction, design software necessary for creating an STL file is discussed. This is followed by a method for creating G-code, using an STL file as input. After this comes the introduction to GRBL, an arduino based system for using G-code to control stepper motors of a CNC mill. Stepper drivers are mentioned, after which the creation of large CNC hardware is described. The instructable finishes with next steps.

Richard Tegelbeckers

PS. I plan to expand/update this instructable as I gain experience and make improvements to my machine. Come back to check if you are interested! Also, if you would like more clarity on any of the steps, leave a comment and I will try to help out. I could potentially add more pictures as I took photos/videos of pretty much everything I did.

Step 1: Introduction

I became interested in CNC machines, shortly after being let down by a 3D printing firm in the UK. Intrigued with the reprap efforts, I decided that having a drill-like tool wizzing around in three directions would be an easy target to achieve. I did my research and ended up slapping together a small machine, using an old flatbed scanner, an ancient printer carriage and a defunct CD player. I learned from the experience and used it to come with the following objective: to create a large 3 axis CNC machine, capable of machining polystyrene foam. The machined foam can then be covered in a protective layer (eg. water based latex), before pulling a composite fibre mould(ing) from it.

Step 2: Design Software

In order to design something on a computer in 3D, (CAD) design software is needed. This might not be pleasant for the Fancy Apple folks or the Open Source Linux enthousiasts, but the system to use (in 2012) is boring old Microsoft Windows. Sorry, no discussion...

Having made the democratic decision for Windows (only one voter allowed: me...), the offering for CAD applications is plentiful and I advice to do plenty of research if you are serious about learning how to use a package. If budget is a constraint, 123D by Autodesk is hard to overlook. It seems to be relatively easy to learn and cannot be beaten on price as it is free. Be aware as it is still in beta stage (June 2012) and it seems troublesome on older, lower spec 32 bit systems. The 64 bit version should be pretty good on a more powerful machine. In the professional ranges the price for software climbs steeply, but one gets what one pays for... Popular offerings are Inventor by Autodesk and SolidWorks by Dassault. Both are very powerful and take a fair amount of time to learn.

In short: Use any CAD software you like as long as it can generate an STL file.

Something worth while mentioning, all softwares mentioned in the following steps are available as open source or freeware...

Step 3: G-code

As soon as an STL file is present, G-code can be created. The program I use is called Freemill:

It is very easy to use, but it could cause some issues with your graphics card. If it locks up, try the following: redo the steps until the last step before it would lock up again. Now shrink the program window or move it off screen, in order to prevent the 3D model from showing on your screen. The program should now work without crashing...

Step 4: Grbl

Grbl ('garble') is great for one reason more then any other: it will allow the use of USB for connecting a CNC machine to a laptop. Many established hobby solutions utilize the out of date parallel port, which will not work properly on a laptop due to power management issues...

For Grbl see:

Windows users can use the following to connect to grbl:

In practical terms, grbl runs on an arduino (uno) and needs to be uploaded to the microcontroller. Several methods are available, good instructions are already described here:

PS. Support the (Open Source) Arduino folks and buy an original...

Step 5: Stepper Drivers

On my initial CNC machine I used small printer motors in conjunction with a 12 volt power supply and pololu drivers. Plenty info is available from the reprap guys.

For my larger CNC machine I need more power: 24 volts and bigger drivers. I tried some drivers based on the Toshiba TB6560 chip, but I have not been successful with this. As I only played around for an hour or two I might still get them to work before turning to an alternative. Suggestions welcome...

Update (7th of may 2012): The Toshiba based drivers were rubbish. The first one did not work, the second one burned, but the third one worked lovely. I think the quality of assembly was probably poor: when the boards first arrived I noticed a poor solder joint, which I fixed. I will get new drivers or even make my own, based on the same chip. All in all, it means I can't run the machine just yet :-(

Step 6: Hardware Objectives for the Big CNC Machine

Hardware objectives for the big machine:
  1. Use of standard components.
  2. Ideally I would be able to use 2400x1200x100mm sheets (8x4 foot by 4"), cut in half and six layers high, ie. 1200x1200x600mm. Sheets in this size are readily available from the local DIY shop for little cost.
  3. High speed
  4. Good repeatability
  5. Reasonably accurate
  6. Should be robust. ie. it should be able to withstand a beating and survive a harsh environment in terms of dust and humidity (no mdf, wood or cheese-like materials...)
  7. In order to avoid getting clogged up by cuttings, all slides and drives to be mounted overhead of the workpiece
Update 20th/24th of June 2012: BOM updated. I missed out on a few parts on the last version of the BOM. Still, the BOM only contains the parts and materials I did have to purchase especially for the project. It does not include materials I already did have, which is mainly steel, wood router, fasteners, castor wheels, cables, etc. It also does not include the round shafts, which I stripped from a broken A0 printer. For more details, see the 3D model. I was initially going to publish a model to the 123D website, but as I experienced problems with this I uploaded a zipped ACIS file to this step (file extension .SAT, can be imported in 123D and many other CAD packages) and a zipped 3D AutoCAD file (file extension .dwg, can be used in AutoCAD R14 or higher). The model does not contain all items and components. However, it should be enough as a basis for making a machine yourself - it was good enough for me to make my own machine... You will probably want to modify the design to suit your own requirements and use your own choice of components/steel sections.

Step 7: Base Frame Fabrication

For the base frame I used 50x50x2.5mm box section. Whereas I did have most of the other steel for the project already, I needed to buy four lengths of the box section. It wasn't cheap...

In order to line up the frame properly, it is important to have a flat surface to work on. A table with a thick, steel top would be best. In my case, I used a table I made from an old door.

With the frame being so big, I was fortunate to have some help from my mate Kirk - thanks again! Another aspect of the frame/machine being big, is moving the machine when finished. As such, wheels are attached during this step.

The critical part of the phase is to have the top members parallel. I did spend a whole evening in order to get to the result I was after.

Step 8: Rails

For the rails I re-used the round shafts from a broken A0 printer. It came from the local tip, where it initially changed hands for £5 and ended up in my mate's house for several years... When taking the printer apart, the drive belt disintegrated. This just confirmed it is a good idea to avoid non-standard components. In case of the round shafts themselves: if they would need replacing, I would be able to do so by obtaining 16mm OD silver steel.

The round shafts will be locating the carriage in the side ways direction. The second shaft will be non-locating or floating in this direction. As such it only needs to be straight to a high tolerance in the upward direction. Being so, a cold rolled box section of 20x20x1.5mm was my choice for this rail.

With both rails I tried to weld them as accurate as I could. Final adjustment to a high tolerance can be achieved at a later date by using shims*.

* I make my shims by cutting up freshly emptied beer cans; the thickness of such shims is very constant and around 0.1mm in size.

Step 9: Main Carriage

Again, I made use of the flat surface of the table top for alignment. In order to stop even the slightest deflection, I braced the 50x50x2.5 box sections with some 25x25x3 box sections. On the locating end I mounted a pillow block with an open, linear ball slide. On the floating end I mounted roller skate bearings.

Note the use of only one pillow block in order to make maximum use of the round shaft. This is possible by having a longer floating rail with a pair of bearing sets.

Step 10: Upgrade to Bushes

Very soon after placing the main carriage on top of the base frame, I noticed some issues with the ball slide. Some of the balls stopped revolving and ended up scoring my lovely shaft. It must have been dust clogging up the raceways. I concluded it would be better to have a plain bush in the pillow block.

The most cost effective way of upgrading the pillow blocks, was to make some closed bushes to fit. The OD of the bushes was 2mm smaller than the ID of my pillow housings. As such, I ended up making a 1mm thick spacer. It took some effort, but I think it is worth it.

At a later date I will also replace the ball bearings for nylatron sliding blocks.

Step 11: Chain Drive

I decided to have a chain drive for various reasons. The main ones are:
- compared to belts, chains do not stretch as much
- chains are very robust
- chains can easily be adjusted to any length
- simplicity of assembly

During this stage of the build it is necessary to do some accurate machining. The bushes need to be mounted in reamed, 10mm holes. The sprockets need reamed, 8mm holes. I managed to avoid machining of shafts by obtaining 8mm OD silver steel. I took effort to produce tensioners that can be easily adjusted.

In order to straighten the long shaft on the base frame, I used the Gentle Persuader* for adjustment - X marks the spot!

Update 28th of June 2012: The chain on the vertical axis is driven by a sprocket, mounted directly on the motor shaft. The other two axes have two chains per axis and require a coupling between motor shaft and sprocket shaft. My initial couplings did twist too much under the high motor torque, resulting in backlash of at least 2mm (see attached video). New, spider couplings finally arrived from Hong Kong and are now on the machine. The backlash is now acceptable (less than 0.2mm).

* engineering term for hammer

Step 12: Secondary Carriage and Spindle Holder

The spindle holder consists mainly out of a cold rolled steel box section 40x27x1.5mm, bolted to a linear slide. When mounted to the secondary carriage, there is no noticeable play. I tried spinning a 315mm long drill bit at 30000 rpm and there is no vibration during operation. Once the drill bit has been rounded in order to resemble a ball nose cutter, it should be great for machining polystyrene. The length of the bit is not for making large cuts; only the end should be used for cutting. However, it will be great for creating deep cavities at shallow release angles. In order to machine solid wood, normal router bits can be fitted.

I did not finish the bearings at the floating end. As I want to get away from rolling bearings, I will deviate from my original design and fit nylatron pads. I also have to finish the vertical drive. It will be chain driven, but having a drive based on a screw thread would be possible as well.

Update 12th of June 2012:
Z-axis is finished. I did not yet fit a counter-weight, but the motor seems to be happy without one. It just means the carriage will drop down with a bang if the power goes off. Also, the 315mm long drill bit is pushing it too much. As soon as it touches the foam even with the slightest pressure/speed, it will occasionally wobble too much. A shorter bit works fine. I will shorten the long bit step by step to see what I can get away with...

Step 13: Machine Working for the First Time

Step added 12th of June 2012:

As mentioned in an earlier step, I did have a problem with broken stepper drivers. In order to run the machine for the first time from a mechanical point of view, my mate Russell (many thanks!!!) hooked up his 3-axis rig. It consists out of a Windows tower and a 3-axis parallel port board with Toshiba TB6560 chips.

The board was set up to use 1/8th microstepping, bringing the step size from 0.4mm to 0.05mm. We also set the backlash on the horizontal axes to 4mm each. The backlash is purely there due to the twist in the couplings. This will be sorted when the couplings will be replaced by spider couplings. The large motors were easily able to cope with the highest speeds we dared to run. They barely got warm and did not seem to skip any steps.

On the y-axis I managed to fit stops on the round shaft. I also will fit similar stops on the shaft for the x-axis, but this means taking it off in order to tap threads in the shaft ends. For the first trial I fitted temporary stops by clamping some 50x25 rectangular box to the main frame.

The long drill bit of 315mm was wobbling too much. At some stage we replaced it with a Dormer A110 1/4" bit, which I rounded so it would become a ball nose bit. I was able to make deep cuts at high speed. See the pictures and video...

Step 14: Making a Mould for a GRP Part

Step added 18th of June 2012:

The end goal of the large CNC machine is not just to make shapes in polystyrene foam, but also to do something useful with the shaped foam. In first instance this would be the creation of composite moulds and or mouldings. In this step I will showcase the creation of a single use, polystyrene mould for a custom, GRP welding mask.

After designing a mould for the new mask, I created an STL file and opened it in FREEMILL. Here I created two sets of G-code: one for a rough cut (slices at 4mm intervals) and the next set for making the final cut (at 1.5mm intervals). The final cut is simply set 30mm deeper than the roughing cut. The roughing cut took a little over an hour to complete, whilst the final cut took around two and a half hours. As it was, the final cut resulted in noticeable steps on parts of the mould. This would have been improved by using 0.5mm intervals, but this would have taken three times as long, ie. seven and a half hours. In stead, I removed the steps by quickly sanding them down with a bit of sand paper, taking about three minutes to do...

Before being able to use the mould for creating the GRP part, it needs a protective layer, being latex paint in my case. I mixed a bit of blue from a paint sample into normal, white latex wall paint, and used this for the first layer. I then put more layers on of white latex, until the blue did not come through anymore. This way I was confident the protective layer of paint was thick enough.

Update 20th of June 2012:
The mould needed to be waxed and polished. I prefer to use honey wax for this, being the stuff made by bees. Three layers should usually be good enough for a single shot, I did apply four layers to be sure. The first part of a wet lay-up is usually the application of two layers of gel coat. I used two fairly thick layers of gel coat, having a red pigment mixed in. Having a thick layer will allow sanding down the part afterwards, in order to remove any imperfections in the surface. One or more layers of glass fibre, impregnated with laminating resin, follow the gel coat. In my case I used two layers of mat and laminating resin, having some white pigment mixed in.

After the resin hardens out, the part can be pulled from the mould. It can then be trimmed down, sanded to remove imperfections in the surface and polished to a shine. In the case of the welding mask, I will need to cut out a rectangle for the screen. The actual screen and the screen surround will be cut from a 'donor' mask, and bonded into the inside of the GRP shell. Attaching a handle to the shell will finish the assembly.

Step 15: Next Steps

  • obtain replacement stepper drivers, the plan is to make some myself using Toshiba TB6560 chips
  • finalise wiring
  • use opto coupler to turn router on/off remotely
  • paint everything
  • level everything to within +/- 0.1mm, using shims
  • replace bearings at floating rails for nylatron sliding blocks
  • handle backlash (up to 3mm on horizontal chains), potentially by modifying grbl (!)  7th of June 2012: found the source of the play, being the twist in the couplings. simply replacing them with better quality spider couplings should resolve the issue. no mod to grbl needed. 28th of June 2012: couplings replaced, see step 11.
  • 20th of June 2012: manage waste material. During the initial trials the extend and nature of dust generation by the machine became apparent. The main priorities will be to enclose the bottom part of the machine with boards and possibly curtains. The actual router tool would benefit from having ducting for cooling.
  • design a car, cut it in foam and use the shapes to produce a set of composite moulds...


RussS19 made it!(author)2016-10-31

Great Build! What type of coating do you use to protect the foam?

Lardo made it!(author)2016-01-12

Another 3D CAD option, in about the same league as Autodesk Inventor or Dassault's Solidworks (though in my opinion better than either) is KeyCreator, by Kubotek. ( It is a professional grade 3D solid modeling program that also includes 3D surfaces, 3D wire-frame, and 2D drafting, all in one package. And since it is a "direct" modeler, it is free of the constraints common to parametric CAD programs. Another huge advantage, of direct modeling, is that it treats ALL solid models as native files. This allows you to revise and modify imported files, regardless of what program they originally came from. Inventor, Solidworks, Pro/E, STEP, IGES, whatever. It doesn't matter. Because KeyCreator does not depend on a feature, or "history", tree, they're all treated if they were created in KeyCreator from the start. It's also easy to learn, with many on-line videos and tutorials. (PS: I don't work for Kubotek. I'm just a very happy customer/user.)

RTegelbeckers made it!(author)2016-01-30

Hi. Lately there have been more offerings then when I originally published the intructable. The two most interesting ones in my opinion, are Onshope and Autodesk's Fusion 360. Both are cloud based and free versions are available, with monthly subscriptions for the more extensive versions.

Direct modelling has it's advantages, but so does parametric modelling. The most powerful option is to have both available.

Lardo made it!(author)2016-02-01

I've been a parametric (Solidworks) user since 2003, because that's what my place of employment uses. And I've been through ALL the SWX training. I'm still looking for it's advantages. All it's ever offered me is frustration. Mainly do to the "constraints" getting in the way. (Why would anyone want to constrain themselves, anyway?)

RTegelbeckers made it!(author)2016-02-01

Hi again. At the start of a design I often identify certain dimensions which are open for optimization. By carefully building up a model with this is mind, I am able to very quickly tweak these dimensions in conjunction with immediate updates to the model. I find this incredible powerful for machinery design, although it does require some planning from the outset. If using a parametric package like SolidWorks for more organic shapes, I can imagine it would be frustrating due the lack of direct modeling tools.

Lardo made it!(author)2016-02-01

With KeyCreator, I don't have to give it that much pre-thought. I just go in and design. And any changes I decide on are simple and quick. KeyCreator has numerous different tools for moving, resizing, adding and/or removing geometry. And you don't have to worry about your model crashing because a parent/child relationship has been broken/corrupted or a constraint has been violated.

In my opinion, it's so much better than Solidworks, that when the company transitioned to SWX (in 2003) I bought a seat of KeyCreator myself. And I still use it (when I can get away with) for many projects.

Because we're a contract manufacturer, we work a lot with imported files. From all the "major" CAD programs. Anyone who has imported a parametric model from, say, Pro/E into Solidworks, know what a "dumb solid" is. I don't have that problem. Because KeyCreator works off the model's geometry, rather than a history tree, it treats ALL imported files as if they are native KeyCreator files. That's a huge advantage when I need to revise a customer's part, to make it manufactureable.

I've been using both, side by side, for over 12 years now. I'll take direct over parametric any day.

(Another advantage to KeyCreator is, though it is a full featured 3D solid modeler (along with 3D surfaces & 3D wire frame), it also still retains its full 2D drafting capabilities. And you can mix & match all of these tools in the same file. Very handy - and quick - when working out angles, dimensions, and different shapes.)

Divljina made it!(author)2016-01-02

Hi friend, your project is good :)

Can you tell me, do you know where I can find electrical scheme of driver Toshiba tb6506 ? Thank you in advance

RTegelbeckers made it!(author)2016-01-30

Hi. In the end I did not have to build my own drivers, as I managed to buy a set of YOUCNC drivers on Ebay. They were very cheap and they work very well. Although I have not used it myself, this might be a good starting point:

cyiangou2 made it!(author)2013-10-03

hello, I really like your project and I would like to do it. Can you help me please how to connect all electronics parts or how to program the arduino?
Thank you

donkeyknee made it!(author)2013-07-18


Finster101 made it!(author)2013-06-27

Cool machine! Do you have any pics of the part you molded from the mold you showed cut in this instructable? I'd love to see the finished product.

RTegelbeckers made it!(author)2013-06-28

Thanks for your comment! The red gel coat resin I used was over ten years old, having been at the bottom of a badly sealed bucket. As such it did not want to harden out properly. I applied the laminating resin with extra hardener in the vain hope to compensate. This only resulted in the generation of too much heat, which caused the melting of the polystyrene mold in certain places. I left the part in a corner of my workshop as after several days the gel coat was still tacky. By now it must be ok to still do something with the part. As you reminded me by posting your question, I will dig it out next time I am in my workshop and finally finish it off! In the first week of July I have some panels to machine on the big CNC, so I will have a go at it whilst 'babysitting' the machine. Pictures will be posted soon after that...

cjc0306 made it!(author)2013-04-16

Hi RT! Congratulations on a fine build. I am in the process of building a similar machine inorder to print some prototypes of my inventions. Since I have left over aluminum 1 5/8" tent poles laying around, I decided to build the foam cnc with them instead of square tubing. The current design Im prototyping measures 32" x 60", so I need a large machine. I have already built a 3D printer so Im pretty familiar with cnc technology. Any suggestions would be greatly appreciated, thanks.

RTegelbeckers made it!(author)2013-04-17

Hi. How do want to connect the aluminium tubes to each other? Welding aluminium is not easy and usually requires a TIG welder.

In the near future I will make some alterations to my own machine. On the horizontal axes I want to further reduce the backlash and add gearing, by replacing each coupling with a chain and two sprockets. A ten tooth sprocket on the motor and a twentyfive tooth sprocket on the drive shaft will give a 1:2.5 reduction. Check my instructable in a few weeks as I will document the upgrades.

My z-axis is not very stiff in sideways direction, especially when the tool is all the way down. Not much of a problem for shaping large pieces of low density foam, but could be an issue in other applications.

Good luck wih your own machine!

RTegelbeckers made it!(author)2012-10-09

Thanks! I am a bit busy at the moment - preparing a new Instructable amongst other things - but I hope I will soon be able to make some updates to the big machine & this instructable. If you are into CNC, you might find my new instructable of interest. It should appear on this website in a few days...

PS. I assume you are connected to somehow. May I ask in what way?

Vika84 made it!(author)2012-06-21

Good Luck babe! xx

RTegelbeckers made it!(author)2012-06-21

Thanks gorgeous! Sorry for having spent the last two months in my workshop... xxx

FoolishSage made it!(author)2012-06-05

This is a really cool build! Can you estimate how long it took and how much it ended up costing?

RTegelbeckers made it!(author)2012-06-05

Thanks! The total cost for the small machine was £70 (mainly for electronics)and it took the occasional hour over a few months. The second, larger machine took several days over the last two months. The total cost for parts and consumables was £665. I also spend £28 on job specific tools, just as reamers (8mm & 10mm) and drill bits.

RTegelbeckers made it!(author)2012-06-19

I noticed I missed out on a few items on my initial costing. I now worked out the total cost for parts and consumables as being £728. This does not take into account the materials I already did have. See step 6 for a Bill Of Materials.

mgingerich made it!(author)2012-06-05

Have you considered building custom motor drivers? I'm making a CNC with from scratch electronics right now, and it's worked pretty well so far. Way cheaper too. Just something to think about. Great instructable!

robbert229 made it!(author)2012-06-08

So I am not the only cheapo person on the web. That's nice to know, so how are you planning to build the electronics from scratch? I am sort of a person with shallow knowledge in this field, and would appreciate you sharing the knowledge that you have with me.

mgingerich made it!(author)2012-06-09

I'd be happy to. My way of doing things was a little unconventional, since I'm controlling my CNC with a microcontroller. The schematic on page 3 of this instructable is the main part of my motor driver. four of these are needed to control one unipolar stepper motor. I'll let you know when I write a more detailed instructable on it.

mgingerich made it!(author)2012-06-09

Here's the link:

robbert229 made it!(author)2012-06-09

Very interesting, looks much easier than using some relays. Thanks! I shall be making my CNC's main chassis today. I just finished gutting a printer, and scanner, so now I have some steppers, worms, etc. The only thing is that I cant decide on what material to make the body. Wood, plastic, steel, I dont know what it should be made of, probably wood or steel though. Thanks for the insight, I have a picaxe 18x lying around that will work great with the opticoupler.

mgingerich made it!(author)2012-06-09

Glad I could help :) What tools did you use to machine your steel? I'm restricted to wood so far because I don't have access to a shop. Let me know when you get your machine built!

RTegelbeckers made it!(author)2012-06-11

I have used a 'custom driver' on an x/y table I played around with, years ago. I used four PN2222 transistors, four MJE3055T transistors and four MJE2955T transistors to drive a single stepper. I used a DPDT relay to switch between the two stepper axes, losing holding torque in the process. The maximum current would have been in the order of 1A at 12Volt. I will now make a driver based on a Toshiba TS6560, which I can get for £2.24 each, incl. delivery:
The driver is not only good value, it also is economical on the ports needed on the microcontroler: per axis it only needs one line for steps and one line for direction. This means a bottom of the range arduino uno can easily handle three axes and will be left with a few lines spare. On top of this, it will allow for microstepping. This is essential on my rig as each step would otherwise be 0.4mm in size. It saves me from having to add a costly gear reduction to the motors..

ketirock made it!(author)2012-06-08

Very Impressive.

Vika84 made it!(author)2012-06-05

I managed to get movement by using the 12 volt pololu based electronics from my first, smaller CNC machine. In one direction the main carriage did move sort of ok, but in the other direction it needed a bit of help as it was jurky. The Toshiba based drivers running on 24 volt should in theory be good enough for the job. As I only give it a quick try, I hope I can still get them to work by tickering a bit more. Otherwise I will be very interested in your custom drivers!

PS. The price for the TB6560 drivers was pretty good: £36.65 for all three incl. delivery - source: Ebay

RTegelbeckers made it!(author)2012-06-05

OOPS! I was logged in under my wife's credentials for the last comments... Check out her instructables and especially the one for the Swan if you want to impress at a diner party!

About This Instructable




Bio: I am a Dutch design engineer, living in Wales (UK) and working in steel industry until recently, as my request for voluntary redundancy did get ... More »
More by RTegelbeckers:3D Printed spectrometer, using Public Lab DIY kit.DeltaTrix 3D PrinterFoot operated log splitter
Add instructable to: