2019-06-14 14:04:18 +00:00
////////////////
/// Settings ///
////////////////
// The thickness of the walls
wall_thickness = 2 ;
// The dimensions of the box on the inside
2019-06-17 11:57:55 +00:00
box_inside = [ 130 , 140 , 110 ] ;
2019-06-14 14:04:18 +00:00
screw_diameter = 3 ;
screw_length = 6.3 ;
2019-06-17 15:46:45 +00:00
bb_size = [ 46 , 35 ] ;
2019-06-14 14:04:18 +00:00
// -------------------------------------------
2019-06-17 11:57:55 +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 )
] ;
// -------------------------------------------
2019-06-17 11:57:55 +00:00
offset_arduino = [ 53.4 + 8 , 40 , wall_thickness ] ;
2019-06-17 15:46:45 +00:00
breadboard = [ bb_size [ 0 ] , bb_size [ 1 ] + 24 + 13 , 49 ] ;
2019-06-17 11:57:55 +00:00
offset_breadboard = [ 70 , 20 , wall_thickness - 0.1 ] ;
bb_mount_height = 5 ;
battery = [ 60 , 19 , 70 ] ;
offset_battery = [
wall_thickness + corner_piece_size + 10 ,
box_inside [ 1 ] - battery [ 1 ] ,
0
] ;
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
2019-06-17 11:57:55 +00:00
] ;
2019-06-18 15:27:13 +00:00
offset_lid = [ box_outside [ 0 ] + 25 , 0 , 0 ] ;
//offset_lid = [ 0, 0, box_outside[2] + 25 ];
2019-06-17 11:57:55 +00:00
// -------------------------------------------
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 ]
] ) ;
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 ) ;
}
}
2019-06-14 15:17:31 +00:00
// Mounts
2019-06-14 14:43:59 +00:00
// -------------------------------------------
// Arduino
2019-06-14 15:17:31 +00:00
// ----------------------
2019-06-17 11:57:55 +00:00
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
}
2019-06-14 15:17:31 +00:00
// Breadboard Mounting
// ----------------------
2019-06-17 11:57:55 +00:00
% translate ( offset_breadboard + [ wall_thickness , - 13 , 0 ] ) cube ( breadboard ) ;
translate ( offset_breadboard ) difference ( ) {
2019-06-14 15:17:31 +00:00
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 ,
2019-06-14 15:17:31 +00:00
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 ) ,
2019-06-14 15:17:31 +00:00
bb_mount_height
] ) ;
}
translate ( [ wall_thickness , wall_thickness , - 1 ] ) cube ( [
2019-06-17 15:46:45 +00:00
bb_size [ 0 ] ,
bb_size [ 1 ] ,
2019-06-14 15:17:31 +00:00
bb_mount_height + 2
] ) ;
}
// Battery box
// ----------------------
2019-06-17 11:57:55 +00:00
// 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 15:17:31 +00:00
2019-06-14 14:43:59 +00:00
// Corners
// -------------------------------------------
2019-06-14 15:17:31 +00:00
{
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-14 15:17:31 +00:00
2019-06-18 15:27:13 +00:00
// Lid
// -------------------------------------------
translate ( offset_lid ) {
difference ( ) {
cube ( [ box_outside [ 0 ] , box_outside [ 1 ] , wall_thickness * 1.5 ] ) ;
translate ( [ 0 , 0 , - 0.1 ] ) union ( ) {
inset = corner_piece_size / 2 + wall_thickness ;
translate ( [
inset ,
inset ,
] ) cylinder ( h = screw_length , d = screw_diameter , $fn = 25 ) ;
translate ( [
box_outside [ 0 ] - inset ,
inset ,
] ) cylinder ( h = screw_length , d = screw_diameter , $fn = 25 ) ;
translate ( [
box_outside [ 0 ] - inset ,
box_outside [ 1 ] - inset
] ) cylinder ( h = screw_length , d = screw_diameter , $fn = 25 ) ;
translate ( [
inset ,
box_outside [ 1 ] - inset
] ) cylinder ( h = screw_length , d = screw_diameter , $fn = 25 ) ;
}
}
}