diff --git a/case/cheapino-bottom-left.scad b/case/cheapino-bottom-left.scad new file mode 100644 index 0000000..1d50cf8 --- /dev/null +++ b/case/cheapino-bottom-left.scad @@ -0,0 +1,58 @@ +use + +// height = 95.1738; +// width = 132.6134; +step = 0.05; +//$fn=30; + +// hotswap socket is ~1.75 high at the highest. +// magsafe ring is 0.4 high +// 2.5 will leave 0.35 at the thinnest(between hotswap and magsafe). + + +$fn=50; + + +mirror() +{ + difference() { + bottom(); + //translate([13,11,2.1]) + // magsafe_ring(); + + // The exported board from KiCad, for debug + translate([0,0,0]) + board(); + + switches(true); + + diodes(); + + rj45(); + + mcu(); + + encoder(); + + mounting_holes(); + + // Inserts for silicone bumpers + bumper(); + translate([0, -46, 0]) bumper(); + translate([13, -61.5, 0]) bumper(); + translate([-29.5, -54.6, 0]) bumper(); + translate([-63.3, 12.6, 0]) bumper(); + translate([-63.5, -24.3, 0]) bumper(); + translate([-101, -41.2, 0]) bumper(); + translate([-101, -3, 0]) bumper(); + + // Inserts for magnets near MCU + translate([24,17,0]) magnet(); + translate([24,-18,0]) magnet(); + + + // Inserts for magnets near bottom + translate([-43,36.8,0]) magnet(); + translate([-43,-0.2,0]) magnet(); + } +} \ No newline at end of file diff --git a/case/cheapino-bottom-right.scad b/case/cheapino-bottom-right.scad new file mode 100644 index 0000000..feba506 --- /dev/null +++ b/case/cheapino-bottom-right.scad @@ -0,0 +1,55 @@ +use + +// height = 95.1738; +// width = 132.6134; +step = 0.05; +//$fn=30; + +// hotswap socket is ~1.75 high at the highest. +// magsafe ring is 0.4 high +// 2.5 will leave 0.35 at the thinnest(between hotswap and magsafe). + + +$fn=50; + + +difference() +{ + bottom(); +translate([13,11,2.1]) + magsafe_ring(); + +// The exported board from KiCad, for debug +//translate([0,0,0]) +// board(); + +switches(false); + +diodes(); + +rj45(); + +mcu(); + +encoder(); + +mounting_holes(); + +// Inserts for silicone bumpers +bumper(); +translate([0, -46, 0]) bumper(); +translate([10.3, -67, 0]) bumper(); +translate([-29.5, -61.6, 0]) bumper(); +translate([-64, 7.5, 0]) bumper(); +translate([-64, -31, 0]) bumper(); +translate([-101, -47.7, 0]) bumper(); +translate([-101, -9, 0]) bumper(); + +// Inserts for magnets near mcu +translate([24,26,0]) magnet(); +translate([24,-18,0]) magnet(); + +// Inserts for magnets near bottom +translate([-43,28,0]) magnet(); +translate([-43,-9,0]) magnet(); +} diff --git a/case/cheapino-top.scad b/case/cheapino-top.scad index 0158de1..60f8e28 100644 --- a/case/cheapino-top.scad +++ b/case/cheapino-top.scad @@ -7,15 +7,24 @@ height_translation = 0; -// Height of case is 5mm from pcb to switch inset, -// plus 1.6mm pcb height, for a total of 6.6mm +// Height of case is: +// 5.0mm from pcb to switch inset +// 1.6mm pcb height +// 2.5mm bottom plate +// +// for a total of 9.1mm. +// +// The case only adds 0.7mm extra height +// to the keyboard. color("red") -for (i = [0.2:step:2.5]) +for (i = [0:step:9.1]) { + factor = 0.0052 * pow(4,i) - 0.1224 * pow(3,i) + 0.7931 * pow(2,i) - 0.9362*i + 0.0004; translate([0,0,i]) //height_translation]) - base_line_extruded(i, 1); + base_line_extruded(factor, 1); } +/* color("green") translate([0,0,2.5]) //height_translation]) base_line_extruded(2.5, 1.6); @@ -27,8 +36,9 @@ for (i = [4.1:step:6.6]) translate([0,0,i-1]) //height_translation]) base_line_extruded(6.6-i, 1); } +*/ -// Lip to stop pcb +// Lip to stop pcb + bottom plate color("yellow") translate([0,0,1.6]) difference() @@ -42,7 +52,7 @@ translate([0,0,1.6]) // Top plate color("pink") -translate([0,0,5.1]) +translate([0,0,8.6]) linear_extrude(1.5) offset( delta=0.5) base(); diff --git a/case/modules.scad b/case/modules.scad new file mode 100644 index 0000000..2572df6 --- /dev/null +++ b/case/modules.scad @@ -0,0 +1,292 @@ +//$fn=50; + +// bottom plate +module bottom() +{ +color("pink") +translate([0,0,0]) + linear_extrude(2.5) + offset( delta=0) + base(); +} + +module base() +{ + import ("plate.svg", center=true); +} + +module board() +{ + color("#1f77b4") + translate([0,0,-1]) + linear_extrude(1) + rotate([0,180,0]) + import("cheapino-brd.svg", center=true); +} + +module hotswap_mx() { + thickness=1.85; + + // Holes + translate([3.175,2.2,0]) + linear_extrude(height=3.05) + circle(d=3); + + translate([-3.175,-0.36,0]) + linear_extrude(height=3.05) + circle(d=3); + + // Body + linear_extrude(height=thickness) + square([11.1,4.2], center=true); + + translate([0,1.9,0]) + linear_extrude(height=thickness) + square([5.65, 2.09]); + + // Metal soldering parts + translate([5.45,1.04,0]) + linear_extrude(height=thickness) + square([2.5, 2.55]); + + translate([-7.95,-1.7,0]) + linear_extrude(height=thickness) + square([2.5, 2.55]); +} + + +module column(bottom) { +switch(bottom); + +translate([0, 19, 0]) switch(bottom); + +translate([0, 38, 0]) switch(bottom); +} + +module switch(bottom) { + // hotswap socket + color("#ff7f0e") + translate([0,bottom ? -9.42 : 0,1.85]) + rotate([180,0,0]) + mirror([0,bottom ? 1 : 0,0]) + hotswap_mx(); + + // main pin of switch + // 4mm d, 2.8mm high, 1.6mm pcb + // means 1.2 of it sticks below, 1.3 for margin + color("#2ca02c") + translate([-0.57, -4.7, 0]) + linear_extrude(height=1) + circle(d=4.2); + + + + // The two switch alignment pins + // They will need to be snipped if too long + color("#d62728") + translate([-5.74, -4.7, 0]) + linear_extrude(height=1) + circle(d=1.8); + + color("#d62728") + translate([4.45, -4.7, 0]) + linear_extrude(height=1) + circle(d=1.8); + +} + +module diode() { +color("#8c564b") +linear_extrude(height=1.65) +square([9.5, 1.6]); +} + +module rdiode() { + rotate(90) + diode(); +} + + + +module magsafe_ring() +{ +translate([0,0,0]) +linear_extrude(height=1.4) +difference() { + circle(d=55.1); + circle(d=44.9); + } +} + + +module rj_hole() { +color("#e377c2") + linear_extrude(1.7) { + translate([40.1,3.5,0]) + circle(d=3.5); + translate([40.1,4.8,0]) + circle(d=3.5); + } +} + +module rj_pin_hole() { + color("#e377c2") + linear_extrude(1.3) + translate([33.7,3.5,0]) + circle(d=2); +} + +module encoder() { + color("#7f7f7f") + linear_extrude(0.6) { + translate([35.7, 29.8]) + square([7,2]); + translate([32.65, 21.6]) + square([2, 3.3]); + translate([43.85, 21.6]) + square([2, 3.3]); + translate([36.8, 16.3]) + circle(d=2); + translate([41.77, 16.3]) + circle(d=2); + } +} + +module mcu() { + color("#7f7f7f") + linear_extrude(1.5) { + translate([30.65, 11.5]) + square([2,22.5]); + translate([45.83, 11.5]) + square([2,22.5]); + } + + color("#7f7f7f") + linear_extrude(1) + translate([31.65, 11.5]) + square([15,2]); +} + +module mounting_hole() { + color("#bcbd22") + translate([45.85, -23, 0]) { + cylinder(h=1.5, r1=1, r2=2); + + translate([0,0,1.5]) + cylinder(h=4, r=2); + } +} + +module bumper() { + color("#17becf") + translate([41, 29, 2.5]) + cylinder(h=2, r=5); + color("#17becf") + translate([41, 29, 1.3]) + cylinder(h=1.2, r1=4.5, r2=5); +} + +module magnet() { + color("#9467bd") + cylinder(h=2.1, r=3.05); +} + +module switches(bottom) { + // Columns starting from MCU + translate([19.3,-2.84,0]) + column(bottom); + + //rotate([0,0,180]) + translate([0.3,-0.3,0]) + column(bottom); + + translate([-18.7,6.05,0]) + column(bottom); + + translate([-37.7,-0.3,0]) + column(bottom); + + translate([-56.7,-10.308,0]) + column(bottom); + + // Thumb cluster + translate([14.6264,-24.52]) + switch(bottom); + + rotate([0,0,-10]) + translate([40.3,-19.3]) + switch(bottom); + + rotate([0,0,-23]) + translate([65.65,-7.09]) + switch(bottom); +} + +module diodes() { + // The horizontal diodes + translate([-18, 10.21, 0]) diode(); + translate([-28.59, 10.21, 0]) diode(); + translate([-26.23, 29.18, 0]) diode(); + translate([-9.463,21.97,0]) diode(); + translate([0.8, 21.97, 0]) diode(); + translate([14.106, 19.872, 0]) diode(); + translate([16.138,1.066,0]) diode(); + translate([5.888,-19.128,0]) diode(); + translate([-5.018, 2.971, 0]) diode(); + translate([-37.267,3.555,0]) diode(); + translate([-47.627,3.555,0]) diode(); + translate([-61.234,12.013,0]) diode(); + translate([-61.6,-7.011,0]) diode(); + translate([-47.616,22.504,0]) diode(); + + // The vertical(ish) diodes + translate([10.61, 24.7, 0]) rdiode(); + translate([10.585, 7.061, 0]) rdiode(); + translate([29.66, 25.106, 0]) rdiode(); + translate([28.365, -2.935, 0]) rdiode(); + translate([10.585, -13.146, 0]) rdiode(); + translate([25.977, -31.18, 0]) rdiode(); + + translate([46.5, -35.5, 0]) + rotate(76) + diode(); +} + +module rj45() { + // rj 45 stabilizers + rj_hole(); + translate([0,-11.43,0]) rj_hole(); + + // rj 45 housing through holes + translate([3.1,2,0]) rj_hole(); + translate([3.1,-13.49,0]) rj_hole(); + + // rj 45 pins + rj_pin_hole(); + translate([0,-2.54,0]) rj_pin_hole(); + translate([0, -5.08,0]) rj_pin_hole(); + translate([0,-7.62,0]) rj_pin_hole(); + translate([0,-10.16,0]) rj_pin_hole(); + translate([-2.54,-1.27,0]) rj_pin_hole(); + translate([-2.54,-3.81,0]) rj_pin_hole(); + translate([-2.54,-6.35,0]) rj_pin_hole(); + translate([-2.54,-8.89,0]) rj_pin_hole(); +} + +module mounting_holes() { + // Mounting holes + mounting_hole(); + translate([-27.432,4.572,0]) mounting_hole(); + translate([-18.288,44.704,0]) mounting_hole(); + translate([-36.132,25.02,0]) mounting_hole(); + translate([-56.183,52.928,0]) mounting_hole(); + translate([-75.399,46.599,0]) mounting_hole(); + translate([-94.267,36.473,0]) mounting_hole(); + translate([-94.241,17.313,0]) mounting_hole(); + translate([-3.048,-16.256,0]) mounting_hole(); +} + +//color("green") +//translate([0,0,0]) +// import("hotswap.stl"); + \ No newline at end of file