Raspberry Pi – adventures in case building

Raspberry pi with cherry case milled on cnc

Recently I was given a raspberry pi, it’s something I’ve thought about buying to play with a few times but hadn’t quite got around to what with other hobbies keeping me busy enough. However, I wasn’t about to turn down one as a gift. I won’t go into much about the device itself, there is plenty around about setting them up and what they’re capable of.

The important point is that they come as a bare circuit board, much like an arduino. This makes one of the first requirements to get a case to put it in. Now there are plenty around and mostly not too expensive, but anyone that has read even a few of my blog posts would realise I’m really not the kind of person that buys something like a case when I could just try to make one myself.

So I set off browsing through thingiverse looking to see what different designs existed. For the arduino I cut a case as 6 sides that interlocked to form the case, which is the kind of thing that you do when you have flat sheet materials and want to make a box. However, on this occasion I decided that I really wanted to try milling a case from a block of cherry.  The idea was to mill out the bottom and top halves that would then fit together. Most of the designs on thingiverse assume that you are going to use a 3d printer to create this kind of case, however the designs work just as well for milling out of a block.

The attempt was not without its failures…

The idea was to use a large 10mm bit to rough out the basic shape, then use a 3mm bit for finishing. Initially I setup the CAM to cut both the top and bottom pieces from a long thing block as part of the same job. The problem with this is that the job takes so long to run, and a mistake anywhere ruins the entire run.

Fail 1:- When setting up the model I made a few adjustments from the original on the basis that I would be using wood and cutting out rather than printing from plastic. I needed the wall thickness to be thicker. I made my modifications and generated some tool paths, but I kept getting errors about unsafe tool paths. I couldn’t figure out why or where the problem was, but I did figure out how to turn off the warning…ok stupid idea, but I’m still learning.
It turned out that at some point in the model it didn’t have a clean solid part for one wall of the top half, it was actually represented as two pieces stacked on top of each other. This was not easy to spot by eye, but the tool path generation had figured out it was being asked to move across the top of the lower wall piece which would take it through the upper wall piece. This became apparent to me when I watched as my cnc router, having carefully milled around the outside profile of the wall, carved straight through that section levelling it off much lower. stupid boy.

lesson 1: – don’t turn off the warnings, the computer is smart and you’re an idiot.

I went back and fixed the model, switched the warning back on, and regenerated. Good to go…

Fail 2:- After probably 4 hours of milling accross 2 days, I had failed to recheck the tightness on the chuck holding the router bit. During a cut the bit began to slip, as it bit into the wood and due to the increased friction get dragged further down and out of the chuck. To be fair to the spindle it kept on chewing throught the wood even as the cut depth went to something like 10-12mm, however the stresses on the machine by then were enough to pull the cutter off course, and into the area of the case. I hit the emergency stop, but I was too late, it was going to be difficult to reset the machine aligned properly with the workpiece again, and even if I could the top half was already ruined.

lesson 2:- Don’t try to mill multiple large complex parts in a single pass, break them into smaller units such that any failure impacts less work
lesson 3:- Always recheck the tightness of the chuck, particularly when its been a few days and temperature changes since the last run.

I split the model into a top half and a bottom half, and set about milling the bottom half.

Roughing it raspberry pi box bottom:

Fail 3:- I set the machine back to milling on a new block of cherry. In the interim I’d found some settings around exact stop versus constant velocity and was able to set the machine to actually run quite a bit faster than it previously was working. It made fairly short work of the 10mm roughing pass, and I got to switch to the 3mm cutter and watch it nicely refine the shape. It worked perfectly. though I did find that the roughing pass + the finishing pass left some places where the rough with 2mm clerance had left 2mm of material but which the finishing pass did not then go over. because the waterline finish doesn’t go over top surfaces. So I had to manually tweak a few things to make it do a proper final pass to clean up those few places. This to, worked perfectly.
I brought it in and set to fitting the raspberry pi into it, this required a little sanding, of the box and the corners of the raspberry pi. The model is a very tight fit and the radius of my cutters meant that corners weren’t as sharp as the pcb. However after a few tweaks I got a really nice, snug fit for the raspberry pi in its new bottom half case in cherry. It looks awesome.

