Skip to content

Instantly share code, notes, and snippets.

@megglos
Last active August 29, 2015 14:20
Show Gist options
  • Save megglos/ee370e46f64f490cc111 to your computer and use it in GitHub Desktop.
Save megglos/ee370e46f64f490cc111 to your computer and use it in GitHub Desktop.
//##############################################################################
/*
An enclosure for the GIZMO 2 SBC
Original by Brian Welsby January 2015
Remix by Don Megglos April 2015
Version 1.0_30-Jan-2015 First public release
Version 1.1_01-Feb-2015 Increased fan vent size.
Added screw cap clips.
Version megglosRemix No pci hole
Classical top fan vent
Middle side and front vents
Buttons on front
*/
//##############################################################################
$fn=30;
// Choose what to render and view or print
// These are just for viewing during development
//gizmo2();
box();
//exploded_view();
//##############################################################################
// Print items - uncomment one,render and export the STL
//rotate([180,0,0]) top();
//rotate([180,0,0])
//rotate([180,0,0]) middle();
//base();
//button(); translate([10,0,0]) button();
//end_cover();
//rotate([90,0,0]) screw_cap_clip();
//##############################################################################
//##############################################################################
//
// This is a composite of all the elements that make up the space inside the box,
// with extra parts to create holes in walls where required. This will then be
// subtracted from a solid block which is then sliced for printing
//
module gizmo2() {
difference() {
union() {
// Main board space
//
// The PCB is 1.6mm thick and located with the
// corner nearest the power connector at [0,0,0]
// There is 10mm space below the PCB, 48.3mm above
// and 1mm at each side for an easy fit.
//
translate([-1,-1,-10]) cube([102,102,50]);
// Power connector
translate([7,-5,1.6]) cube([10,5,11]);
// HDMI
translate([21,-5,1.6]) cube([16,5,8]);
// USB3
translate([43,-5,1.6]) cube([15,5,17]);
// Audio
translate([61,-5,0]) cube([7,5,7]);
// Ethernet / USB2
translate([71,-5,1.6]) cube([20,5,31]);
// uSD
translate([100,67.5,1.6]) cube([5,15,5]);
// Expansion port
// translate([-1,101,-10]) cube([102,5,20]);
// Use the button and scale up a little to give
// some clearance.
//
// Power button
translate([15,100,28]) rotate([270,90,0])
scale([1.2,1.2,1]) button();
// Reset button
translate([30,100,28]) rotate([270,90,0])
scale([1.2,1.2,1]) button();
// fan hole
translate([42,46,36]) cylinder(r=20,h=6);
}
// Now we need to add some structures back again.
//
// Mounting posts
// These are positioned so the board is mounted with
// 2mm clearance at the connector end and a gap of
// 1.7mm for the pcb
//
// Screw head support in base
translate([3.5,5,-10]) cylinder(r=6, h=4);
translate([96.5,8.5,-10]) cylinder(r=6, h=4);
translate([3.5,89,-10]) cylinder(r=6, h=4);
translate([96.5,89,-10]) cylinder(r=6, h=4);
// Main post in base
translate([3.5,5,-6]) cylinder(r=3, h=6);
translate([96.5,8.5,-6]) cylinder(r=3, h=6);
translate([3.5,89,-6]) cylinder(r=3, h=6);
translate([96.5,89,-6]) cylinder(r=3, h=6);
// Main post in middle part
translate([3.5,5,1.7]) cylinder(r=3, h=40);
translate([96.5,8.5,1.7]) cylinder(r=3, h=40);
translate([3.5,89,1.7]) cylinder(r=3, h=40);
translate([96.5,89,1.7]) cylinder(r=3, h=40);
// Screw head support in top
translate([3.5,5,36]) cylinder(r=6, h=6);
translate([96.5,8.5,36]) cylinder(r=6, h=6);
translate([3.5,89,36]) cylinder(r=6, h=6);
translate([96.5,89,36]) cylinder(r=6, h=6);
// Tie posts to side wall
translate([-1,2,-10]) cube([4.5,6,10]);
translate([-1,2,1.7]) cube([4.5,6,40]);
translate([96.5,5.5,-10]) cube([6.5,6,10]);
translate([96.5,5.5,1.7]) cube([6.5,6,40]);
translate([-1,86,-10]) cube([4.5,6,10]);
translate([-1,86,1.7]) cube([4.5,6,40]);
translate([96.5,86,-10]) cube([6.5,6,10]);
translate([96.5,86,1.7]) cube([6.5,6,40]);
// Button panel slot
translate([5,91,24]) cube([2,11,12]);
translate([7,95,24]) cube([2,6,12]);
translate([7,91,24]) cube([4,2.3,12]);
translate([5,91,22]) cube([4,10,2]);
translate([38,91,24]) cube([2,10,12]);
translate([36,95,24]) cube([2,6,12]);
translate([34,91,24]) cube([4,2.3,12]);
translate([36,91,22]) cube([4,10,2]);
// Extra support over ethernet connector
translate([-1,-1,33]) cube([102,4,3]);
// Fan border
difference() {
translate([42,46,36]) cylinder(r=22, h=6);
translate([42,46,36]) cylinder(r=20, h=6);
}
// Fan cover
translate([42,46,36]) union() {
// center cylinder
translate([0,0,2]) cylinder(r=5, h=4);
// middle circle
translate([0,0,2]) difference(){
cylinder(r=20/1.5, h=4);
cylinder(r=18/1.5, h=4);
}
// lanes
for (i = [1:6]) {
rotate([0,0,i*30])
translate([-1,-21,2]) cube([1.5,42,4]);
}
}
}
// Having added some structures back we now add some holes.
// Mounting holes clearance for base and top, tap for middle
// Screw head
translate([3.5,5,-12]) cylinder(r=3.25, h=3);
translate([96.5,8.5,-12]) cylinder(r=3.25, h=3);
translate([3.5,89,-12]) cylinder(r=3.25, h=3);
translate([96.5,89,-12]) cylinder(r=3.25, h=3);
// Screw base
translate([3.5,5,-9]) cylinder(r=1.7, h=9);
translate([96.5,8.5,-9]) cylinder(r=1.7, h=9);
translate([3.5,89,-9]) cylinder(r=1.7, h=9);
translate([96.5,89,-9]) cylinder(r=1.7, h=9);
// Tap middle
translate([3.5,5,1.7]) cylinder(r=1.4, h=35);
translate([96.5,8.5,1.7]) cylinder(r=1.4, h=35);
translate([3.5,89,1.7]) cylinder(r=1.4, h=35);
translate([96.5,89,1.7]) cylinder(r=1.4, h=35);
// Screw top
translate([3.5,5,36]) cylinder(r=1.7, h=3);
translate([96.5,8.5,36]) cylinder(r=1.7, h=3);
translate([3.5,89,36]) cylinder(r=1.7, h=3);
translate([96.5,89,36]) cylinder(r=1.7, h=3);
// Screw Head top
translate([3.5,5,39]) cylinder(r=3.25, h=3);
translate([96.5,8.5,39]) cylinder(r=3.25, h=3);
translate([3.5,89,39]) cylinder(r=3.25, h=3);
translate([96.5,89,39]) cylinder(r=3.25, h=3);
// vent holes on the middle part
// sides
for(i = [0:6]) {
translate([-8,15+(i*10),14]) rotate([0,90,0])
hull() {
cylinder(r=1,h=8, $fn=6);
translate([-16,0,0]) cylinder(r=1, h=8, $fn=6);
}
translate([100,15+(i*10),14]) rotate([0,90,0])
hull() {
cylinder(r=1,h=8, $fn=6);
translate([-16,0,0]) cylinder(r=1, h=8, $fn=6);
}
}
// front
for(i = [0:4]) {
translate([45+(i*10),100,14]) rotate([0,90,90])
hull() {
cylinder(r=1,h=8, $fn=6);
translate([-16,0,0]) cylinder(r=1, h=8, $fn=6);
}
}
// Vent holes for the underside of the PCB
for(i = [0:6]) {
translate([-8,15+(i*10),-8]) rotate([0,90,0])
hull() {
cylinder(r=1,h=8, $fn=6);
translate([-6,0,0]) cylinder(r=1, h=8, $fn=6);
}
translate([100,15+(i*10),-8]) rotate([0,90,0])
hull() {
cylinder(r=1,h=8, $fn=6);
translate([-6,0,0]) cylinder(r=1, h=8, $fn=6);
}
}
for(i=[0:7])
for(j=[0:7])
translate([15+i*10,15+j*10,-15]) cylinder(r=3, h=8, $fn=6);
}
//##############################################################################
//
// The final enclosure in one piece
//
module box() {
difference() {
// Start with a rounded box, 106 x 106 x 54 (W x L x H)
hull() {
translate([0,0,-9]) sphere(r=3);
translate([0,100,-9]) sphere(r=3);
translate([100,0,-9]) sphere(r=3);
translate([100,100,-9]) sphere(r=3);
translate([0,0,39]) sphere(r=3);
translate([0,100,39]) sphere(r=3);
translate([100,0,39]) sphere(r=3);
translate([100,100,39]) sphere(r=3);
}
// Now remove all the inside and openings
gizmo2();
}
}
//##############################################################################
//
// End cover for expansion port
//
module end_cover() {
difference() {
union() {
cube([102,22,1]);
translate([0,1,1]) cube([102,20,8]);
}
translate([1.5,2.5,1.5]) cube([99,17,8]);
for(i = [0:9]) {
translate([6+(i*10),6,0])
hull() {
cylinder(r=1,h=3);
translate([0,10,0]) cylinder(r=1, h=3);
}
}
}
}
//##############################################################################
//
// A small button push for Power and Reset
//
module button() {
scale([1,0.5,1]) cylinder(r=2.5,h=5,$fn=6);
cylinder(r=3.5,h=1);
}
//##############################################################################
//
// Screw cap clips.
//
module screw_cap_clip() {
difference() {
union() {
cube([60,9.5,10]);
translate([0,9.5,5]) rotate([0,90,0]) cylinder(r=5, h=60);
}
translate([5.75,6,0])
difference() {
hull() {
cylinder(r=3,h=10);
translate([48.25,0,0]) cylinder(r=3,h=20);
translate([48.25,20,0]) cylinder(r=3,h=20);
translate([0,20,0]) cylinder(r=3,h=20);
}
translate([-3.25,3.75,5]) sphere(r=3.2);
translate([51.25,3.75,5]) sphere(r=3.2);
}
translate([4,4.5,0]) cube([52,20,20]);
}
}
//##############################################################################
//
// The various sections for printing,
//
//##############################################################################
module base() {
difference() {
box();
// Cut off middle + top
translate([-10,-10,1.7]) cube([120,130,53]);
}
}
module middle() {
difference() {
box();
// Cut off top
translate([-10,-10,36]) cube([120,130,10]);
// Cut off bottom
translate([-10,-10,-15]) cube([120,130,16.7]);
}
}
module top() {
difference() {
box();
// Cut off middle + bottom
translate([-10,-10,-15]) cube([120,130,51]);
}
}
//##############################################################################
//
// Exploded view of all the enclosure parts
//
module exploded_view () {
translate([0,0,10]) top();
translate([0,0,5]) middle();
base();
translate([0,115,-8]) rotate([90,0,0]) end_cover();
translate([15,-7,35]) rotate([90,90,0]) button();
translate([30,-7,35]) rotate([90,90,0]) button();
}
//##############################################################################
//##############################################################################
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment