Design the case

This commit is contained in:
Correl Roush 2023-10-04 23:59:05 -04:00
parent b84254d972
commit 616266e50e
2 changed files with 164 additions and 3 deletions

View file

@ -1,11 +1,17 @@
include <BOSL/constants.scad> include <BOSL/constants.scad>
use <BOSL/math.scad> use <BOSL/math.scad>
use <BOSL/shapes.scad>
use <BOSL/transforms.scad> use <BOSL/transforms.scad>
include <wemos_d1_mini.scad>
$fn = $preview ? 30 : 50; $fn = $preview ? 30 : 50;
case_thickness = 3;
wire_clearance = 10;
plate_margin = 5; plate_margin = 5;
plate_thickness = 3; plate_thickness = 3;
plate_depth = 3;
plate_clearance = 0.3;
// Number of key switches // Number of key switches
keys = 3; keys = 3;
@ -20,6 +26,7 @@ keyswitch_cutout_width = 14;
dial_diameter = 20; dial_diameter = 20;
dial_base_width = 12.85; dial_base_width = 12.85;
dial_base_height = 16.75; dial_base_height = 16.75;
dial_base_protrusion = 1.5;
dial_pin_width = 6; dial_pin_width = 6;
dial_pin_length = 3; dial_pin_length = 3;
// Space between the dial and the keypad // Space between the dial and the keypad
@ -27,14 +34,14 @@ dial_distance = 5;
keys_width = (key_width * keys) + (key_distance * (keys - 1)); keys_width = (key_width * keys) + (key_distance * (keys - 1));
keys_height = key_width; keys_height = key_width;
plate_width = (plate_margin * 2) + dial_diameter + dial_distance + keys_width;
plate_height = (plate_margin * 2) + max(dial_diameter, key_width);
module support_plate() { module support_plate() {
difference() { difference() {
keyswitch_cutout_offset = (key_width - keyswitch_cutout_width) / 2; keyswitch_cutout_offset = (key_width - keyswitch_cutout_width) / 2;
dial_cutout_offset_x = (dial_diameter - dial_base_width) / 2; dial_cutout_offset_x = (dial_diameter - dial_base_width) / 2;
dial_cutout_offset_y = (dial_diameter - dial_base_height) / 2; dial_cutout_offset_y = (dial_diameter - dial_base_height) / 2;
plate_width = (plate_margin * 2) + dial_diameter + dial_distance + keys_width;
plate_height = (plate_margin * 2) + max(dial_diameter, key_width);
cube([plate_width, plate_height, plate_thickness]); cube([plate_width, plate_height, plate_thickness]);
translate([plate_margin, plate_margin, -1]) { translate([plate_margin, plate_margin, -1]) {
// Dial cutouts // Dial cutouts
@ -61,4 +68,108 @@ module support_plate() {
} }
} }
support_plate(); case = [(plate_margin * 2) + dial_diameter + dial_distance + keys_width + (plate_clearance * 2),
(plate_margin * 2) + max(dial_diameter, key_width) + (plate_clearance * 2),
wire_clearance + wemos_d1_mini.z + plate_depth];
module case() {
difference() {
cuboid([case.x + case_thickness * 2,
case.y + case_thickness * 2,
case.z + case_thickness],
center=false,
fillet=2,
edges=EDGES_TOP + EDGES_Z_ALL);
translate([case_thickness,case_thickness, case_thickness]) {
cube([case.x, case.y, case.z + 1]);
}
}
// Wemos D1 Mini clip
color("red")
translate([case_thickness + case.x - wemos_d1_mini.y,
case_thickness + ((case.y - (wemos_d1_mini.x + 4)) / 2),
case_thickness]) {
difference() {
cube([wemos_d1_mini.y, wemos_d1_mini.x + 4,
wemos_d1_mini.z - esp_thickness + 2]);
translate([0,1, usb_thickness])
cuboid([wemos_d1_mini.y,
wemos_d1_mini.x + 2,
pcb_thickness + 2],
center=false,
chamfer=1,
edges=EDGES_X_ALL);
translate([0,2])
cube([wemos_d1_mini.y, wemos_d1_mini.x,
usb_thickness]);
}
translate([-3,wemos_d1_mini.x / 2 - 3])
cube([2,9,wemos_d1_mini.z - esp_thickness]);
// translate([case.x - wemos_d1_mini.y - 6, case.y / 2 - 2.5])
// cube([5,5, case.z - plate_depth]);
}
// Supports
color("purple") {
// position within the bounds of the case
translate([case_thickness, case_thickness]) {
// position within the bounds of the support plate
translate([plate_clearance, plate_clearance]) {
// dial support pillar
// position in the center of the dial
translate([(plate_margin + dial_diameter / 2) - 2.5,
(plate_margin + dial_diameter / 2) - 2.5])
cube([5, 5, case.z - plate_depth - dial_base_protrusion]);
// screw pillar
translate([plate_margin + dial_diameter + (dial_distance / 2),
case.y / 2]) {
difference() {
cylinder(d=6,h=case.z - plate_depth);
cylinder(d=3,h=case.z - plate_depth);
}
}
}
cube([3,3, case.z - plate_depth]);
translate([0, case.y - 3])
cube([3,3, case.z - plate_depth]);
translate([case.x / 2, 0])
cube([3,3, case.z - plate_depth]);
translate([case.x / 2, case.y - 3])
cube([3,3, case.z - plate_depth]);
translate([case.x - 1.5, 0])
cube([1.5,1.5,case.z - plate_depth]);
translate([case.x - 1.5, case.y - 1.5])
cube([1.5,1.5,case.z - plate_depth]);
translate([1.5, case_thickness, case.z - plate_depth]) {
}
}
}
}
translate([-4, -4, 0]) {
case();
translate([case_thickness, case_thickness, case_thickness]) {
translate([plate_clearance,
plate_clearance,
case.z - plate_thickness - plate_depth]) {
color("yellow", 0.3) {
// support_plate();
}
}
color("white", 0.05)
translate([case.x - wemos_d1_mini.y,
wemos_d1_mini.x + ((case.y - wemos_d1_mini.x) / 2),
0])
rotate([0,0,-90]) {
// wemos_d1_mini();
}
}
}

View file

@ -0,0 +1,50 @@
pcb_width = 25.3;
pcb_height = 34.5;
pcb_thickness = 1.25;
usb_height = 5.2;
usb_width = 7.75;
usb_thickness = 2.6;
usb_offset = 10;
esp_height = 15;
esp_width = 12;
esp_thickness = 4.75;
esp_offset_x = 7;
esp_offset_y = 7.5;
esp_board_thickness = 1;
esp_board_height = 24.25;
esp_board_width = 16;
esp_board_offset = 5.25;
wemos_d1_mini = [pcb_width,
pcb_height,
usb_thickness + pcb_thickness + esp_thickness];
module wemos_d1_mini(box=false, box_alpha=0.4) {
union() {
color("blue")
translate([0,0,usb_thickness])
cube([pcb_width, pcb_height, pcb_thickness]);
translate([usb_offset, pcb_height - usb_height, 0])
color("silver")
cube([usb_width, usb_height, usb_thickness]);
translate([esp_board_offset,
0,
usb_thickness + pcb_thickness])
color("black")
cube([esp_board_width, esp_board_height, esp_board_thickness]);
translate([esp_offset_x,
esp_offset_y,
pcb_thickness + usb_thickness])
color("silver")
cube([esp_width, esp_height, esp_thickness]);
}
if (box) {
color("gold", box_alpha)
cube(wemos_d1_mini);
}
}