Skip to content

Instantly share code, notes, and snippets.

@foosel

foosel/README.md

Last active Dec 18, 2015
Embed
What would you like to do?
Bus Pirate v3.6 case, created in OpenSCAD

Case for Bus Pirate v3.6 (Dangerous Prototypes/Seeedstudio version)

Case for Bus Pirate v3.6

This is a case for the Bus Pirate v3.6 from Dangerous Prototypes as listed on Thingiverse to be printed on a 3D printer.

In order to compile this file to an STL you'll need OpenSCAD and also the file oshw.scad which you can find here on Thingiverse.

include <oshw.scad>
fudge_factor=0.75;
board_length=60.1 + fudge_factor;
board_width=37.1 + fudge_factor;
board_thickness=1.65;
board_corner_radius=3.3 + fudge_factor/2;
board_clearance_top=0;
board_clearance_bottom=2;
clearance_top=2;
usb_width=8.6;
usb_height=4.6;
cutout_header_width=20.3 + 1;
cutout_header_length=8.9 + 1;
header_distance_board_edge=8.5;
cutout_icsp_width=4;
cutout_icsp_length=14.6;
icsp_distance_board_edge=3.6;
cutout_leds_length=35;
cutout_leds_width=3;
leds_distance_board_edge=2.5;
wall_strength=1.2;
lip_strength=1;
corner_radius=1.5;
$fn=32;
module rounded_box(w, l, h, r) {
inner_length = l - 2 * r;
inner_width = w - 2 * r;
hull() {
translate([-inner_width / 2, -inner_length/2, 0]) cylinder(r=r, h=h);
translate([inner_width / 2, -inner_length/2, 0]) cylinder(r=r, h=h);
translate([inner_width / 2, inner_length/2, 0]) cylinder(r=r, h=h);
translate([-inner_width / 2, inner_length/2, 0]) cylinder(r=r, h=h);
}
}
module case_bottom() {
case_bottom_width=board_width + 2 * wall_strength;
case_bottom_length=board_length + 2 * wall_strength;
case_bottom_height=board_thickness + board_clearance_bottom + usb_height/2 + board_clearance_top + wall_strength;
difference() {
rounded_box(case_bottom_width, case_bottom_length, case_bottom_height, board_corner_radius + wall_strength);
translate([0, 0, wall_strength + board_clearance_bottom])
rounded_box(board_width, board_length, case_bottom_height, board_corner_radius); // resting area
translate([0, 0, wall_strength])
rounded_box(board_width - 2 * lip_strength, board_length - 2 * lip_strength, case_bottom_height, board_corner_radius - lip_strength); // board cutout
// usb cutout
translate([0, board_length * 0.5, usb_height/2 + wall_strength + board_clearance_bottom + board_thickness]) cube(size=[usb_width, 20, usb_height], center=true);
// locks ICSP side
hull() {
translate([-board_width/2, -board_length/4 - 5, case_bottom_height - lip_strength / 2]) sphere(r=0.4, center=true);
translate([-board_width/2, -board_length/4 + 5, case_bottom_height - lip_strength / 2]) sphere(r=0.4, center=true);
}
hull() {
translate([-board_width/2, board_length/4 - 5, case_bottom_height - lip_strength / 2]) sphere(r=0.4, center=true);
translate([-board_width/2, board_length/4 + 5, case_bottom_height - lip_strength / 2]) sphere(r=0.4, center=true);
}
// lock LED side
hull() {
translate([board_width/2, -board_length/4 - 5, case_bottom_height - lip_strength / 2]) sphere(r=0.3, center=true);
translate([board_width/2, board_length/4 + 5, case_bottom_height - lip_strength / 2]) sphere(r=0.3, center=true);
}
}
}
module case_top() {
usb_height_remainder = usb_height/2;
// bottom part
case_top_width=board_width + 2 * wall_strength;
case_top_length=board_length + 2 * wall_strength;
case_top_height=usb_height_remainder + wall_strength + clearance_top;
// top/lip part
case_top_width_lip=case_top_width - 2 * lip_strength - 0.5;
case_top_length_lip=case_top_length - 2 * lip_strength - 0.5;
case_top_height_lip=case_top_height + lip_strength;
union() {
difference() {
union() {
rounded_box(case_top_width, case_top_length, case_top_height, board_corner_radius + wall_strength);
rounded_box(case_top_width_lip, case_top_length_lip, case_top_height_lip, board_corner_radius);
}
translate([0,0,wall_strength])
rounded_box(case_top_width - 2 * wall_strength - 2 * lip_strength, case_top_length - 2 * wall_strength - 2 * lip_strength, case_top_height, board_corner_radius - lip_strength);
// usb cutout
translate([0, board_length/2, wall_strength + clearance_top + usb_height_remainder]) cube(size=[usb_width, 20, usb_height], center=true);
// header cutout
translate([0,-board_length/2 + header_distance_board_edge,0])
cube(size=[cutout_header_width, cutout_header_length, 20], center=true);
// ICSP cutout
translate([board_width/2 - icsp_distance_board_edge, 0, -10])
rounded_box(cutout_icsp_width, cutout_icsp_length, 20, cutout_icsp_width/4);
//cube(size=[cutout_icsp_width, cutout_icsp_length, 20], center=true);
// LED cutout
translate([-board_width/2 + leds_distance_board_edge, 0, -10])
rounded_box(cutout_leds_width, cutout_leds_length, 20, cutout_leds_width/2);
// oshw logo
translate([0,0,-0.4]) rotate([0,0,90]) linear_extrude(height=1)
oshw_logo_2d(25);
}
// lock LED side
hull() {
translate([case_top_width/2 - wall_strength, -board_length/4 - 5, case_top_height_lip - lip_strength / 2]) sphere(r=0.2, center=true);
translate([case_top_width/2 - wall_strength, -board_length/4 + 5, case_top_height_lip - lip_strength / 2]) sphere(r=0.2, center=true);
}
hull() {
translate([case_top_width/2 - wall_strength, board_length/4 - 5, case_top_height_lip - lip_strength / 2]) sphere(r=0.2, center=true);
translate([case_top_width/2 - wall_strength, board_length/4 + 5, case_top_height_lip - lip_strength / 2]) sphere(r=0.2, center=true);
}
// locks ICSP side
hull() {
translate([-case_top_width/2 + wall_strength, -board_length/4 - 5, case_top_height_lip - lip_strength / 2]) sphere(r=0.2, center=true);
translate([-case_top_width/2 + wall_strength, board_length/4 + 5, case_top_height_lip - lip_strength / 2]) sphere(r=0.2, center=true);
}
}
}
case_bottom();
translate([board_width + 2 * wall_strength + 5, 0, 0]) case_top();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.