commit fafde29d9b748343e1443cda457be85334d81e13
parent 99e164bfd0c52ca416745e8eab05bc2fefe8d41b
Author: Gerd Beuster <gerd@frombelow.net>
Date: Sat, 1 Aug 2020 11:32:52 +0200
Case based on case for ESP32
Diffstat:
A | case/case.scad | | | 236 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1 file changed, 236 insertions(+), 0 deletions(-)
diff --git a/case/case.scad b/case/case.scad
@@ -0,0 +1,236 @@
+// Dimensions of the power supply (+ 1 mm on each side)
+power_supply_width = 97 + 1;
+power_supply_depth = 159 + 1;
+power_supply_height = 30 + 1;
+
+// Mount for Raspberry Pi Zero W
+mcu_compartment_depth = 60;
+knob_distance_width = 58;
+knob_distance_depth = 23;
+knob_diameter_bottom = 3;
+knob_diameter_top = 1;
+knob_height = 10;
+
+// Dimensions of power switch (+ 1 mm)
+power_switch_width = 18 + 1;
+power_switch_height = 12 + 1;
+
+// Diameters of cables ( + 2 mm)
+diameter_power_cable = 6 + 2;
+diameter_data_cable = 5 + 2;
+diameter_cord_grip_screw = 5 + 2;
+
+// Thickness of walls, guide rails, etc.
+wall_thickness = 2;
+
+// Interiour width must be big enough for power supply plus guide rails for
+// lid.
+inner_frame_width = power_supply_width + 2 * wall_thickness;
+inner_frame_depth = power_supply_depth + mcu_compartment_depth;
+// No wall on top, because we will place the lid there.
+inner_frame_height = power_supply_height + 2 * wall_thickness;
+
+// Create walls around empty box of given size. The top is left open.
+// Front does not have full height in order to leave room for the lid.
+module Frame(width, depth, height, wall_thickness) {
+ // Add walls to inner frame
+ outer_frame_width = width + 2 * wall_thickness;
+ outer_frame_depth = depth + 2 * wall_thickness;
+ outer_frame_height = height + 1 * wall_thickness;
+ // Construct frame
+ difference() {
+ cube([outer_frame_width, outer_frame_depth, outer_frame_height]);
+ translate([wall_thickness, wall_thickness, wall_thickness])
+ cube([width, depth, height]);
+ translate([wall_thickness, 0, outer_frame_height - wall_thickness * 2 ])
+ cube([width, wall_thickness, wall_thickness * 2]);
+ }
+}
+
+// Guide rails for lid and supporting structures.
+module Guide_Rails(width, depth, height, wall_thickness) {
+ // Left top
+ translate([wall_thickness, 0, height])
+ cube([wall_thickness, depth + wall_thickness, wall_thickness]);
+ // Left bottom
+ translate([wall_thickness, 0, height - 2 * wall_thickness])
+ cube([wall_thickness, depth + wall_thickness, wall_thickness]);
+ // Right top
+ translate([width, 0, height])
+ cube([wall_thickness, depth + wall_thickness, wall_thickness]);
+ // Right bottom
+ translate([width, 0, height - 2 * wall_thickness])
+ cube([wall_thickness, depth + wall_thickness, wall_thickness]);
+ // Back top
+ translate([wall_thickness, depth, height])
+ cube([width, wall_thickness, wall_thickness]);
+ // Back bottom
+ translate([wall_thickness, depth, height - 2 * wall_thickness])
+ cube([width, wall_thickness, wall_thickness]);
+ // Support structure back
+ translate([width/3, depth, wall_thickness])
+ cube([wall_thickness, wall_thickness, height - 3 * wall_thickness]);
+ translate([width/3*2, depth, wall_thickness])
+ cube([wall_thickness, wall_thickness, height - 3 * wall_thickness]);
+ // Support structure left side
+ translate([wall_thickness, depth-depth/4, wall_thickness])
+ cube([wall_thickness, wall_thickness, height - 3 * wall_thickness]);
+ translate([wall_thickness, depth-depth/4 * 2, wall_thickness])
+ cube([wall_thickness, wall_thickness, height - 3 * wall_thickness]);
+ translate([wall_thickness, depth-depth/4 * 3, wall_thickness])
+ cube([wall_thickness, wall_thickness, height - 3 * wall_thickness]);
+ // Support structure right side
+ translate([width, depth-depth/4, wall_thickness])
+ cube([wall_thickness, wall_thickness, height - 3 * wall_thickness]);
+ translate([width, depth-depth/4 * 2, wall_thickness])
+ cube([wall_thickness, wall_thickness, height - 3 * wall_thickness]);
+ translate([width, depth-depth/4 * 3, wall_thickness])
+ cube([wall_thickness, wall_thickness, height - 3 * wall_thickness]);
+ // Fixation of power supply
+ translate([wall_thickness,
+ depth - (wall_thickness + power_supply_depth),
+ wall_thickness])
+ cube([width, wall_thickness, wall_thickness]);
+}
+
+module Frame_with_Rails(width, depth, height, wall_thickness) {
+ union () {
+ Frame(width=width, depth=depth, height=height, wall_thickness=wall_thickness);
+ Guide_Rails(width=width, depth=depth, height=height, wall_thickness=wall_thickness);
+ }
+}
+
+// Holes for cords and power switch
+module Frame_with_Rails_and_Holes(width, depth, height, wall_thickness) {
+ difference() {
+ Frame_with_Rails(width=width, depth=depth, height=height,
+ wall_thickness=wall_thickness);
+ // Hole for power switch
+ translate([width/3 , 0, height /3])
+ cube([power_switch_width, wall_thickness, power_switch_height]);
+ // Hole for power cable
+ translate([0 , depth/11, height /4])
+ rotate([0, 90, 0]) cylinder(d=diameter_power_cable, h=wall_thickness+1,
+ center=false);
+ // Hole for data cable
+ translate([0 , depth/5.5, height /4])
+ rotate([0, 90, 0]) cylinder(d=diameter_data_cable, h=wall_thickness+1,
+ center=false);
+ }
+}
+
+module Frame_with_Air_Vents(width, depth, height, wall_thickness) {
+ difference() {
+ Frame_with_Rails_and_Holes(width=width, depth=depth, height=height,
+ wall_thickness=wall_thickness);
+ // Left side vents
+ for(vent_depth = [depth/40*11+wall_thickness: depth/40: depth-wall_thickness*2])
+ translate([0, vent_depth, 2*wall_thickness])
+ cube([wall_thickness*2, depth/80, height/3*2]);
+ // Right side vents
+ for(vent_depth = [depth/40*11+wall_thickness: depth/40: depth-wall_thickness*2])
+ translate([width, vent_depth, 2*wall_thickness])
+ cube([wall_thickness*2, depth/80, height/3*2]);
+ // Back side vents
+ for(vent_width = [wall_thickness*3: width/20: width-wall_thickness*2])
+ translate([vent_width, depth, 2*wall_thickness])
+ cube([width/50, wall_thickness*2, height/3*2]);
+ }
+}
+// Support structure for cord grip for power supply
+module Cord_Grip_for_Power_Supply(width, depth, height, wall_thickness,
+ diameter_power_cable,
+ diameter_cord_grip_screw) {
+// Cord grip for power supply
+ translate([wall_thickness,
+ depth/10 + diameter_power_cable/2 + wall_thickness,
+ wall_thickness])
+ difference () {
+ cube([width/5, wall_thickness, height-2*wall_thickness]);
+ translate([width/7,
+ wall_thickness,
+ height/2])
+ rotate([90, 0, 0]) cylinder(d=diameter_cord_grip_screw,
+ h=wall_thickness+2,
+ center=true);
+ }
+
+}
+
+// Mount for Raspberry Pi Zero W
+module MCU_Mount(width, depth, knob_distance_width, knob_distance_depth,
+ mcu_compartment_depth, knob_diameter_bottom,
+ knob_diameter_top, knob_height, wall_thickness) {
+ translate([knob_distance_width*.68,
+ (mcu_compartment_depth-wall_thickness-knob_distance_depth)/1.5,
+ wall_thickness]) {
+ cylinder(h=knob_height, r1=knob_diameter_bottom/2,
+ r2=knob_diameter_top/2);
+ translate([knob_distance_width, 0, 0])
+ cylinder(h=knob_height, r1=knob_diameter_bottom/2,
+ r2=knob_diameter_top/2);
+ translate([0, knob_distance_depth, 0])
+ cylinder(h=knob_height, r1=knob_diameter_bottom/2,
+ r2=knob_diameter_top/2);
+ translate([knob_distance_width, knob_distance_depth, 0])
+ cylinder(h=knob_height, r1=knob_diameter_bottom/2,
+ r2=knob_diameter_top/2);
+ }
+}
+
+
+// Initials and year
+module Signature(width, wall_thickness) {
+translate([width+wall_thickness*2, wall_thickness*2, wall_thickness*2]) rotate([90, 0, 90]) linear_extrude(1) text(text="gb 2020", size=5, font="Arial Black");
+}
+
+
+// Complete Box
+module Box(){
+ Frame_with_Air_Vents(width=inner_frame_width,
+ depth=inner_frame_depth,
+ height=inner_frame_height,
+ wall_thickness=wall_thickness);
+
+ Cord_Grip_for_Power_Supply(width=inner_frame_width,
+ depth=inner_frame_depth,
+ height=inner_frame_height,
+ wall_thickness=wall_thickness,
+ diameter_power_cable=diameter_power_cable,
+ diameter_cord_grip_screw=diameter_cord_grip_screw);
+
+ MCU_Mount(width=inner_frame_width, depth=inner_frame_depth,
+ knob_distance_width=knob_distance_width,
+ knob_distance_depth=knob_distance_depth,
+ mcu_compartment_depth=mcu_compartment_depth,
+ knob_diameter_bottom=knob_diameter_bottom,
+ knob_diameter_top=knob_diameter_top,
+ knob_height=knob_height,
+ wall_thickness=wall_thickness);
+
+ Signature(width=inner_frame_width, wall_thickness=wall_thickness);
+}
+
+// Lid for the box
+// (rails leave 0.5 mm on each side)
+module Lid(){
+translate([wall_thickness+0.5, 0, inner_frame_height-wall_thickness])
+ cube([inner_frame_width-1, inner_frame_depth+wall_thickness-1.5, wall_thickness]);
+translate([wall_thickness*2, 0, inner_frame_height])
+ cube([inner_frame_width-2*wall_thickness,
+ inner_frame_depth-1,
+ wall_thickness]);
+}
+
+
+module Render_All() {
+ Box();
+ translate([0, 0, 40])
+ Lid();
+}
+
+
+// projection(cut=true) translate([0, 0, -3])
+// Box();
+// Lid();
+Render_All();