WALL_THICKNESS=2;
SCREW_DIAM=4;
SCREW_PAD=1;
PM_X=40.8;
PM_Y=40.8;
PM_Z=12.4;
PM_CONN_Y=15.8;
PM_CONN_Z=4;
PM_CONN_DEPTH=7.7;
BATT_X=55;
BATT_Y=34;
BATT_Z=11;
CO_X=24;
CO_Y=28;
CO_Z=8;
CO_CONN_Y=10;
BOT_CABLE_WELL_X=25;
CABLE_HOLE_DIAM=10;
BOTTOM_Z=WALL_THICKNESS + PM_Z;
MIDDLE_Z=WALL_THICKNESS + CO_Z;
DISPLAY_WIN_X=51;
DISPLAY_WIN_Y=26;
DISPLAY_OFF_X=16;
DISPLAY_OFF_Y=7;
BOARD_X=66.5;
BOARD_Y=36.8;
BOARD_SINK=2.1;
BOARD_PIN_OFF_X=2.35; BOARD_PIN_DIST_X=61.43;
BOARD_PIN_OFF_Y=2.15; BOARD_PIN_DIST_Y=32.5;
BOARD_SUPPORT_DIAM=3;
BOARD_SUPPORT_PIN_DIAM=2;
BOARD_OFF_X=3;
BOARD_OFF_Y=3;
TOP_LAYER_Z=10;
TOTAL_X=2*WALL_THICKNESS + max(
PM_X + BOT_CABLE_WELL_X + BATT_X,
CO_X + BOARD_X
);
TOTAL_Y=2*(WALL_THICKNESS*2 + SCREW_DIAM + SCREW_PAD) + PM_Y;
module box(v) {
translate([0,0,v[2]/2]) cube(v,center=true);
}
module screw_hole() {
cylinder(h=200,d=SCREW_DIAM,center=true,$fs=0.1);
}
module screw_holes() {
OFF=WALL_THICKNESS + SCREW_DIAM/2 + SCREW_PAD;
translate([
TOTAL_X/2 - OFF,
TOTAL_Y/2 - OFF,
0]) screw_hole();
translate([
-(TOTAL_X/2 - OFF),
TOTAL_Y/2 - OFF,
0]) screw_hole();
translate([
TOTAL_X/2 - OFF,
-(TOTAL_Y/2 - OFF),
0]) screw_hole();
translate([
-(TOTAL_X/2 - OFF),
-(TOTAL_Y/2 - OFF),
0]) screw_hole();
}
module pm_sensor() {
box([PM_X,PM_Y,PM_Z]);
}
module bottom_cable_well() {
box([BOT_CABLE_WELL_X,PM_CONN_Y,PM_CONN_DEPTH]);
}
module battery() {
box([BATT_X,BATT_Y,BATT_Z]);
}
module cable_hole() {
cylinder(h=200,d=CABLE_HOLE_DIAM,center=true,$fs=0.1);
}
module co_sensor() {
box([CO_X,CO_Y,CO_Z]);
}
module middle_cable_well() {
box([
TOTAL_X - CO_X/2,
CO_CONN_Y,
CO_Z,
]);
}
module board_well() {
box([ BOARD_X, BOARD_Y, CO_Z]);
}
module board_support() {
HEIGHT=MIDDLE_Z - WALL_THICKNESS - BOARD_SINK;
EXTRA=BOARD_SUPPORT_DIAM*2;
translate([0,0,HEIGHT/2]) union() {
cylinder(
h=HEIGHT,
d=BOARD_SUPPORT_DIAM,
center=true,$fs=0.1
);
translate([EXTRA/2, EXTRA/2 - BOARD_SUPPORT_DIAM/2, 0])
cube([EXTRA,EXTRA,HEIGHT],center=true);
translate([EXTRA/2 - BOARD_SUPPORT_DIAM/2, EXTRA/2, 0])
cube([EXTRA,EXTRA,HEIGHT],center=true);
translate([0,0,BOARD_SINK/2]) cylinder(
h=HEIGHT+BOARD_SINK,
d=BOARD_SUPPORT_PIN_DIAM,
center=true,$fs=0.1
);
}
}
module board_supports() {
translate([ -BOARD_X/2 + BOARD_PIN_OFF_X, -BOARD_Y/2 + BOARD_PIN_OFF_Y,0]) {
translate([ 0, 0, 0]) rotate([0,0,180]) board_support();
translate([ BOARD_PIN_DIST_X, 0, 0]) rotate([0,0,-90]) board_support();
translate([ 0, BOARD_PIN_DIST_Y, 0]) rotate([0,0,90]) board_support();
translate([ BOARD_PIN_DIST_X, BOARD_PIN_DIST_Y, 0]) board_support();
}
}
module bottom() {
PM_X_OFF=(TOTAL_X - PM_X)/2;
CABLE_X_OFF= PM_X_OFF - PM_X/2 - BOT_CABLE_WELL_X/2;
CABLE_Y_OFF=-PM_Y/2 + PM_CONN_Y/2;
CABLE_Z_OFF=BOTTOM_Z - PM_CONN_DEPTH;
BATT_X_OFF=CABLE_X_OFF - BOT_CABLE_WELL_X/2 - BATT_X/2;
BATT_Z_OFF=BOTTOM_Z - BATT_Z;
difference() {
box([TOTAL_X, TOTAL_Y, BOTTOM_Z]);
screw_holes();
translate([PM_X_OFF, 0, WALL_THICKNESS]) pm_sensor();
translate([CABLE_X_OFF, CABLE_Y_OFF, CABLE_Z_OFF]) bottom_cable_well();
translate([BATT_X_OFF, 0, BATT_Z_OFF]) battery();
}
}
module middle() {
CABLE_HOLE_X_OFF= TOTAL_X/2 - PM_X - BOT_CABLE_WELL_X/2;
CO_X_OFF=(TOTAL_X - CO_X)/2 - WALL_THICKNESS;
CO_Z_OFF=MIDDLE_Z - CO_Z;
BOARD_Z_OFF=MIDDLE_Z - BOARD_SINK;
union() {
difference() {
box([TOTAL_X, TOTAL_Y, MIDDLE_Z]);
screw_holes();
translate([CABLE_HOLE_X_OFF, 0, 0]) cable_hole();
translate([CO_X_OFF, 0, CO_Z_OFF]) co_sensor();
translate([0, 0, CO_Z_OFF]) middle_cable_well();
translate([0,0, CO_Z_OFF]) board_well();
}
translate([0,0, CO_Z_OFF]) board_supports();
}
}
module top() {
difference() {
cube([TOTAL_X, TOTAL_Y, TOP_LAYER_Z]);
translate([BOARD_OFF_X, BOARD_OFF_Y, 0]) union() {
translate([DISPLAY_OFF_X, DISPLAY_OFF_Y, -1])
cube([DISPLAY_WIN_X, DISPLAY_WIN_Y, TOP_LAYER_Z*2]);
}
}
}
middle();