Final pass raspberry pi box bottom:

however, we’re still in fail 3…

The block of cherry I used to mill the case from had been in my garage, for at least a year, and over one of the wettest winters the UK has seen for about a century. After a week in my centrally heated house, the very thin, very precise case, had shrunk around the raspberry pi, and seriously warped across the thin base.  I had forgotten the basics of working in wood. if it is not dry or even just not already acclimatised to teh environment you ultimately want it in, then the change of environment can easily be enough to shrink/grow and generally shift the material around. it is really not that suited to making accurate engineering type cases. At least not unless you started with really dry stable wood in the first place.


Lesson 4: – Wood is a living material, don’t mill wood that has been in the garage for months and expect it to stay stable when put in a centrally heated house.

So, back to the drawing board. I need a case, cherry is probably not a great idea. This lead me to the pibow case, which has the designs available on thingiverse free for non-comercial use. The pibow case design is one of layers. Basically 8 layers, each 3mm thick and each with cut outs that fit around the parts of the raspberry pi at that point. This is back to the idea of cutting something from sheet stock to produce a case, rather than milling out of a block. This time I turned to some hdpe sheets that I had, which would also be stable and not warp when brought into the warm.

Milling pibow layers from hdpe:

Fail 4:- New plan, new material, the machine had been capable of a nice precise milling operation and the only previous problem had been material which I was now getting rid of by switching to HDPE. Let’s rock this thing! In my haste to get going again down this new path, I mounted a sheet of hdpe on top of a block of mdf with some clamps at 4 corners and I failed to notice that the block of mdf was substantially thinner at one side than the other. Having set my z=0 at the surface in one corner I didn’t notice that the rest of the sheet was substantially higher. The first cut that was supposed to be 1mm turns out to cut clean through the sheet in one go, wiping out any attempt at holding tabs and generally making a mess.

lesson 5:- Don’t get cocky kid, check the levels, make sure if you’re resting material on something that that something is consistent thickness across its surface.

Fail 5:- New setup, nice even thickness of mdf. Clamps caused the hdpe to bow up in the middle, but not too bad…I milled the base layer, and even engraved the little markings on it with some success. However I failed to notice that my two x-axis motors were nearly 9mm out of alignment from previous problems. So whilst it cut fine, the outside profile wasn’t square/parallel in its lines, essentialy the y axis was not cutting at 90 degrees to the xaxis

Lesson 6:- similar to lesson 3, – recheck the machine setup before you start. including that the x-axis motors are still in alignment.

Fail 6:- the hits keep coming…milling the exterior profile of the layer followed by milling out the interior spaces means that there is less support for the cutting than doing it the other way around. the thin walls of the quite delicate design bow under stress, break through the very small holding tabs you configured thinking you didn’t want to have to cut out too much by hand. the whole layer pulls free and is destroyed

Fail 7:- You think that milling out the interior spaces before the exterior cut out will solve your problems and don’t increase the holding tab sizes…but you are wrong, the thin walls and pressures of the cuts are still not suitable and the thin holding tabs easily snap away, destroying another layer

Lesson 7:- holding tabs are important, and you probably need more than you imagine. and they should be big enough to provide real support. Yes there is a trade off of too much time cutting out later, but err on the side of caution


So I’ve had a lot of failures, and a lot of lessons learned. and I currently have about 4 layers I’m semi-happy with. And I think I no longer have enough 3mm hdpe sheet to finish the remaining layers ;-(
For all the failures I’m still pretty happy with how precise the machine is in terms of the path it follows. I think I have to chose a better cutter for this  material as the 2mm end mill I was using left a pretty rough surface. This has turned from ‘oh I’ll just cut out a box for the raspberry pi’ into a series of experiments to learn more about what it means to work with different materials and get reliable results.

Maybe the next one will be the ones that goes perfectly…

, ,