Introduction: CNC Machine for Shaping Large Pieces of Polystyrene Foam

About: 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 accepted. I am married, and I am a father to a little boy. I like…


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...
Make It Real Challenge

Runner Up in the
Make It Real Challenge