LoRaWAN-Signal-Mapping/iot/Housing.scad

269 lines
6 KiB
OpenSCAD
Raw Normal View History

2019-06-14 14:04:18 +00:00
////////////////
/// Settings ///
////////////////
// The thickness of the walls
wall_thickness = 4;
2019-06-14 14:04:18 +00:00
// The dimensions of the box on the inside
box_inside = [ 130, 140, 110 ];
2019-06-14 14:04:18 +00:00
// Screw dimensions
2019-06-14 14:04:18 +00:00
screw_diameter = 3;
screw_length = 6.3;
// The size of a breadboard
2019-06-17 15:46:45 +00:00
bb_size = [ 46, 35 ];
2019-06-14 14:04:18 +00:00
// -------------------------------------------
corner_piece_size = screw_diameter +
(wall_thickness * 2);
2019-06-14 14:04:18 +00:00
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
2019-06-17 15:46:45 +00:00
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,
2019-06-17 15:46:45 +00:00
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
2019-06-18 15:27:13 +00:00
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;
2019-06-18 15:27:13 +00:00
//offset_lid = [ 0, 0, box_outside[2] + 25 ];
// -------------------------------------------
2019-06-14 14:04:18 +00:00
// Misc. Utility functions
// -------------------------------------------
module screw_port() {
difference() {
color("purple") cylinder(
h = screw_length + wall_thickness,
d = screw_diameter + (wall_thickness * 2),
$fn = 25
);
2019-06-14 14:43:59 +00:00
// 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.
2019-06-14 14:04:18 +00:00
color("mediumpurple") translate([0, 0, wall_thickness + 0.1]) cylinder(
h = screw_length,
d = screw_diameter,
$fn = 25
);
};
}
2019-06-14 14:43:59 +00:00
// Corner generation
2019-06-14 14:04:18 +00:00
module corner_piece() {
color("red") difference() {
cube([
corner_piece_size,
corner_piece_size,
box_inside[2] - lid_lip_height
2019-06-14 14:04:18 +00:00
]);
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);
}
2019-06-14 14:43:59 +00:00
};
// Box
// -------------------------------------------
difference() {
cube(box_outside);
translate([wall_thickness, wall_thickness, wall_thickness]) {
cube(box_inside);
}
}
// Mounts
2019-06-14 14:43:59 +00:00
// -------------------------------------------
// Arduino
// ----------------------
translate(offset_arduino) rotate([0, 0, 90]) {
2019-06-14 14:43:59 +00:00
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]);
2019-06-14 14:04:18 +00:00
}
// Breadboard Mounting
// ----------------------
% translate(offset_breadboard + [wall_thickness, -13, 0]) cube(breadboard);
translate(offset_breadboard) difference() {
union() {
translate([wall_thickness*2, 0, 0]) cube([
2019-06-17 15:46:45 +00:00
bb_size[0] - (wall_thickness*2),
bb_size[1] + wall_thickness*2,
bb_mount_height
]);
translate([0, wall_thickness*2, 0]) cube([
2019-06-17 15:46:45 +00:00
bb_size[0] + wall_thickness*2,
bb_size[1] - (wall_thickness*2),
bb_mount_height
]);
}
translate([wall_thickness, wall_thickness, -1]) cube([
2019-06-17 15:46:45 +00:00
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
// ----------------------
2019-06-17 15:46:45 +00:00
% 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
]);
}
2019-06-14 14:43:59 +00:00
// Corners
// -------------------------------------------
{
2019-06-14 14:43:59 +00:00
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();
}
2019-06-18 15:27:13 +00:00
// Lid
// -------------------------------------------
module screw_hole_indent() {
indent_depth = lid_lip_height + wall_thickness / 2;
indent_size = screw_diameter + 1.25;
translate([-indent_size/2, -indent_size/2, 0]) cube([
indent_size ,
indent_size ,
indent_depth
]);
translate([0, 0, indent_depth - 0.1]) cylinder(h = screw_length, d = screw_diameter, $fn = 25);
}
2019-06-18 15:27:13 +00:00
translate(offset_lid) {
difference() {
union() {
cube([
box_outside[0],
box_outside[1],
lid_base_height
]);
translate([wall_thickness, wall_thickness, lid_base_height]) cube([
box_outside[0] - (wall_thickness * 2),
box_outside[1] - (wall_thickness * 2),
lid_lip_height
]);
}
2019-06-18 15:27:13 +00:00
translate([0, 0, -0.1]) union() {
inset = corner_piece_size / 2 + wall_thickness;
translate([
inset,
inset,
]) screw_hole_indent();
2019-06-18 15:27:13 +00:00
translate([
box_outside[0] - inset,
inset,
]) screw_hole_indent();
2019-06-18 15:27:13 +00:00
translate([
box_outside[0] - inset,
box_outside[1] - inset
]) screw_hole_indent();
2019-06-18 15:27:13 +00:00
translate([
inset,
box_outside[1] - inset
]) screw_hole_indent();
2019-06-18 15:27:13 +00:00
}
}
}