-
Notifications
You must be signed in to change notification settings - Fork 0
/
ServoDeadbolt.scad
256 lines (233 loc) · 9.43 KB
/
ServoDeadbolt.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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
/*
* This is the back mounting plate for Dead Bolt opener along with a bracket to mount
* a servo motor
*/
// Back Plate variables
plate_width = 107;
plate_height = 100;
plate_thickness = 4.5;
groove_diameter = 20;
groove_width_backplate = 60;
groove_width_offset = 0;
groove_position = 40;
// Back plate slot settings
slot_diameter = 3.25;
slot_length = 40;
slot_spacing = 10;
slot_width_offset = plate_width/2 - 15;
slot_height_offset = -15;
// Trap slot settings
trap_diameter = slot_diameter + 3;
trap_length = slot_length;
trap_spacing = slot_spacing;
trap_width_offset = slot_width_offset;
trap_height_offset = slot_height_offset;
trap_depth = plate_thickness - 1.5;
// Servo Bracket settings
bracket_height = 30; // The overall height of the bracket.
bracket_reach = 25; // Adjust the top tab of the bracket to reach out farther
bracket_base_length = 20; // Makes the base of bracket longer, and the slots longer
bracket_width = 30; // Makes the overall width of the bracket bigger. Wider = stronger
bracket_thickness = 4; // changes the cross section thickness of the bracket
bracket_base_slot_length = bracket_base_length / 2;
bracket_reach_slot_length = bracket_reach / 2;
servo_hole_diameter = 3.5;
servo_hole_spacing = 15;
servo_hole_offset = -8; // More negative number backs the holes away from the edge
// Servo coupling
// For
// single servo arm = 0
// Large Servo Horns = 1
// X Horns = 2
// wheel = 3
horn_type = 1;
coupling_width = 16;
coupling_depth = 18;
coupling_length = 45;
coupling_wall_thickness = 1.5;
servo_couple_offset = 5;
servo_couple_radius = (coupling_width - coupling_wall_thickness)/2;
groove_width = 2;
servo_arm_groove_width = 3;
servo_arm_recess_depth = 1.5;
servo_arm_recess_width = 2;
//Button Panel
button_hole_diameter = 16;
button_spacing = 25;
panel_padding = 15; // Padding (extra meat around panel edges)
/*
* Still needs to be implemented
*/
module servoHorn(horn_type){
if(horn_type == 0){ // Large Horns
circle(r = 5);
}
}
/*
* Coupling for thumb knob
*
*/
module deadBoltCoupler(coupling_width, coupling_depth, coupling_length, coupling_wall_thickness){
difference(){ // Cutout recess for servo arm
difference(){ // Cutout holes to zip tie the servo to this thing
difference(){// Cut away grooves for coupling thing
difference(){ // Cut outs at bottom to clear thumbwheel
union(){ // Create the major box of the coupling
for(x = [0, coupling_width]){ // Iterate to create two long side walls
translate([x, 0, 0])
cube(size = [coupling_wall_thickness, coupling_length, coupling_depth]);
}
// Short side walls perpendicular to long walls
cube(size = [coupling_width, coupling_wall_thickness, coupling_depth]);
translate([0, coupling_length - coupling_wall_thickness, 0])
cube(size = [coupling_width, coupling_wall_thickness, coupling_depth]);
hull(){ // To create pretty top
translate([0,0,coupling_depth]) // Move cube to the top of the coupling
// To be the other half of the hull
cube(size = [coupling_width + coupling_wall_thickness, coupling_length, coupling_wall_thickness]);
// Center the cylinder above coupling for the hull
translate([(coupling_width - coupling_wall_thickness)/2 + coupling_wall_thickness, coupling_length/2, coupling_depth + coupling_wall_thickness + servo_couple_offset])
cylinder(r = coupling_width/3, h = coupling_wall_thickness);
}
}
translate([(coupling_width - coupling_wall_thickness)/2 + coupling_wall_thickness, 0,0])
rotate([-90, 0, 0])
cylinder(r = servo_couple_radius , h = coupling_length + 1);
}
// This is very ugly...
for(i = [ [0, (coupling_length/16) ,0],
[0, coupling_length/4 ,0],
[0, 3*(coupling_length/4) - groove_width ,0],
[0, 15*(coupling_length/16) - groove_width ,0],
// Top
[0, (coupling_length/16) ,(coupling_depth + coupling_wall_thickness/1.125) + (servo_couple_offset/(coupling_length/2 - servo_couple_radius))*coupling_length/16],
[0, coupling_length/4 ,(coupling_depth + coupling_wall_thickness/1.125) + (servo_couple_offset/(coupling_length/2 - servo_couple_radius))*coupling_length/4],
[0, 3*(coupling_length/4) - groove_width ,(coupling_depth + coupling_wall_thickness/1.125) + (servo_couple_offset/(coupling_length/2 - servo_couple_radius))*coupling_length/4],
[0, 15*(coupling_length/16) - groove_width ,(coupling_depth + coupling_wall_thickness/1.125) + (servo_couple_offset/(coupling_length/2 - servo_couple_radius))*coupling_length/16]]){
translate(i)
cube(size = [coupling_width + coupling_wall_thickness, groove_width, 2]);
}
}
translate([0, 2*(coupling_length/4) - groove_width ,(coupling_depth + coupling_wall_thickness/1.125) + (servo_couple_offset/(coupling_length/2 - servo_couple_radius))*coupling_length/4])
cube(size = [coupling_width + coupling_wall_thickness, groove_width*2, 1]);
}
translate([(coupling_width - coupling_wall_thickness)/2 + coupling_wall_thickness, coupling_length/2, coupling_depth + coupling_wall_thickness + servo_couple_offset + servo_arm_recess_depth/2])
for(x = [0 : 3]){
rotate(a = [0, 0, 90 * x])
#cube(size = [servo_couple_radius + 10, servo_arm_groove_width, servo_arm_recess_depth], center = true);
}
}
}
module backplate(){
difference(){
// Set up the basic back plate
union(){
cube(size = [plate_width, plate_height, plate_thickness]);
// Move to cylinders to round the top and bottom (make it pretty)
translate([plate_width/2, 0,0])
cylinder(r = plate_width/2, h = plate_thickness, center= false);
translate([plate_width/2, plate_height,0])
cylinder(r = plate_width/2, h = plate_thickness, center= false);
}
translate([groove_width_offset,groove_position, 0]){
union(){// Groove
#cube(size = [groove_width_backplate, groove_diameter, plate_thickness]);
translate([groove_width_backplate,groove_diameter/2,0])
cylinder(r = groove_diameter/2, h = plate_thickness, center= false);
translate([0,groove_diameter/2,0])
cylinder(r = groove_diameter/2, h = plate_thickness, center= false);
}
}
}
}
/*
* Utility module for creating slots
*/
module slots(slot_diameter, slot_length, slot_spacing, plate_thickness){
echo (slot_length);
for(x = [(-slot_spacing/2), (slot_spacing/2)]){
echo (x);
translate([x, 0, 0]){
union(){
#cube([slot_diameter, slot_length, plate_thickness]);
translate([slot_diameter/2, slot_length,0])
cylinder(r = slot_diameter/2, h = plate_thickness);
translate([slot_diameter/2, 0,0])
cylinder(r = slot_diameter/2, h = plate_thickness);
}
}
}
}
/*
* Bracket for mounting servo to backplate
*/
module servoBracket(){
difference(){
difference(){ // Difference for base slots
union(){ // Create the general bracket
// Bracket Base
cube([bracket_base_length, bracket_thickness, bracket_width]);
translate([bracket_base_length,0,0])
// Bracket stem
cube([bracket_thickness, bracket_height - (2*bracket_thickness), bracket_width]);
translate([bracket_base_length, bracket_height - (2*bracket_thickness),0])
cube([bracket_reach, bracket_thickness, bracket_width]);
}
rotate(a = [90,90,0]){ // Place and rotate the lower slots
// For some reason I needed to add one...
translate([-bracket_width/2 - slot_spacing/2 + slot_diameter - 1, bracket_base_length/3, -bracket_thickness-.1]){
#slots(slot_diameter, bracket_base_slot_length, slot_spacing,bracket_thickness+1);
}
}
}
rotate(a = 90, v =[1,0,0] ){
for(y = [-servo_hole_spacing/2, servo_hole_spacing/2]){
translate([bracket_base_length + bracket_thickness + bracket_reach + servo_hole_offset, y + bracket_width/2,-bracket_height + bracket_thickness])
#cylinder(r = servo_hole_diameter/2, h = bracket_thickness + .1);
}
}
}
}
/*
* This is a 3 button button panel for these fancy momentary switches from adafruit
*
**/
module buttonPanel(){
difference(){
translate([-button_hole_diameter/2 - panel_padding/2, -button_hole_diameter/2 - panel_padding/2 ,0])
cube([button_hole_diameter + button_spacing + panel_padding, button_hole_diameter + button_spacing + panel_padding,plate_thickness]);
union(){
cylinder(r=button_hole_diameter/2, h = plate_thickness);
translate([button_spacing, 0, 0])
cylinder(r=button_hole_diameter/2, h = plate_thickness);
translate([button_spacing/2, button_spacing, 0])
cylinder(r=button_hole_diameter/2, h = plate_thickness);
}
}
}
//////////////////////////////////////////////
// Place and instantiate modules for printing
// Change the translate values or comment out
// the module calls to move or remove parts for
// printing
///////////////////////////////////////////////
/*
difference(){ // Create groove/trap behind plate so it will sit flush against door
// when there is fasteners through the plate
difference(){ // subtract slots from backplate
backplate();
translate([slot_width_offset, slot_height_offset, 0])
#slots(slot_diameter, slot_length, slot_spacing, plate_thickness);
}
translate([slot_width_offset + (slot_diameter/2 - trap_diameter/2) ,slot_height_offset ,0])
#slots(trap_diameter, trap_length, trap_spacing, trap_depth);
}
// Move rotate the servo bracket
translate([-2, 25, 0])
rotate(a = [0,0,90])
servoBracket();
// Move and rotate coupling
translate([50, 41.5,0])
rotate(a = [0, 0, 90])
deadBoltCoupler(coupling_width, coupling_depth, coupling_length, coupling_wall_thickness);*/
buttonPanel();