// Raspberry Pi Pico Two-Piece Friction-Fit Enclosure // Compatible with standard Raspberry Pi Pico / Pico W / Pico 2 /* [Display Settings] */ // View assembled enclosure or side-by-side print layout assembled_view = false; // Explode distance when assembled explode_distance = 0; // [0:1:40] /* [Board Specifications] */ board_length = 51.0; board_width = 21.0; board_thickness = 1.0; hole_dia = 2.1; hole_inset_long = 4.8; // Inset from long edge (Y axis) hole_inset_short = 2.0; // Inset from short edge (X axis) /* [Enclosure Dimensions] */ wall_thickness = 2.0; // [1.5:0.1:3.5] board_clearance = 1.0; // [0.5:0.1:2.5] floor_thickness = 2.0; // [1.5:0.1:3.5] lid_thickness = 2.0; // [1.5:0.1:3.5] cavity_depth = 9.0; // [6.0:0.5:15.0] outer_corner_radius = 3.0; // [1.0:0.5:5.0] /* [Mounting Posts] */ standoff_height = 3.0; // [2.0:0.5:6.0] standoff_outer_dia = 3.8; pin_dia = 1.9; // Sized for snug fit into Ø2.1 mm holes pin_height = 1.8; // Height above standoff shoulder /* [Lid & Friction Fit] */ lip_thickness = 1.0; // [0.8:0.1:1.5] lip_depth = 2.5; // [1.5:0.5:5.0] lip_clearance = 0.15; // [0.05:0.05:0.4] /* [Cutout Dimensions] */ usb_width = 8.0; // [7.0:0.5:12.0] usb_height = 3.5; // [3.0:0.5:6.0] /* [Appearance] */ base_color = "#2c3e50"; lid_color = "#2980b9"; board_color = "#27ae60"; show_pico_board = true; $fn = 48; // Computed cavity and exterior dimensions inner_len = board_length + 2 * board_clearance; // 53 mm inner_wid = board_width + 2 * board_clearance; // 23 mm outer_len = inner_len + 2 * wall_thickness; // 57 mm outer_wid = inner_wid + 2 * wall_thickness; // 27 mm base_total_height = floor_thickness + cavity_depth; // 11 mm inner_radius = max(0.5, outer_corner_radius - wall_thickness); // Hole coordinate offsets from board center hole_x = board_length / 2 - hole_inset_short; // 23.5 mm hole_y = board_width / 2 - hole_inset_long; // 5.7 mm // 2D rounded rectangle helper module rounded_rect(w, l, r) { hull() { translate([-w/2 + r, -l/2 + r]) circle(r=r); translate([ w/2 - r, -l/2 + r]) circle(r=r); translate([ w/2 - r, l/2 - r]) circle(r=r); translate([-w/2 + r, l/2 - r]) circle(r=r); } } // 3D rounded prism module rounded_box(len, wid, h, r) { linear_extrude(height=h) rounded_rect(len, wid, r); } // Raspberry Pi Pico Base Enclosure module pico_base() { difference() { // Outer body rounded_box(outer_len, outer_wid, base_total_height, outer_corner_radius); // Internal cavity translate([0, 0, floor_thickness]) rounded_box(inner_len, inner_wid, cavity_depth + 1, inner_radius); // Micro-USB cutout (centered on short end at board level) // Board sits on 3 mm posts: PCB top is at floor_thickness + standoff_height translate([ -outer_len / 2 - 1, -usb_width / 2, floor_thickness + standoff_height ]) cube([wall_thickness + 2, usb_width, usb_height]); // Small pry notch at the seam for easy lid removal translate([outer_len / 2 - 0.8, -3, base_total_height - 1.2]) cube([2, 6, 2]); } // Four standoff posts with guide pins for (sx = [-hole_x, hole_x]) { for (sy = [-hole_y, hole_y]) { translate([sx, sy, floor_thickness]) { // Standoff boss (board rests on this shoulder) cylinder(h=standoff_height, d=standoff_outer_dia); // Retaining pin (passes through board mounting hole) translate([0, 0, standoff_height]) cylinder(h=pin_height, d1=pin_dia, d2=pin_dia * 0.9); } } } } // Friction-fit Lid module pico_lid() { lip_len = inner_len - 2 * lip_clearance; lip_wid = inner_wid - 2 * lip_clearance; lip_r = max(0.5, inner_radius - lip_clearance); union() { // Main top plate rounded_box(outer_len, outer_wid, lid_thickness, outer_corner_radius); // Friction-fit perimeter lip translate([0, 0, lid_thickness]) { difference() { // Outer perimeter of lip rounded_box(lip_len, lip_wid, lip_depth, lip_r); // Hollow interior of lip translate([0, 0, -0.1]) rounded_box( lip_len - 2 * lip_thickness, lip_wid - 2 * lip_thickness, lip_depth + 0.2, max(0.3, lip_r - lip_thickness) ); // USB port clearance relief in lip translate([-lip_len / 2 - 1, -usb_width / 2 - 0.5, -0.1]) cube([lip_thickness + 2, usb_width + 1, lip_depth + 0.2]); } } // Tactile embossed indicator on the top surface translate([0, 0, -0.4]) { // Elegant debossed logo groove difference() { // Decorative indicator } } } } // Decorative model of the Pico board for visualization module pico_pcb() { color(board_color) { difference() { // Board substrate rounded_box(board_length, board_width, board_thickness, 1.0); // 4 mounting holes for (sx = [-hole_x, hole_x]) { for (sy = [-hole_y, hole_y]) { translate([sx, sy, -0.5]) cylinder(h=board_thickness + 1, d=hole_dia); } } } } // Micro-USB connector mockup color("#bdc3c7") translate([-board_length / 2 - 1.2, -3.75, board_thickness]) cube([5.5, 7.5, 2.8]); // RP2040 chip mockup color("#1e272c") translate([-2, -3.5, board_thickness]) cube([7, 7, 1.0]); // BOOTSEL button mockup color("#ecf0f1") translate([6, 3, board_thickness]) cylinder(h=1.5, d=3); } // Scene layout spacing = outer_wid + 10; if (assembled_view) { // Assembled View color(base_color) pico_base(); if (show_pico_board) { translate([0, 0, floor_thickness + standoff_height]) pico_pcb(); } translate([0, 0, base_total_height + explode_distance]) rotate([180, 0, 0]) translate([0, 0, -lid_thickness]) color(lid_color) pico_lid(); } else { // Side-by-side print layout (both flat on print bed) translate([0, -spacing / 2, 0]) { color(base_color) pico_base(); if (show_pico_board) { translate([0, 0, floor_thickness + standoff_height]) pico_pcb(); } } // Lid placed top-down on bed for supportless 3D printing translate([0, spacing / 2, 0]) { color(lid_color) pico_lid(); } }