include include include veye_imx287_pcb_w = 29; veye_imx287_pcb_h = 29; veye_imx287_pcb_thickness = 1.6; veye_imx287_pcb_stack_h = 11; imx287_thickness = 1.3; veye_imx287_mount_plate_corner_radius = 2; veye_imx287_mount_plate_thickness = 2; veye_imx287_mount_plate_frame_w = 6; function veye_imx287_mount_plate_offset() = // sensor has non-zero thickness, so put holder // closer to pcb (but avoid artifacts) [0, -imx287_thickness + $tiny_padding, 0] + // move to zero [0, veye_imx287_mount_plate_thickness / 2, 0]; module veye_imx287_wo_holes() { pcb_w = veye_imx287_pcb_w; pcb_h = veye_imx287_pcb_h; pcb_stack_h = veye_imx287_pcb_stack_h; // connector size conn_w = 23; conn_h = 8; conn_d = 19; translate([0, -pcb_stack_h / 2, 0]) cube([pcb_w, pcb_stack_h, pcb_h], center = true); translate([0, -conn_d / 2 - pcb_stack_h, -conn_h / 2 + pcb_h / 2]) cube([conn_w, conn_d, conn_h], center = true); } module veye_imx287() { hole_d = 2.05; center_to_hole_dist = 12.5; pcb_stack_h = veye_imx287_pcb_stack_h; difference() { veye_imx287_wo_holes(); union() for (x_mult = [-1, 1], z_mult = [-1, 1]) { dx = center_to_hole_dist * x_mult; dy = $tiny_padding; dz = center_to_hole_dist * z_mult; translate([dx, dy, dz]) rotate([90, 0, 0]) cylinder($fn = diameterToFn(hole_d), d = hole_d, h = pcb_stack_h + $tiny_padding * 2); } } } module veye_imx287_stl_front() { pcb_w = veye_imx287_pcb_w; pcb_h = veye_imx287_pcb_h; rotate([90, 0, 0]) translate([-pcb_w / 2, -pcb_h / 2, veye_imx287_pcb_thickness]) import("PCB-RAW-IMX287-V11-0105-3D.stl"); } module veye_imx287_stl_back(with_connector = true) { pcb_w = veye_imx287_pcb_w; pcb_h = veye_imx287_pcb_h; rotate([90, 90, 0]) translate([-pcb_w / 2, -pcb_h / 2, -veye_imx287_pcb_thickness]) // fix not-centered source model //rotate([0, 0, 90]) translate([-50, 121 + pcb_h]) import("ADP-MV1-STEP.stl"); if (with_connector) { // connector size conn_w = 23; conn_h = 8; conn_d = 19; // a bit of hardcode for connector cyl_d = 6; cyl_z_offset = -2; translate([0, -conn_d + cyl_d / 2, veye_imx287_pcb_h / 2 - cyl_d / 2 + cyl_z_offset]) rotate([0, 90, 0]) %cylinder($fn = diameterToFn(cyl_d), d = cyl_d, h = conn_w, center = true); } } *#veye_imx287(); // centered in senser center module veye_imx287_natural() { translate([0, -imx287_thickness, 0]) union() { veye_imx287_stl_front(); translate([0, -veye_imx287_pcb_stack_h, 0]) veye_imx287_stl_back(); } } module veye_imx287_mount_plate_outer() { padding = 2; w = veye_imx287_pcb_w + padding * 2; h = veye_imx287_pcb_h + padding * 2; t = veye_imx287_mount_plate_thickness; cr = veye_imx287_mount_plate_corner_radius; translate(veye_imx287_mount_plate_offset()) color("green", 0.1) *hull() { for ( dx = [w / 2 - cr, -w / 2 + cr], dy = [h / 2 - cr, -h / 2 + cr]) { translate([dx, 0, dy]) translate([0, t / 2, 0]) rotate([90, 0, 0]) cylinder($fn = dToFn(cr * 2), r = cr, h = t); } } color("blue", 0.5) translate([0, 1 / 2 - imx287_thickness + $tiny_padding, 0]) cube([w, 1, h], center = true); } module veye_imx287_mount_plate_outer_top() { w = veye_imx287_pcb_w; h = veye_imx287_pcb_h; t = veye_imx287_mount_plate_thickness; cr = veye_imx287_mount_plate_corner_radius; color("pink", 0.5) translate([0, 1 / 2 - imx287_thickness + $tiny_padding, h / 2 + 1 / 2]) cube([w, 1, 1], center = true); } // inner area to cut module veye_imx287_mount_plate_inner() { w = veye_imx287_pcb_w; h = veye_imx287_pcb_h; frame_w = veye_imx287_mount_plate_frame_w; iw = w - frame_w; ih = h - frame_w; t = veye_imx287_mount_plate_thickness; cr = veye_imx287_mount_plate_corner_radius; translate(veye_imx287_mount_plate_offset()) hull() { for ( dx = [iw / 2 - cr, -iw / 2 + cr], dy = [iw / 2 - cr, -iw / 2 + cr]) { translate([dx, 0, dy]) translate([0, t / 2 + $tiny_padding, 0]) rotate([90, 0, 0]) cylinder( $fn = dToFn(cr * 2), r = cr, h = t + $tiny_padding * 2); } } } // screw holes module veye_imx287_mount_plate_holes() { // holes hd = 2.05; hh = 10; // distance between holes h_delta = 25; translate(veye_imx287_mount_plate_offset()) for ( dx = [h_delta / 2, -h_delta / 2], dy = [h_delta / 2, -h_delta / 2]) { translate([dx, 0, dy]) translate([0, hh / 2, 0]) rotate([90, 0, 0]) cylinder($fn = dToFn(hd), d = hd, h = hh); } } module veye_imx287_mount_plate() { w = veye_imx287_pcb_w; h = veye_imx287_pcb_h; frame_w = veye_imx287_mount_plate_frame_w; iw = w - frame_w; ih = h - frame_w; t = veye_imx287_mount_plate_thickness; cr = veye_imx287_mount_plate_corner_radius; // holes hd = 2.05; hh = 10; // distance between holes h_delta = 25; hr = hd / 2; difference() { // outer shape veye_imx287_mount_plate_outer(); // to cut veye_imx287_mount_plate_inner(); // holes veye_imx287_mount_plate_holes(); } } module veye_imx287_mount_holes() { id = 4; m2 = 2; // distance between holes h_delta = 25; translate([0, -imx287_thickness - $tiny_padding, 0]) for ( dx = [h_delta / 2, -h_delta / 2], dy = [h_delta / 2, -h_delta / 2]) { translate([dx, 0, dy]) screw_hole( m = m2, id = id, il = hole_insert_height, hd = m2_head_diameter, hh = m2_head_height, hs = hole_side_back); } } color("green", 0.1) *veye_imx287_natural(); color("green", 0.4) *veye_imx287_mount_plate(); color("red", 0.1) *veye_imx287_mount_plate_outer(); color("green", 0.3) *veye_imx287_mount_plate_inner(); *veye_imx287_mount_holes(); *difference() { //color("brown", 0.4) veye_imx287_mount_plate_outer(); //color("blue", 0.4) veye_imx287_mount_plate_inner(); } *veye_imx287_mount_plate_outer(); *veye_imx287_mount_plate_outer_top();