218 lines
No EOL
5 KiB
OpenSCAD
218 lines
No EOL
5 KiB
OpenSCAD
////////////////
|
|
/// Settings ///
|
|
////////////////
|
|
|
|
// The thickness of the walls
|
|
wall_thickness = 4;
|
|
|
|
// The dimensions of the box on the inside
|
|
box_inside = [ 130, 140, 110 ];
|
|
|
|
// Screw dimensions
|
|
screw_diameter = 3;
|
|
screw_length = 6.3;
|
|
|
|
// The size of a breadboard
|
|
bb_size = [ 46, 35 ];
|
|
|
|
// -------------------------------------------
|
|
|
|
corner_piece_size = screw_diameter +
|
|
(wall_thickness * 2);
|
|
|
|
box_outside = [
|
|
box_inside[0] + (wall_thickness * 2),
|
|
box_inside[1] + (wall_thickness * 2),
|
|
box_inside[2] + (wall_thickness - 0.1)
|
|
];
|
|
|
|
// -------------------------------------------
|
|
|
|
// Offset of the Arduino - i.e. where it should be mounted in the box
|
|
offset_arduino = [53.4+8, 40, wall_thickness];
|
|
|
|
// Breadboard mounting specs
|
|
breadboard = [ bb_size[0], bb_size[1]+24+13, 49 ];
|
|
offset_breadboard = [70, 20, wall_thickness - 0.1];
|
|
bb_mount_height = 5;
|
|
|
|
// Battery location
|
|
battery = [ 60, 19, 70 ];
|
|
offset_battery = [
|
|
wall_thickness + corner_piece_size + 10,
|
|
box_inside[1] - battery[1],
|
|
0
|
|
];
|
|
|
|
// Power regulator mount settings
|
|
power_reg = [ 54, 31, 12 ];
|
|
power_reg_underneath = 9;
|
|
offset_power_reg = [
|
|
offset_arduino[0] + 10,
|
|
85,
|
|
wall_thickness
|
|
];
|
|
|
|
// Location of the lid - should not be touching the box - default is to the side of the box itself for easy 3d printing
|
|
offset_lid = [ box_outside[0] + 25, 0, 0 ];
|
|
|
|
// Based height of the lid
|
|
lid_base_height = wall_thickness * 1.5;
|
|
// Height of the extra lip to make the lid fit snugly
|
|
lid_lip_height = 2;
|
|
//offset_lid = [ 0, 0, box_outside[2] + 25 ];
|
|
|
|
// -------------------------------------------
|
|
|
|
|
|
// Misc. Utility functions
|
|
// -------------------------------------------
|
|
|
|
module screw_port() {
|
|
difference() {
|
|
color("purple") cylinder(
|
|
h = screw_length + wall_thickness,
|
|
d = screw_diameter + (wall_thickness * 2),
|
|
$fn = 25
|
|
);
|
|
|
|
|
|
// TODO: Measure screw size, as these holes might be too big. Note that they apparently end up slightly smaller anyway, due to openscad's rendering apparent - but this probably won't be enough.
|
|
color("mediumpurple") translate([0, 0, wall_thickness + 0.1]) cylinder(
|
|
h = screw_length,
|
|
d = screw_diameter,
|
|
$fn = 25
|
|
);
|
|
};
|
|
}
|
|
|
|
// Corner generation
|
|
module corner_piece() {
|
|
color("red") difference() {
|
|
cube([
|
|
corner_piece_size,
|
|
corner_piece_size,
|
|
box_inside[2] - lid_lip_height
|
|
]);
|
|
translate([
|
|
corner_piece_size / 2,
|
|
corner_piece_size / 2,
|
|
box_inside[2] - screw_length + 0.1
|
|
]) cylinder(h = screw_length, d = screw_diameter, $fn = 25);
|
|
}
|
|
};
|
|
|
|
// Box
|
|
// -------------------------------------------
|
|
|
|
difference() {
|
|
cube(box_outside);
|
|
|
|
translate([wall_thickness, wall_thickness, wall_thickness]) {
|
|
cube(box_inside);
|
|
}
|
|
}
|
|
|
|
// Mounts
|
|
// -------------------------------------------
|
|
|
|
// Arduino
|
|
// ----------------------
|
|
translate(offset_arduino) rotate([0, 0, 90]) {
|
|
screw_port(); // Top left
|
|
translate([50.8, 15.2]) screw_port();
|
|
translate([50.8, 43.1]) screw_port();
|
|
translate([-1.3, 48.2]) screw_port();
|
|
|
|
% translate([-15.3, -2, screw_length + wall_thickness]) square([68.6, 53.4]);
|
|
}
|
|
|
|
// Breadboard Mounting
|
|
// ----------------------
|
|
|
|
% translate(offset_breadboard + [wall_thickness, -13, 0]) cube(breadboard);
|
|
|
|
translate(offset_breadboard) difference() {
|
|
union() {
|
|
translate([wall_thickness*2, 0, 0]) cube([
|
|
bb_size[0] - (wall_thickness*2),
|
|
bb_size[1] + wall_thickness*2,
|
|
bb_mount_height
|
|
]);
|
|
translate([0, wall_thickness*2, 0]) cube([
|
|
bb_size[0] + wall_thickness*2,
|
|
bb_size[1] - (wall_thickness*2),
|
|
bb_mount_height
|
|
]);
|
|
}
|
|
|
|
translate([wall_thickness, wall_thickness, -1]) cube([
|
|
bb_size[0],
|
|
bb_size[1],
|
|
bb_mount_height + 2
|
|
]);
|
|
}
|
|
|
|
// Battery box
|
|
// ----------------------
|
|
// NOTE: We'll be using velcro here to allow us to remove it easily. If we can't find any, then we'll probably have to make a 'proper' mount
|
|
% translate(offset_battery) cube(battery);
|
|
|
|
// Power Regulator
|
|
// ----------------------
|
|
% translate(offset_power_reg + [0, 0, power_reg_underneath]) cube(power_reg);
|
|
|
|
translate(offset_power_reg) {
|
|
% cube([ 46, 35, bb_mount_height ]);
|
|
|
|
translate([ 0, bb_size[1], 0 ]) cube([
|
|
46,
|
|
wall_thickness,
|
|
bb_mount_height
|
|
]);
|
|
|
|
translate([ 0, -wall_thickness, 0 ]) cube([
|
|
46,
|
|
wall_thickness,
|
|
bb_mount_height
|
|
]);
|
|
|
|
|
|
translate([-wall_thickness, -wall_thickness + 16, 0]) cube([
|
|
wall_thickness,
|
|
bb_size[1] + wall_thickness*2 - 16,
|
|
bb_mount_height
|
|
]);
|
|
|
|
translate([bb_size[0], -wall_thickness, 0]) cube([
|
|
wall_thickness,
|
|
bb_size[1] + wall_thickness*2,
|
|
bb_mount_height
|
|
]);
|
|
}
|
|
|
|
// Corners
|
|
// -------------------------------------------
|
|
|
|
{
|
|
translate([
|
|
wall_thickness,
|
|
wall_thickness,
|
|
wall_thickness - 0.1
|
|
]) corner_piece();
|
|
translate([
|
|
wall_thickness + box_inside[0] - corner_piece_size,
|
|
wall_thickness,
|
|
wall_thickness - 0.1
|
|
]) corner_piece();
|
|
translate([
|
|
wall_thickness,
|
|
wall_thickness + box_inside[1] - corner_piece_size,
|
|
wall_thickness - 0.1
|
|
]) corner_piece();
|
|
translate([
|
|
wall_thickness + box_inside[0] - corner_piece_size,
|
|
wall_thickness + box_inside[1] - corner_piece_size,
|
|
wall_thickness - 0.1
|
|
]) corner_piece();
|
|
} |