Introduction: 3D Printed Raspberry Pi2 Case Designed in OpenScad
This is a simple case to house a Raspberry Pi 2 or B+.
I used Octoprint to running my Printrbot Simple metal printer
- It is designed in Openscad and can be changed and modified in OpenSCAD.
- Easy to edit or improve
OpenSCAD is free and is a great way to design 3d objects. I happen to find it easier to describe shapes in "words" and mathematics than to master the mouse and keyboard skills of more visual programs.
Step 1: Requirements to Print the Rasp Pi Case
Basic requirements (OpenSCAD recommended but not essential)
1. 3D printer.
2. STL files - Just Download or make in OpenScad (see below)
3. Filament. (Use a pale or partly transparent colour. I used yellow 1.75mm PLA)
4. About 2-3 hours of printing
4. Two 25 mm M3 screws
5 Two 8 mm M3 screws
6. 4 M3 Nuts
Making the STL files with Openscad.
Download the files and open scad program from GitHub
Step 2: Measurements and Design Considerations
The basic dimension are set by the Raspberry Pi board. The case is intended to be not much larger than the board. It is "slim line" which means that the top of the USB parts for part of the top of the case. It would be easy to make a "fatter" design by tweaking some parameters in OpenSCAD.
The board has 2mm gaps and with a a plastic thickness of 1.5mm this makes t 7mm larger than the board. The case is 20mm high to match the metal top of he USBs and ethernet which I leave exposed.
The lid and bottom are sliced half way (10mm).
The board has a number of devices, such USB, camera connector, SD etc.
The position and sizes of a device were measured with a caliper from the bottom left hand corner of the board (near the micro power USB). The measurements are organised a column and of translates and cube sizes. I use two further columns to "fudge" the position and size. Thus there is a total of four columns of vectors:
1. A translate vector to move cubes to the actual place on the board.
2. A size vector which is the actual size of the device.
3. A shift vector (adjust the position of the device)
4. A resize vector (Mainly to enlarge so taht the device pokes through the case)
An example of "fudging" is the hole for the micro SD card. The hole for the SD has to be made larger and lower to give adequate access.
Measurements are relative to the board so we have to shift coordinates to make them use the same coordinates as the box. This factor is the shift vector.
Note: I believe the RaspPi2 is physically the same as the RaspPiB+
Step 3: Overview of the Openscad Program
1. Make a solid box with rounded corners.
2. Make a shape that accurately represents the raspiberry pi board.
3. Stretch and move shapes on the board so they stick through the case.
4. Add the interior of the box.
5. Substract this adapted board shape and interior from the solid box.
6. So far we have the basic shell. Cut it longways into top and bottom.
7. Add in standoffs for the board, some lugs for the lid and drill the holes.
OpenSCAD designs are easy to make parametric.
This means it easy to make changes and adjustments by changing some values or to adapt a design to make something completely new.
This design, like many OpenSCAD designs, is probably more functional than "pretty". Fancy logos and decorations can be done in OpenSCAD but require a fair bit of work.
Under the hood, OpenSCAD has a quite sophisticated programming environment.
The mathematical approach to 3D design and the implementation in OpenSCAD has some limitations but it is capable of some pretty amazing and elegant designs.
Step 4: How the Openscad Program Works
- Parameters. -These are mostly just numeric values.
- Measurements (4 columns table of vectors)
- Vectors used by the building Modules (mostly groups of measurements or parameters) 4. Modules to build the case.
- Modules - working code that actually builds the shape
Parameters - note all programs are commented in the program.
board = [85, 56 , 1.3 ]; //dimension of rasp pi board
t = 1.40; //Thickness of rasp pi board p = 1.5; //Thickness of plastic case
g = 2; //gap around board $fn = 12; //roundness of rendering
rb = 4; //roundness of box
stand_off = 3; //raise board above bottom plastic
box = board + [7 , 7, 20]; //outside dimensions of our case
bh = 10; //Where to slice box
d = 3.5; //displacement of hole from edge
huge = 200; // a very big value for drilling out holes etc
eps = 0.01; //a very tiny value (to things "manifold")
The devices are build and the interior of the box are build into a funny shaped spiky object called the "echidna". The "echidna" is subtracted from a solid cube representing the case leaving a shell with holes. This is then sliced long ways to make the top and the bottom of the case. Finally some holes, lugs and standoffs are added.
Echidna : Put all the measurements in a vector Shift: Move board coordinates to box coordinates
Holes: Where the screw holes are
Toplugs: Vector so we can make the lugs for the case lid
Bottomlug: Vector for the lug on the case bottom
These actually build the device or add things like lugs and holes
module hull_build(box,r): Make a solid shape with rounded corners.
module complete_box(): Subtract echidna from the rounded box above
module stand_off(): build little cones with holes to lift board off base.
module top_holes(): Drill holes in the lid and reinforce.
top(): Chop the bottom off to make a lid. Add lugs to help locate the lid on the base.
bottom(): Chop the top off to make the base. Add standoffs, holes and a lug.
Finally we call top() and bottom() and move them around a bit so that they fit on the printer nicely. (I don't think Octoprint has the ability to move things around like Repetier)
Fancy programming -children.
Stand_off() and top_holes() use "children". This is an "advanced" technique documented in the examples of OpenScad but it is actually quite easy once you get your head around it. It can make the program more self documenting and it good for repetitive but fairly complex actions. It is not strictly necessary to use "children" in a small project like this but it is a good technique to learn () if say you want to drill a lot of similar holes in a number of different shapes.
Gripe about OpenScad.
My biggest gripe about OpenScad is that there is no introspection. In other words if you mix and lot of shapes and move them around there is no way to get positions and dimensions from the shape itself. You have to keep close track of where things are yourself (hint). (Even a bounding box would be nice and should not be too hard to implement)
Step 5: Printing...
The printer is a PrintrBot Simple metal (PSM)
Slicing is done in Cura with the default profile for PSM except that the temperature of the extruder is dropped to 202C
The following are filament lengths and times take from Cura (which is used on the Octoprint).
The values in Cura say that the top takes 2.9m of filament with a print time of 49mins.
The bottom takes 1 hour 13minutes and takes 4.4 metres of filament.
(see Screen shots)
I think the actual times are a fair bit longer (?heating time etc).
I printed on blue Scotch tape with a heated bed.
Filament: yellow 1.75mm PLA.
Step 6: After the Print
I got a but of stringing and blobbing which I rubbed off by hand
I expanded the holes to 3.2mm (1/8 inch) so the M3 screws were loose.
The nuts did not actually go in the nut capture holes (by design)
I put each nut on a screw and pushed it against the nut capture hole with a hot soldering iron so it melted nicely into the hole.
Attaching the lid.
I used the two short screws through the standoffs to hold the board.
I used the two long screws to hold the lid on. These pass through the lid and the Stand_offs.
Coke Bottle aerial
My shed is in a bit of a WiFi shadow.
I have a "coke bottle" WiFi aerial which I found worked better than an actual WiFi extender. At the moment the bottle neck is just held with a clamp but I will probably make a stand for the bottle. I would like to enable the camera so I will need to make a stand for that. Maybe I will make a clip to attach it to over the case.
Note: I think I got the idea for the drink bottle aerial on an Instructable, but I cant find it, so I apologise for not referencing the relevant instructable or other webpage.
We have a be nice policy.
Please be positive and constructive.