2 - nabeh zaklapavaciho hranolu by mel byt zkoseny
3 - vystup pro kabel leze do vystupu pro snuru pri vetsim wall
4 - diry pro uchyceni jsou mozna prilis male
6 lowres = 1; // fast rendering or fine printing with print-friendly orientation
11 wall = 2.0; // generic wall thickness
13 // 18650 is ~18mm diameter, ~65mm length,
20 front_flat_len = batt_len + 4*wall + 2*cable_sep;
22 // PCB-related dimensions
23 pcb_len = 36 + 1; // length of the board
24 pcb_width = 11 + 0.5; // width of the board
25 pcb_thick = 1.2 + 0.3; // thickness of the board
26 pcb_comp_h = 2.2; // height of the components on board
29 body_top_h = 0.35 * batt_diam; // cube-shaped part of the body
36 batt_end_h = wire_sep/2 + wire_thick/2 + 1.5;;
38 lid_sep = 0.1; // the lid is made this much smaller to separate from the body
42 sw_xoff = 250 * 25.4/1000; // x offset of microswitches
43 pcb_xoff = 90 * 25.4/1000; // offset of the LED from the middle of the PCB
45 prg_len = 10; // programming connector
48 rear_clip_hole_dist = 10; // distance between the holes in the rear clip
49 rear_clip_aspect = 0.35; // w/h aspect ratio of the ellipse of the rear clip
53 translate([-batt_len/2-2*wall-cable_sep, -batt_diam/2-wall, 0])
54 cube([batt_len + 4*wall + 2*cable_sep,
55 batt_diam+2*wall, body_top_h]);
57 translate([-batt_len/2-2*wall-cable_sep, 0, 0])
59 cylinder(r=batt_diam/2+wall,
60 h = batt_len + 4*wall + 2*cable_sep);
61 translate([-infty/2, -infty/2, eps]) cube(infty);
63 translate([-front_flat_len/2,
64 batt_diam/2 - pcb_width,
65 -batt_diam/2-2*pcb_comp_h-pcb_thick-wall])
66 cube([front_flat_len, pcb_width+wall, eps]);
68 for (x = [-1, 1]) scale([x, 1, 1]) hull() {
69 for (x0 = [0-wall, 10+wall])
70 translate([batt_len/2-wall-wire_thick-x0, batt_diam/2, 0])
71 rotate([-90, 0, 0]) scale([rear_clip_aspect, 1, 1])
72 cylinder(r=batt_diam/2 + 2*wall + wire_thick, h=wall);
79 // upper cube-shaped part
81 translate([-batt_len/2, -batt_diam/2, 0])
82 cube([batt_len, batt_diam, batt_diam]);
84 // battery cylinder for the lower part
85 translate([-batt_len/2, 0, 0])
87 cylinder(r=batt_diam/2, h = batt_len);
90 translate([-pcb_len/2-pcb_xoff,
91 batt_diam/2-pcb_width,
92 -batt_diam/2-pcb_thick - pcb_comp_h])
93 cube([pcb_len, pcb_width,
94 batt_diam/2 + pcb_thick + pcb_comp_h + eps]);
96 translate([-pcb_len/2-pcb_xoff-wall-2*outwire_thick,
97 batt_diam/2-pcb_width,
98 -batt_diam/2-pcb_comp_h])
99 cube([pcb_len, pcb_width,
100 batt_diam/2 + pcb_comp_h + eps]);
101 // hole under the PCB
102 translate([-pcb_len/2+pcb_groove-pcb_xoff,
103 batt_diam/2-pcb_width + pcb_groove,
104 -batt_diam/2-pcb_thick - 2*pcb_comp_h])
105 cube([pcb_len-2*pcb_groove, pcb_width-2*pcb_groove,
106 batt_diam/2 + pcb_thick + pcb_comp_h + eps]);
107 // hole for prog connector
108 translate([pcb_len/2-pcb_xoff-pcb_groove-eps,
109 batt_diam/2-pcb_width/2-prg_width/2,
110 -batt_diam/2-pcb_thick - 2*pcb_comp_h])
112 cube([prg_len+pcb_groove+eps, prg_width,
113 batt_diam/2 + pcb_thick + pcb_comp_h + eps]);
114 translate([prg_len/2+pcb_groove, -eps, pcb_comp_h])
115 cube([prg_len/2+eps, prg_width+2*eps, pcb_thick]);
118 translate([0, batt_diam/2-pcb_width/2, -infty/2]) {
119 cylinder(r=led_diam/2, h=infty, $fn=6);
120 translate([sw_xoff, 0, 0])
121 cylinder(r=sw_diam/2, h=infty, $fn=6);
122 translate([-sw_xoff, 0, 0])
123 cylinder(r=sw_diam/2, h=infty, $fn=6);
126 translate([-pcb_xoff-pcb_len/2-outwire_thick-wall, -6, 0])
129 cylinder(r=outwire_thick/2, h = infty, $fn=12);
130 // space under the wire holes for battery contacts
131 translate([-batt_len/2-2*wall-cable_sep-eps, 0, 0])
134 cylinder(r = batt_diam/2-wall, h = batt_len + 4*wall + 2*cable_sep + 2*eps);
135 translate([-infty/2, -infty/2, -batt_end_h])
138 // space above the wire holes for battery contacts
139 translate([-batt_len/2-2*wall-cable_sep-eps, -batt_diam/2, batt_end_h])
140 cube([batt_len + 4*wall + 2*cable_sep + 2*eps,
143 // wire holes for battery contacts
146 translate([-batt_len/2-wall-eps, x*wire_sep/2, y*wire_sep/2])
148 cylinder(r = wire_thick/2, h = batt_len + 2*wall + 2*eps, $fn=6);
149 // wire hole from PCB to battery contacts
150 // translate([-batt_len/2-wall-eps, 0, -batt_diam/2-pcb_comp_h + wire_thick/2])
152 translate([-batt_len/2-wall-eps, 0, -batt_diam/2 - wall/2 - wire_thick/2])
154 cylinder(r = wire_thick/2, h = batt_len + 2*wall + 2*eps, $fn=6);
155 // hole behind the battery contacts
157 scale([x, 1, 1]) translate([batt_len/2+wall, 0, 0]) hull() {
158 translate([0, -batt_diam/2, 0])
159 cube([wall + cable_sep + eps, batt_diam, infty]);
161 cylinder(r = batt_diam/2, h = wall+cable_sep+eps);
162 translate([0, batt_diam/2 - pcb_width,
163 -batt_diam/2-pcb_comp_h-pcb_thick])
164 cube([wall + cable_sep + eps, pcb_width, eps]);
165 translate([cable_sep, batt_diam/2 - pcb_width + wall,
166 -batt_diam/2-pcb_comp_h-pcb_thick-wall])
167 cube([wall + eps, pcb_width-2*wall, eps]);
169 // cable lead to battery contacts
170 for (x=[1, -1]) scale([x, 1, 1])
172 translate([batt_len/2+wire_thick/2, 0, batt_diam/2-2.7])
173 cylinder(r=wire_thick/2, h = 5.4);
176 for(x=[-1,1]) scale([x, 1, 1])
177 translate([batt_len/2-wall-wire_thick, batt_diam/2+2*wall, -batt_diam/2-pcb_thick-2*pcb_comp_h-wall])
180 for (x = [-1, 1]) scale([x, 1, 1]) for (x0 = [0, 10])
181 translate([batt_len/2-wall-wire_thick-x0, 0, batt_diam/2+wire_thick/2+wall])
183 scale([2,1,1]) cylinder (r=wire_thick/2, h=infty, $fn=16);
186 for (x = [-1, 1]) scale([x, 1, 1])
187 translate([batt_len/2+wall-eps, batt_diam/2-pcb_width+wall/2+lid_sep,
188 -batt_diam/2-pcb_thick-pcb_comp_h + wall + lid_sep])
189 cube([cable_sep+eps, pcb_width-2*wall-2*lid_sep, wall]);
193 translate([-batt_len/2 - wall - lid_sep, -batt_diam/2+lid_sep, -batt_diam/2 -wall])
194 cube([batt_len + 2*wall + 2*lid_sep, batt_diam-2*lid_sep, batt_diam/2 - batt_end_h + wall - lid_sep]);
195 translate([-batt_len/2 - 2*wall - cable_sep, -batt_diam/2 - wall,
197 cube([batt_len + 4*wall + 2*cable_sep, batt_diam + 2*wall,
198 wall + batt_diam/2 - body_top_h - lid_sep]);
199 // clip behind the battery contacts
201 scale([x, 1, 1]) translate([batt_len/2+wall+lid_sep, 0, 0]) hull() {
202 translate([0, -batt_diam/2+lid_sep, -batt_diam/2])
203 cube([wall+cable_sep-lid_sep, batt_diam-2*lid_sep, eps]);
205 cylinder(r = batt_diam/2-lid_sep, h = wall+cable_sep-lid_sep);
206 translate([0, batt_diam/2 - pcb_width+lid_sep,
207 batt_diam/2+pcb_comp_h+pcb_thick-lid_sep])
208 cube([wall+cable_sep-lid_sep, pcb_width-2*lid_sep, eps]);
209 translate([cable_sep+wall/2, batt_diam/2 - pcb_width + 1.5*wall +lid_sep,
210 batt_diam/2+pcb_comp_h+pcb_thick+wall/2-lid_sep])
211 cube([wall/2-lid_sep, pcb_width-2*wall-2*lid_sep, eps]);
213 translate([cable_sep+wall-lid_sep, 0, -batt_diam/2-wall]) difference() {
215 cylinder(r = batt_diam/2 - lid_sep, h = eps);
216 translate([-infty, -infty/2, -infty/2]) cube(infty);
224 translate([-batt_len/2+eps, 0, 0]) rotate([0, 90, 0])
225 cylinder(r=batt_diam/2, h=batt_len-2*eps);
228 translate([-batt_len/2-cable_sep-wall, 0, 0]) rotate([0, 90, 0])
229 cylinder(r=batt_diam/2-wall-lid_sep, h=batt_len+2*wall+2*cable_sep);
230 translate([-infty/2, -batt_diam/2, -infty-wire_sep/2-wire_thick/2])
231 cube([infty, batt_diam, infty]);
233 translate([-batt_len/2-cable_sep-wall, batt_diam/2-pcb_width+0.5*wall+0.5*lid_sep, batt_diam/2 + pcb_comp_h+pcb_thick-wall-lid_sep])
234 cube([batt_len + 2*wall + 2* cable_sep, pcb_width-1.5*wall-1.5*lid_sep, eps]);
236 // holes for the mounting clips on the body
237 for (x = [-1, 1]) scale([x, 1, 1]) hull() {
238 for (x0 = [0-wall, 10+wall])
239 translate([batt_len/2-wall-wire_thick-x0, batt_diam/2-lid_sep+eps, 0])
240 rotate([-90, 0, 0]) scale([rear_clip_aspect, 1, 1])
241 cylinder(r=batt_diam/2 + 2*wall + wire_thick+lid_sep/rear_clip_aspect, h=wall+lid_sep+eps);
246 module vert_torus() {
249 rotate_extrude() translate([5, 0, 0]) circle(r=wire_thick/2, $fn=16);
253 translate([0, 15, 0]) case();
254 translate([0, -15, 0]) rotate([180, 0, 0]) lid();
256 translate([0, 15, batt_diam/2+pcb_thick+2*pcb_comp_h+wall])
258 translate([0, -15, batt_diam/2+wall])