canon_ble #82

Merged
mattmcw merged 149 commits from canon_ble into main 2023-08-01 03:38:52 +00:00
2 changed files with 296 additions and 66 deletions
Showing only changes of commit 87695b173d - Show all commits

View File

@ -1,7 +1,7 @@
include <arduino.scad>;
include <common/common.scad>;
PART="electronics_mountx";
PART="electronics_mount";
CaseX = 121;
CaseY = 172;
@ -11,17 +11,32 @@ CaseInnerX = 112;
CaseInnerY = 162;
CaseInnerZ = 52;
CaseMountsX = 90;
CaseMountsY = 130;
CaseMountsX = 91.5;
CaseMountsY = 132;
CaseMountsH = 5;
CaseMountR = 9;
CaseSplitZ = 41;
RelayMountsX = 33.12;
RelayMountsY = 44;
module case_mount_debug () {
CapacitorSize = [30.5, 37.2, 20];
ResistorSize = [16.25, 49.8, 15.5];
ArduinoPosition = [40, 78, 2];
RelayPosition = [25, -25, 1];
ResistorPosition = [-37, 25, 0];
CapacitorPosition = [-35, -40, 0];
/**
* DEBUG MODULES
**/
module case_mount_debug (pos = [0, 0, 0]) {
$fn = 30;
translate([0, 0, -0.1]) difference () {
translate([pos[0], pos[1], pos[2] - 0.1]) difference () {
cylinder(r = R(7), h = CaseMountsH, center = true);
cylinder(r = R(3.25), h = CaseMountsH + 1, center = true);
}
@ -31,10 +46,10 @@ module case_mounts_debug () {
X = CaseMountsX/2;
Y = CaseMountsY/2;
Z = -(CaseInnerZ/2)+(CaseMountsH/2);
translate([X, Y, Z]) case_mount_debug();
translate([X, -Y, Z]) case_mount_debug();
translate([-X, Y, Z]) case_mount_debug();
translate([-X, -Y, Z]) case_mount_debug();
case_mount_debug([X, Y, Z]);
case_mount_debug([X, -Y, Z]);
case_mount_debug([-X, Y, Z]);
case_mount_debug([-X, -Y, Z]);
}
module case_debug () {
@ -47,29 +62,202 @@ module case_debug () {
case_mounts_debug();
}
module relay_module_debug () {
module relay_module_post_void (pos = [0, 0, 0], D, Z) {
translate(pos) cylinder(r = R(D), h = Z + 1, center = true);
}
module capacitor_debug () {
}
module resistor_debug () {
module relay_module_debug (pos = [0, 0, 0], rot = [0, 0, 0]) {
X = 39;
Y = 50;
Z = 1.25;
D = 3;
RelayOffsetX = (15/2) + (1.75/2);
RelayOffsetY = -(Y/2) + (18.6/2) + 12.3;
TerminalOffsetY = -(Y/2) + (8/2) + 3.7;
$fn = 20;
translate(pos) rotate(rot) {
difference () {
rounded_cube([X, Y, Z], d = 5, center = true);
relay_module_post_void([RelayMountsX/2, RelayMountsY/2, 0], D, Z);
relay_module_post_void([RelayMountsX/2, -RelayMountsY/2, 0], D, Z);
relay_module_post_void([-RelayMountsX/2, RelayMountsY/2, 0], D, Z);
relay_module_post_void([-RelayMountsX/2, -RelayMountsY/2, 0], D, Z);
}
//relays
translate([RelayOffsetX, RelayOffsetY, 15/2]) cube([15, 18.6, 15], center = true);
translate([-RelayOffsetX, RelayOffsetY, 15/2]) cube([15, 18.6, 15], center = true);
//terminals
translate([0, TerminalOffsetY, 10.14/2]) cube([30.6, 8, 10.14], center = true);
}
}
module electronics_mount () {
translate([40, 78, 0]) rotate([0, 0, 180]) bumper();
module resistor_foot_debug (pos = [0, 0, 0]) {
$fn = 20;
translate(pos) difference () {
cube([6, 8.75, 2], center = true);
cylinder(r = R(3.5), h = 2 + 1, center = true);
}
}
module resistor_debug (pos = [0, 0, 0]) {
X = ResistorSize[0];
Y = ResistorSize[1];
Z = ResistorSize[2];
translate (pos) {
cube([X, Y, Z], center = true);
resistor_foot_debug([-(X/2)-(6/2), (Y/2)-(8.75/2), -(Z/2)+(2/2)]);
resistor_foot_debug([(X/2)+(6/2), -(Y/2)+(8.75/2), -(Z/2)+(2/2)]);
translate([0, (Y/2)+(11.5/2), 0]) rotate([90, 0, 0]) cylinder(r = R(2), h = 11.5, center = true);
}
}
module capacitor_debug (pos = [0, 0, 0]) {
translate(pos) {
cube(CapacitorSize, center = true);
//tab
translate([(CapacitorSize[0]/2) + (14/2) - 5, 0, -(CapacitorSize[2]/2) + (0.85/2)]) difference() {
rounded_cube([14+10, 10, .85], d = 10, center = true, $fn = 30);
translate([4, 0, 0]) cube([6.87, 4.75, 0.85 + 1], center = true);
}
}
}
module debug () {
case_debug();
translate([0, 0, -CaseInnerZ/2+(CaseMountsH)]) electronics_mount();
relay_module_debug([RelayPosition[0], RelayPosition[1], RelayPosition[2]-15]);
resistor_debug([ResistorPosition[0], ResistorPosition[1], ResistorPosition[2] -8]);
capacitor_debug([CapacitorPosition[0], CapacitorPosition[1], CapacitorPosition[2] - 8]);
}
/**
* CASE MODULES
**/
module arduino_mount_reinforcement () {
X = 56.25;
Y = 71;
Z = 5;
pos = [-(X/2)+1.5, -(Y/2)+1.5, -2];
translate(pos) difference () {
cube([X, Y, Z], center = true);
cube([X-10, Y-13, Z+1], center = true);
}
}
module case_mount (pos = [0, 0, 0]) {
$fn = 30;
translate(pos) difference () {
cylinder(r = R(CaseMountR), h = CaseMountsH, center = true);
cylinder(r = R(3.5), h = CaseMountsH + 1, center = true);
}
}
module case_mounts (pos = [0, 0, 0]) {
X = CaseMountsX/2;
Y = CaseMountsY/2;
Z = 0;
XBrace = CaseMountsX - (CaseMountR/2);
YBrace = CaseMountsY - (CaseMountR/2);
DiagBrace = sqrt(pow(XBrace, 2) + pow(YBrace, 2));
DiagAngle = 57;
translate(pos) {
case_mount([X, Y, Z]);
case_mount([X, -Y, Z]);
case_mount([-X, Y, Z]);
case_mount([-X, -Y, Z]);
}
//sides
translate([0, Y, 0]) cube([XBrace, 6, 5], center = true);
translate([0, -Y, 0]) cube([XBrace, 6, 5], center = true);
translate([X, 0, 0]) cube([6, YBrace, 5], center = true);
translate([-X, 0, 0]) cube([6, YBrace, 5], center = true);
//diagonal
rotate([0, 0, DiagAngle]) cube([DiagBrace, 6, 5], center = true);
rotate([0, 0, -DiagAngle]) cube([DiagBrace, 6, 5], center = true);
}
module relay_module_post (pos = [0, 0, 0]) {
$fn = 30;
translate(pos) {
cylinder(r = R(5), h = 4, center = true);
translate([0, 0, (4/2) + (2.9/2)]) cylinder(r = R(2.75), h = 3, center = true);
}
}
module relay_mount (pos = [0, 0, 0]) {
$fn = 30;
X = RelayMountsX/2;
Y = RelayMountsY/2;
PostZ = 3;
translate(pos) {
translate([0, 0, -1]) difference () {
rounded_cube([RelayMountsX + 5, RelayMountsY + 5, 5], d = 5, center = true);
rounded_cube([RelayMountsX - 5, RelayMountsY - 5, 5 + 1], d = 4, center = true);
}
relay_module_post([X, Y, PostZ]);
relay_module_post([X, -Y, PostZ]);
relay_module_post([-X, Y, PostZ]);
relay_module_post([-X, -Y, PostZ]);
}
}
module resistor_foot_mount (pos = [0, 0, 0]) {
$fn = 30;
translate(pos) {
cube([6, 8.75, 5], center = true);
translate([0, 0, (5/2) + (2/2)]) cylinder(r = R(6), h = 2, center = true);
translate([0, 0, (5/2) + (5/2)]) cylinder(r = R(3), h = 5, center = true);
}
}
module resistor_mount (pos = [0, 0, 0]) {
X = ResistorSize[0];
Y = ResistorSize[1];
Z = ResistorSize[2];
translate (pos) {
difference () {
cube([X, Y, 5], center = true);
cube([X - 10, Y - 10, 5 + 1], center = true);
}
resistor_foot_mount([-(X/2)-(6/2), (Y/2)-(8.75/2), 0]);
resistor_foot_mount([(X/2)+(6/2), -(Y/2)+(8.75/2), 0]);
}
}
module capacitor_mount (pos = [0, 0, 0]) {
translate(pos) {
difference () {
cube([CapacitorSize[0], CapacitorSize[1], 5], center = true);
cube([CapacitorSize[0] - 10, CapacitorSize[1] - 10, 5 + 1], center = true);
}
translate([(CapacitorSize[0]/2) + (14/2) - 5, 0, 0]){
cube([14+10, 10, 5], center = true);
translate([4, 0, 3]) cube([4.5, 4.5, 5], center = true);
}
}
}
module electronics_mount () {
difference () {
union() {
case_mounts([0, 0, 0]);
translate(ArduinoPosition) {
rotate([0, 0, 180]) bumper();
arduino_mount_reinforcement();
}
relay_mount(RelayPosition);
resistor_mount(ResistorPosition);
capacitor_mount(CapacitorPosition);
}
}
}
if (PART == "electronics_mount") {
electronics_mount();
} else if (PART == "case_mounts") {
case_mounts();
} else {
debug();
}

View File

@ -1,4 +1,11 @@
include <./arduino.scad>;
include <./common/common.scad>;
DEBUG = false;
casePostZ = -1.5;
casePostPosition1 = [36, -31, casePostZ];
casePostPosition2 = [-36, 31, casePostZ];
module rounded_cube (c, d) {
r = d / 2;
@ -9,62 +16,90 @@ module rounded_cube (c, d) {
}
}
module cable_void (pos = [0, 0, 0], rot = [90, 0, 0], H = 10 + 1) {
translate(pos) rotate(rot) cylinder(r = R(5), h = H, center = true);
}
module case_bottom () {
$fn = 60;
difference () {
rounded_cube([85, 75, 30], 8);
rounded_cube([85 - 6, 75 - 6, 30 - 6], 6);
translate([0, 0, 25]) cube([85, 75, 30], center = true);
translate([40, -6.5, 4]) cube([15, 13, 20], center = true);
translate([20, -37, 0]) rotate([90, 0, 0]) cylinder(r = 5 / 2, h = 10 + 1, center = true);
translate([-20, -37, 0]) rotate([90, 0, 0]) cylinder(r = 5 / 2, h = 10 + 1, center = true);
//translate([0, 20, 0]) cube([100, 100, 100], center = true);
}
translate([20, -37, 0]) rotate([90, 0, 0]) difference () {
cylinder(r = 9 / 2, h = 5, center = true);
cylinder(r = 5 / 2, h = 10 + 1, center = true);
module cable_plug_void (pos = [0, 0, 0]) {
translate(pos) difference () {
rotate([90, 0, 0]) cylinder(r = R(9), h = 5, center = true);
cable_void();
}
}
translate([-20, -37, 0]) rotate([90, 0, 0]) difference () {
cylinder(r = 9 / 2, h = 5, center = true);
cylinder(r = 5 / 2, h = 10 + 1, center = true);
}
module arduino_uno_standoffs (pos) {
difference () {
translate([36, -22, -17]) rotate([0, 0, 90]) standoffs(UNO, mountType=PIN);
translate(pos) rotate([0, 0, 90]) standoffs(UNO, mountType=PIN);
translate([0, 0, -29]) cube([85, 75, 30], center = true);
}
translate([0, 42, -(30 / 2) + (5 / 2) - 1.5]) difference () {
rounded_cube([20, 20, 10], 4);
translate([0, 0, -6]) cube([20, 20, 10], center = true);
translate([0, -17, 6]) cube([20, 20, 10], center = true);
translate([0, 3, 0]) cylinder(r = 4 / 2, h = 10, center = true);
}
module case_shell (pos = [0,0,0]) {
translate(pos) difference () {
rounded_cube([85, 75, 30], 8);
rounded_cube([85 - 6, 75 - 6, 30 - 6], 6);
}
translate([0, -42, -(30 / 2) + (5 / 2) - 1.5]) difference () {
rounded_cube([20, 20, 10], 4);
translate([0, 0, -6]) cube([20, 20, 10], center = true);
translate([0, 17, 6]) cube([20, 20, 10], center = true);
translate([0, -3, 0]) cylinder(r = 4 / 2, h = 10, center = true);
}
translate([36, -31, -1.5]) difference () {
cylinder(r = 7 / 2, h = 23, center = true);
translate([0, 0, 15]) cylinder(r = 2 / 2, h = 23, center = true);
}
translate([-36, 31, -1.5]) difference () {
cylinder(r = 7 / 2, h = 23, center = true);
}
module case_post (pos = [0, 0, 0], H = 23) {
translate(pos) difference () {
cylinder(r = R(7), h = H, center = true);
translate([0, 0, 15]) cylinder(r = 2 / 2, h = 23, center = true);
}
}
module case_top () {
module case_bottom (pos = [0, 0, 0], board = "uno", cables = 2) {
$fn = 60;
difference () {
plugPosition1 = [20, -37, 0];
plugPosition2 = [-20, -37, 0];
translate(pos) {
difference () {
case_shell();
translate([0, 0, 25]) cube([85, 75, 30], center = true);
if (board == "uno") {
translate([40, -6.5, 4]) cube([15, 13, 20], center = true);
}
if (cables > 0) cable_void(plugPosition1);
if (cables > 1) cable_void(plugPosition2);
}
if (cables > 0) cable_plug_void(plugPosition1);
if (cables > 1) cable_plug_void(plugPosition2);
if (board == "uno") {
arduino_uno_standoffs([36, -22, -17]);
} else if (board == "nano") {
}
/*
//foot
translate([0, 42, -(30 / 2) + (5 / 2) - 1.5]) difference () {
rounded_cube([20, 20, 10], 4);
translate([0, 0, -6]) cube([20, 20, 10], center = true);
translate([0, -17, 6]) cube([20, 20, 10], center = true);
translate([0, 3, 0]) cylinder(r = 4 / 2, h = 10, center = true);
}
//foot
translate([0, -42, -(30 / 2) + (5 / 2) - 1.5]) difference () {
rounded_cube([20, 20, 10], 4);
translate([0, 0, -6]) cube([20, 20, 10], center = true);
translate([0, 17, 6]) cube([20, 20, 10], center = true);
translate([0, -3, 0]) cylinder(r = 4 / 2, h = 10, center = true);
}*/
case_post(casePostPosition1);
case_post(casePostPosition2);
}
}
module case_top (pos = [0,0,0], board = "uno") {
$fn = 60;
translate(pos) difference () {
rounded_cube([85, 75, 30], 8);
//case_shell([0, 0, 3]);
translate([0, 0, 17]) cube([85, 75, 30], center = true);
translate([0, 0, -17]) cube([85, 75, 30], center = true);
translate([36, -31, 0]) {
@ -78,12 +113,19 @@ module case_top () {
}
}
PART="bottom";
PART="bottom_nano";
if (PART == "bottom") {
case_bottom();
//translate([36, -22, -7]) rotate([0, 0, 90]) arduino();
//translate([0, 0, 20]) case_top();
if (PART == "bottom_uno") {
case_bottom(board = "uno");
if (DEBUG) {
translate([36, -22, -7]) rotate([0, 0, 90]) arduino();
//translate([0, 0, 20]) case_top();
}
}else if (PART == "bottom_nano") {
case_bottom(board = "nano", cables = 1);
//case_top([0, 0, 20]);
} else if (PART == "top") {
case_top();
} else if (PART == "top_nano") {
case_top_nano(board = "nano");
}