You’ve written your firmware code, etched your own PCB, and now it’s time to put that awesome new project of yours into an enclosure. Unfortunately, all you have is a generic Radio Shack project box that you picked up when they were clearing out their inventory. If you put your project in that, it’ll have all the style and grace of a kid wearing hand-me-down clothes. Your project deserves a tailor-made enclosure, but the prices and lead time on custom plastic enclosures are prohibitive for one-off projects.
In Ye Olde Olden Days, the next step might have been to start bending some sheet metal. But it’s the 21st century, and we’ve got mechanization on our side. The “Ultimate Box Maker” by [Heartman] is a fully parametric OpenSCAD design which allows you to generate professional looking enclosures by simply providing your desired dimensions and selecting from a few optional features. In a couple of hours, you’ll have a custom one-of-a-kind enclosure for your project for a few cents worth of filament.
That’s the idea, at least. For this edition of “Printed It”, I’ll be taking a look at the “Ultimate Box Maker” by generating and printing a basic enclosure. As somebody whose Radio Shack was out of enclosures by the time I got there and who doesn’t want to slice his hand open folding sheet metal, I’m very interested in seeing how well this design works.
So in theory, this design is supposed to work with the Thingiverse Customizer, which is basically just a web front-end for OpenSCAD. You get nice little sliders and dialog boxes, and once you have all your information entered, it will render you a custom STL to download. It’s arguably one of the best ideas MakerBot has come up with in regards to how Thingiverse works. Unfortunately, at the time of this writing, Customizer doesn’t seem to work anymore and just gives an error about missing
In that case, we’ll need to download the .scad file from the “Thing Files” tab and open it up in OpenSCAD locally. All the configuration values are up at the top of the file and clearly labeled, which makes this fairly easy.
Obviously, you’re going to want to adjust the overall box dimension variables at the minimum. But there are also a whole set of options for PCB standoffs (position, diameter, screw size, etc), as well as options related to the built-in vents.
Making use of the OpenSCAD
import(); function, you can bring in an STL of an existing PCB and see exactly how it will look in the rendered case. As a demonstration, I’ll be making a small enclosure for the Pi Zero, so I’ve imported an STL of it and used that to align the PCB standoffs. But even if you don’t import an STL to use as a guide, there’s a helpful “ghost PCB” that floats around inside the case while your editing the file in OpenSCAD.
Exporting the STL
Once you’ve edited the variables to your liking, you’ll want to scroll a little farther down in the code to find a section that looks like the following:
/* [STL element to export] */ //Coque haut - Top shell TShell = 0;// [0:No, 1:Yes] //Coque bas- Bottom shell BShell = 1;// [0:No, 1:Yes] //Panneau avant - Front panel FPanL = 0;// [0:No, 1:Yes] //Panneau arrière - Back panel BPanL = 0;// [0:No, 1:Yes]
These options selectively turn on and off the different parts of the model for when it comes time to export the STL. If you don’t turn the other parts off before export, you’ll just get a useless “assembled” STL.
Unfortunately, the script is not smart enough to reposition the objects for STL export; so you’ll have to manually flip over the top piece in your slicer, for example. Another annoyance I found is that, even if you turn off the bottom of the case (BShell), the PCB feet still remain. You need to go back up to the script configuration settings and turn them off manually, look for the option called “PCBFeet”.
Having worked with OpenSCAD for a while I know why [Heartman] wouldn’t have included rotating the parts on export: it’s a whole lot of code to implement something that the end user can do with a click in their slicer. But making sure the PCB standoffs aren’t rendering when the user is just trying to get the top or side panel is a fairly big omission and would really only take a single conditional statement to fix.
Finally, there is some early support for generating customized front and rear panels, including functions to generate openings and labels. But personally, I would suggest just taking the blank panel generated by the OpenSCAD script and importing it into a 3D CAD program your comfortable with. The panel generation code just isn’t ready for prime-time, in my opinion.
The design that [Heartman] has come up with for the case is really quite clever, and shouldn’t pose a problem printing. There are no overhangs so support is unnecessary, though you may want to turn off the vents if your printer has issues with stringing, as the thin openings can get clogged up. I printed my case at 0.2 mm layers and 15% infill, though larger cases could probably get away with 0.3 mm layer height for the sake of speed.
The design is forgiving in terms of tolerances, and no cleanup was needed after printing to get the parts together. The fit on the front and rear panels is perfect; loose enough that they don’t need to be sanded to git in the channels but tight enough that they don’t rattle around once the lid is screwed down. Incidentally, you must screw the lid down, as the two pieces don’t actually have any interlocking components. A potential improvement to the design would be a way to make the lid snap-fit.
Overall, I think the enclosures generated by the “Ultimate Box Maker” OpenSCAD script are fantastic. They look extremely professional, are very sturdy, and print easily. This is definitely a design I’ll be adding to my regular bag of tricks going forward.
I especially like that this is a printable design that clearly addresses a valid need. One-off projects need one-off enclosures, and 3D printing is perfect for that. While we’ve previously covered printed tools that deserve a spot on your bench, the argument could always be made that you’d be better off buying the “real thing”. But I believe this project offers a solution which is actually superior to traditional methods in a number of ways.
Thingiverse’s Customizer dropping the ball on this one is especially annoying, as [Heartman] went through the trouble of making sure his design worked with it — there’s some special syntax Thingiverse has you add to OpenSCAD to make their front-end work. Having a web-based tool to generate custom enclosures would be extremely handy, and I wonder if somebody in the community might just take up the challenge of restoring the service MakerBot seems not to maintain?