// Raspberry Pi Pico Two-Piece Enclosure // Parametric OpenSCAD Model /* [Board Dimensions] */ board_length = 51.0; // [40:0.5:70] board_width = 21.0; // [15:0.5:35] board_thickness = 1.0; // [0.5:0.1:3] hole_inset_x = 2.0; // [1:0.1:5] hole_inset_y = 4.8; // [1:0.1:8] hole_diameter = 2.1; // [1.5:0.1:3.5] /* [Enclosure Settings] */ wall_thickness = 2.0; // [1.2:0.1:4.0] board_clearance = 1.0; // [0.2:0.1:3.0] post_height = 3.0; // [1.0:0.5:8.0] post_diameter = 4.0; // [2.5:0.1:6.0] pin_diameter = 1.9; // [1.2:0.1:2.5] pin_height = 1.8; // [0.5:0.1:3.0] inner_depth = 9.0; // [6.0:0.5:20.0] corner_radius = 2.5; // [0.0:0.5:6.0] /* [Cutout Settings] */ usb_width = 8.0; // [5.0:0.5:15.0] usb_height = 3.5; // [2.0:0.5:8.0] /* [Lid Settings] */ lid_thickness = 2.0; // [1.0:0.5:5.0] lip_height = 2.5; // [1.0:0.5:6.0] lip_thickness = 1.0; // [0.6:0.1:2.0] fit_tolerance = 0.15; // [0.0:0.05:0.5] part_spacing = 15.0; // [5:1:40] /* [Colors] */ base_color = "RoyalBlue"; lid_color = "LightSteelBlue"; /* [Display] */ $fn = 48; // Derived Dimensions inner_x = board_length + 2 * board_clearance; inner_y = board_width + 2 * board_clearance; outer_x = inner_x + 2 * wall_thickness; outer_y = inner_y + 2 * wall_thickness; total_height_base = inner_depth + wall_thickness; // 2D Rounded Rectangle Helper module rounded_rect(w, h, r) { if (r > 0) { hull() { translate([r, r]) circle(r=r); translate([w - r, r]) circle(r=r); translate([w - r, h - r]) circle(r=r); translate([r, h - r]) circle(r=r); } } else { square([w, h]); } } // Base Enclosure module pico_base() { difference() { // Outer Shell linear_extrude(height=total_height_base) rounded_rect(outer_x, outer_y, corner_radius); // Inner Pocket translate([wall_thickness, wall_thickness, wall_thickness]) linear_extrude(height=inner_depth + 1) rounded_rect(inner_x, inner_y, max(0.1, corner_radius - wall_thickness)); // Micro-USB Cutout (centered on X=0 end at board level) translate([-1, outer_y / 2 - usb_width / 2, wall_thickness + post_height]) cube([wall_thickness + 2, usb_width, usb_height]); } // Four Mounting Standoffs with Pins for (ix = [hole_inset_x, board_length - hole_inset_x]) { for (iy = [hole_inset_y, board_width - hole_inset_y]) { px = wall_thickness + board_clearance + ix; py = wall_thickness + board_clearance + iy; translate([px, py, wall_thickness]) { // Post boss cylinder(h=post_height, d=post_diameter); // Alignment pin through mounting hole translate([0, 0, post_height]) cylinder(h=pin_height, d=pin_diameter); } } } } // Snap/Friction-Fit Lid module pico_lid() { union() { // Main Lid Plate linear_extrude(height=lid_thickness) rounded_rect(outer_x, outer_y, corner_radius); // Friction-fit lip extending into base cavity lip_outer_w = inner_x - 2 * fit_tolerance; lip_outer_h = inner_y - 2 * fit_tolerance; lip_corner_r = max(0.1, corner_radius - wall_thickness - fit_tolerance); translate([wall_thickness + fit_tolerance, wall_thickness + fit_tolerance, lid_thickness]) { difference() { // Outer lip boundary linear_extrude(height=lip_height) rounded_rect(lip_outer_w, lip_outer_h, lip_corner_r); // Hollow center of lip translate([lip_thickness, lip_thickness, -0.5]) linear_extrude(height=lip_height + 1) rounded_rect( lip_outer_w - 2 * lip_thickness, lip_outer_h - 2 * lip_thickness, max(0.1, lip_corner_r - lip_thickness) ); // Cutout on lip for micro-USB clearance when closed translate([-1, (lip_outer_h - usb_width) / 2, -0.5]) cube([lip_thickness + 2, usb_width, lip_height + 1]); } } // Subtle finger pry notch on lid edge translate([outer_x - 1.5, outer_y / 2 - 4, lid_thickness - 0.8]) cube([2, 8, 1]); } } // Scene layout: Base and Lid side by side color(base_color) pico_base(); color(lid_color) translate([outer_x + part_spacing, 0, 0]) pico_lid();