diff --git a/.gitignore b/.gitignore index f453074..d73a1f8 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ secrets.h .*.swo build.py *.bak +*.stl +*.gcode diff --git a/hardware/case/bh1750/BH1750-box.scad b/hardware/case/bh1750/BH1750-box.scad new file mode 100644 index 0000000..c668b54 --- /dev/null +++ b/hardware/case/bh1750/BH1750-box.scad @@ -0,0 +1,67 @@ +inner_box = [15, 3, 20]; +wall_strength = 2; + + + + +difference() { + difference() { + cube(size=[inner_box[0]+wall_strength*2, inner_box[1]+wall_strength*2, inner_box[2]+wall_strength], center=true); + translate([0,0,wall_strength]) { + cube(size=[inner_box[0], inner_box[1], inner_box[2]+wall_strength], center=true); + }; + }; + + translate([0, wall_strength / 2, (inner_box[2]/2 - wall_strength/2)]) { + cube(size=[inner_box[0] + wall_strength * 2, inner_box[1] + wall_strength, 4], center=true); + }; + + + translate([0, -(wall_strength/2 + inner_box[1]/2), (((inner_box[2]- (8+5.5))/2) -inner_box[2]/2 + wall_strength/2 + 5.5) ]) { + cube(size=[inner_box[0]-3.5, wall_strength, inner_box[2]- (8+5.5)], center=true); + }; +}; + +translate([inner_box[0]/2+wall_strength/2,inner_box[1]/2+wall_strength,(inner_box[2]/2+wall_strength/2)-4]) { + rotate([180,0,90]) { + translate([-(wall_strength+inner_box[1]), -wall_strength/2, 0]){ + polyhedron( + points=[ [0,0,0], + [inner_box[1]+wall_strength,0,0], + [inner_box[1]+wall_strength,wall_strength,0], + [0,wall_strength,0], + [0,0,-4], + [0,wall_strength,-4], + ], + faces=[ [0,1,2,3], + [5,4,0,3], + [4,1,0], + [3,2,5], + [2,1,4,5], + ] + ); + } + } +} + +translate([-(inner_box[0]/2+wall_strength/2),inner_box[1]/2+wall_strength,(inner_box[2]/2+wall_strength/2)-4]) { + rotate([180,0,90]) { + translate([-(wall_strength+inner_box[1]), -wall_strength/2, 0]){ + polyhedron( + points=[ [0,0,0], + [inner_box[1]+wall_strength,0,0], + [inner_box[1]+wall_strength,wall_strength,0], + [0,wall_strength,0], + [0,0,-4], + [0,wall_strength,-4], + ], + faces=[ [0,1,2,3], + [5,4,0,3], + [4,1,0], + [3,2,5], + [2,1,4,5], + ] + ); + } + } +} diff --git a/hardware/case/multi-esp/multi-esp-box.scad b/hardware/case/multi-esp/multi-esp-box.scad new file mode 100644 index 0000000..cc77a26 --- /dev/null +++ b/hardware/case/multi-esp/multi-esp-box.scad @@ -0,0 +1,252 @@ +// for board_support() +bs_height = 5; +bs_width = 8; + +// for connector_holes() +hole_height = 6; +hole_width = 15; +hole_bottom_offset = 4; + +connector_space = 5.5; + +// for microusb_hole() +microusb_height = 6; +microusb_width = 8; +microusb_border_offset = 14; +microusb_bottom_offset = 14; + +// for dc_hole() +dc_plug_offset = 25; +dc_width = 9; +dc_depth = 3.5; +dc_height = 11; +dc_outer_strength = 2; +dc_support_height = 10; +dc_support_hole_support_bottom_offset = 3; + +// for case() +base_cube = [68, 50, 25 + bs_height]; +wall_strength = 2; + +module case() { + difference() { + cube(size = base_cube, center = true); + translate([0, 0, wall_strength]) { + cube(size = [base_cube[0] - wall_strength, base_cube[1] - wall_strength, base_cube[2]], center = true); + }; + }; +}; + +module board_support() { + bs_offset_y = base_cube[1] / 2 - bs_width / 2; + bs_offset_z = base_cube[2] / 2 - bs_height / 2; + bs_offset_x = base_cube[0] / 2 - bs_width / 2; + translate([bs_offset_x, -0, -bs_offset_z]) { + cube(size = [bs_width, base_cube[1], bs_height] , center = true); + }; + + translate([-bs_offset_x, 0, -bs_offset_z]) { + cube(size = [bs_width, base_cube[1], bs_height] , center = true); + } +} + +module connector_holes() { + conn_offset_x = base_cube[0] / 2; + conn_offset_y = hole_width / 2 + connector_space / 2; + conn_offset_z = base_cube[2] / 2 - hole_height / 2 - hole_bottom_offset - bs_height; + translate([conn_offset_x, conn_offset_y, -conn_offset_z]) { + cube(size=[wall_strength, hole_width, hole_height], center=true); + } + + translate([conn_offset_x, -conn_offset_y, - conn_offset_z]) { + cube(size=[wall_strength, hole_width, hole_height], center=true); + } +} + +module microusb_hole() { + musb_offset_x = base_cube[0] / 2; + musb_offset_y = base_cube[1] / 2 - microusb_width / 2 - microusb_border_offset; + musb_offset_z = base_cube[2] / 2 - microusb_height / 2 - microusb_bottom_offset - bs_height; + + translate([-musb_offset_x, musb_offset_y, -musb_offset_z]) { + cube(size=[wall_strength, microusb_width, microusb_height], center=true); + } +} + + +module top_support_corner() { + polyhedron( + points=[ [6,6,0], + [6,-6,0], + [-6,-6,0],, + [6,-6,-10] ], + faces=[ [1,0,3], + [2,0,1], + [3,2,1], + [0,2,3] + ] + ); +}; + +module corner_with_hole() { + difference() { + top_support_corner(); + support_corner_holes(); + }; +} + +module support_corners() { + sc_offset_x = base_cube[0] / 2 - 6; + sc_offset_y = base_cube[1] / 2 - 6; + sc_offset_z = base_cube[2] / 2; + + translate([sc_offset_x, -sc_offset_y, sc_offset_z]) { + rotate([0,0,0]) { + corner_with_hole(); + }; + }; + + translate([sc_offset_x, sc_offset_y, sc_offset_z]) { + rotate([0,0,90]) { + corner_with_hole(); + }; + }; + + translate([-sc_offset_x, sc_offset_y, sc_offset_z]) { + rotate([0,0,180]) { + corner_with_hole(); + }; + }; + + /* Disabled for DC hole + translate([-sc_offset_x, -sc_offset_y, sc_offset_z]) { + rotate([0,0,270]) { + corner_with_hole(); + }; + }; + */ +} + +module support_corner_holes() { + translate([2.5, -2.5, -6]) { + cylinder(r=1.75,h=6,$fn=50); + }; +} + +module top_base_hole() { + sc_offset_x = base_cube[0] / 2 - 6; + sc_offset_y = base_cube[1] / 2 - 6; + sc_offset_z = base_cube[2] / 2; + translate([sc_offset_x, -sc_offset_y, wall_strength / 2]) { + support_corner_holes(); + }; +} + +module top_diagonal_hole_set() { + top_base_hole(); + + rotate(180) { + top_base_hole(); + }; +} + +module top_holes() { + top_diagonal_hole_set(); + mirror([1, 0, 0]) { + top_diagonal_hole_set(); + }; +} + +module top() { + translate([0, 0, -base_cube[2] / 2 + wall_strength / 2]) { + difference() { + cube(size = [base_cube[0], base_cube[1], wall_strength], center = true); + top_holes(); + }; + }; +} + + +module dc_hole() { + translate([-dc_plug_offset, -(base_cube[1]/2), (dc_width/2) + dc_support_hole_support_bottom_offset - dc_outer_strength/2]) { + rotate([0, 0, 90]){ + cube(size=[wall_strength,dc_width,dc_width], center=true); + } + }; +} + +module dc_support() { + translate([-dc_plug_offset, -(base_cube[1]/2)+dc_depth-wall_strength/2, 0]) { + rotate([0, 0, 90]){ + dc_support_ramp(); + dc_support_frame(); + } + }; +}; + +module dc_support_frame() { + pillar_offset_y = (dc_width/2)+(dc_outer_strength/2); + pillar_offset_z = (dc_height/2); + beam_offset_z = dc_height + dc_outer_strength/2; + + translate([0, -pillar_offset_y, pillar_offset_z]) { + dc_support_pillar(); + } + + translate([0, pillar_offset_y, pillar_offset_z]) { + dc_support_pillar(); + } + + + translate([0, 0, beam_offset_z]) { + dc_support_beam(); + }; +} + +module dc_support_pillar() { + cube(size=[dc_depth, dc_outer_strength, dc_height], center=true); +} + +module dc_support_beam() { + dc_support_width = dc_width + dc_outer_strength*2; + cube(size=[dc_depth, dc_support_width, dc_outer_strength], center=true); +} + +module dc_support_ramp() { + dc_support_width = dc_width + dc_outer_strength*2; + + translate([-(dc_depth/2),-(dc_support_width/2),0]) { + polyhedron( + points=[ [0,0,0], + [dc_depth,0,0], + [dc_depth,dc_support_width,0], + [0,dc_support_width,0], + [0,0,-dc_support_height], + [0,dc_support_width,-dc_support_height], + ], + faces=[ [0,1,2,3], + [5,4,0,3], + [4,1,0], + [3,2,5], + [2,1,4,5], + ] + ); + }; +} + + +translate([0, base_cube[1] + 10, 0]) { + translate([0, base_cube[1] + 10, 0]) { + difference() { + case(); + connector_holes(); + microusb_hole(); + dc_hole(); + } + dc_support(); + board_support(); + support_corners(); + }; + + top(); +}; \ No newline at end of file