2019-06-14 15:04:18 +01:00
////////////////
/// Settings ///
////////////////
// The thickness of the walls
wall_thickness = 2 ;
// The dimensions of the box on the inside
box_inside = [
110 , // X
2019-06-14 16:17:31 +01:00
135 , // Y
2019-06-14 15:04:18 +01:00
110 // Z
] ;
screw_diameter = 3 ;
screw_length = 6.3 ;
2019-06-14 16:17:31 +01:00
bb_mount_height = 5 ;
battery = [ 19 , 60 , 70 ] ;
2019-06-14 15:04:18 +01:00
// -------------------------------------------
box_outside = [
box_inside [ 0 ] + ( wall_thickness * 2 ) ,
box_inside [ 1 ] + ( wall_thickness * 2 ) ,
box_inside [ 2 ] + ( wall_thickness - 0.1 )
] ;
// -------------------------------------------
// 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 15:43:59 +01: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 15:04:18 +01:00
color ( "mediumpurple" ) translate ( [ 0 , 0 , wall_thickness + 0.1 ] ) cylinder (
h = screw_length ,
d = screw_diameter ,
$fn = 25
) ;
} ;
}
2019-06-14 15:43:59 +01:00
// Corner generation
2019-06-14 15:04:18 +01:00
corner_piece_size = screw_diameter + ( wall_thickness * 2 ) ;
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 15:43:59 +01:00
} ;
// Box
// -------------------------------------------
union ( ) {
difference ( ) {
cube ( box_outside ) ;
translate ( [ wall_thickness , wall_thickness , wall_thickness ] ) {
cube ( box_inside ) ;
}
}
2019-06-14 16:17:31 +01:00
// Mounts
2019-06-14 15:43:59 +01:00
// -------------------------------------------
// Arduino
2019-06-14 16:17:31 +01:00
// ----------------------
2019-06-14 15:43:59 +01:00
translate ( [ 53.4 + 8 , 60 , wall_thickness ] ) 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 ] ) ;
2019-06-14 15:04:18 +01:00
}
2019-06-14 16:17:31 +01:00
// Breadboard Mounting
// ----------------------
translate ( [ 70 , 10 , wall_thickness - 0.1 ] ) difference ( ) {
union ( ) {
translate ( [ wall_thickness * 2 , 0 , 0 ] ) cube ( [
35 - ( wall_thickness * 2 ) ,
46 + wall_thickness * 2 ,
bb_mount_height
] ) ;
translate ( [ 0 , wall_thickness * 2 , 0 ] ) cube ( [
35 + wall_thickness * 2 ,
46 - ( wall_thickness * 2 ) ,
bb_mount_height
] ) ;
}
translate ( [ wall_thickness , wall_thickness , - 1 ] ) cube ( [
35 ,
46 ,
bb_mount_height + 2
] ) ;
}
// Battery box
// ----------------------
% translate ( [
box_inside [ 0 ] - battery [ 0 ] + wall_thickness ,
box_inside [ 1 ] - battery [ 1 ] - corner_piece_size ,
0
] ) cube ( battery ) ;
2019-06-14 15:43:59 +01:00
// Corners
// -------------------------------------------
2019-06-14 16:17:31 +01:00
{
2019-06-14 15:43:59 +01: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 16:17:31 +01:00
}