-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcubo_pcbs.scad
133 lines (111 loc) · 3.83 KB
/
cubo_pcbs.scad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
include <NopSCADlib/core.scad>
include <NopSCADlib/vitamins/pcbs.scad>
include <cubo_common.scad>
// pcb_insert + pcb_holder + height = frame_length - side_thickness
// so that the height of the pcb is enough to clear the height
// of the joints and wires can easily go through "empty" sides
target_height = (frame_length/2)-side_thickness;
pcb_holder_height = side_thickness;
pcb_insert_height = target_height-pcb_holder_height;
pcb_extra = 5;
echo("pcb_insert_height",pcb_insert_height); // 12
// minimum recommended values for CNC kitchen 2.5 inserts
insert_height = 5;
insert_radius_internal = 2;
insert_radius_external = insert_radius_internal + 1.6;
module
pcb_insert(calibrate=false)
{
translate([ 0, 0, pcb_insert_height /2 ])
union() {
difference()
{
cylinder(
h = pcb_insert_height, r = insert_radius_external, center = true);
translate([ 0, 0, ((pcb_insert_height-insert_height) / 2) + delta ]) cylinder(
h = insert_height, r = insert_radius_internal, center = true);
}
// Helps building custom PCB holders
if (calibrate) {
color("black")
translate([ 0, 0, ((pcb_insert_height-insert_height)) + delta ]) cylinder(
h = 2*insert_height, r = 0.5*insert_radius_internal, center = true);
}
}
}
//pcb_insert();
module
pcb_side_insert(calibrate=false)
{
union() {
difference()
{
union() {
cylinder(
h = side_thickness, r = M2p5_clearance_radius+1, center = true);
translate([M2p5_clearance_radius*2,0,0])
cube([M2p5_clearance_radius*4,2*(M2p5_clearance_radius+1),side_thickness], center=true);
}
cylinder(
h = side_thickness*2, r = M2p5_clearance_radius, center = true);
}
// Helps building custom PCB holders
if (calibrate) {
color("black")
translate([ 0, 0, ((pcb_insert_height-insert_height)) + delta ]) cylinder(
h = 2*insert_height, r = 0.5*insert_radius_internal, center = true);
}
}
}
pcb_side_insert();
module
pcb_holder(cube_pcb = RPI4)
{
// length, width, height (e.g. [85, 56, 1.4] for RPI4)
pcb_size = pcb_size(cube_pcb);
translate([0,0,pcb_holder_height/2])
cube([ pcb_size[0] + pcb_extra, pcb_size[1] + pcb_extra, pcb_holder_height ],
center = true);
translate([0,0,pcb_holder_height])
pcb_screw_positions(cube_pcb) pcb_insert();
if ($preview) {
translate([ 0, 0, target_height]) pcb(cube_pcb);
}
}
//pcb_holder();
module
pcb_holder_custom(dimensions=[], holes=[], calibrate=false, inserts_only=false)
{
// this is helpful for things like cameras that don't need
// the base
if (!inserts_only) {
translate([0,0,pcb_holder_height/2])
cube([
dimensions[0] + pcb_extra,
dimensions[1] + pcb_extra,
pcb_holder_height ], center = true);
}
for($i = [0 : 1 : len(holes) - 1]) {
hole = holes[$i];
translate([hole[0]-(dimensions[0]/2), hole[1]-(dimensions[1]/2), pcb_holder_height])
pcb_insert(calibrate=calibrate);
}
}
module
pcb_side_holder_custom(dimensions=[], holes=[], calibrate=false)
{
for($i = [0 : 1 : len(holes) - 1]) {
hole = holes[$i];
translate([hole[0]-(dimensions[0]/2), hole[1]-(dimensions[1]/2), pcb_holder_height])
if ($i == 0 || $i == 1) {
rotate([0,0,90])
pcb_side_insert(calibrate=calibrate);
} else {
rotate([0,0,270])
pcb_side_insert(calibrate=calibrate);
}
}
}
//dimensions = [75,50,10];
//sample_holes = [ [pcb_extra,pcb_extra] ];
//pcb_holder_custom(dimensions=dimensions, holes=sample_holes,calibrate=true);