]> www.fi.muni.cz Git - heater.git/blob - heater-base.scad
heater-base.scad: Proof of concept case bottom
[heater.git] / heater-base.scad
1 // 18650 is ~18mm diameter, ~65mm length, 
2 batt_diam = 18;
3 batt_len = 65+1;
4 batt_clip_h = 0.75 * batt_diam;
5 wall = 2.2;
6
7 eps = 0.01;
8 infty = 300;
9
10 pcb_len = 36;
11 pcb_thick = 1.3;
12 pcb_groove = 2;
13 pcb_width = 11;
14 pcb_clip_off = 5;
15 pcb_clip_w = 8;
16
17 wire_thick = 2;
18 wire_sep = 3;
19
20 translate([0, -batt_diam/2-wall-pcb_thick/2+eps, 0])
21 difference() {
22         union() {
23                 // lower part of the PCB holder
24                 translate([0, 0, (pcb_groove + wall) / 2])
25                         cube([pcb_len + 2*wall, pcb_thick + 2*wall, pcb_groove + wall], center=true);
26                 // rear part of the PCB holder (behind S1)
27                 translate([pcb_clip_off, 0, 0])
28                         cube([pcb_clip_w, pcb_thick/2+wall/2, pcb_width + 2*wall]);
29                 // side part of the PCB holder (near the battery wires)
30                 translate([-pcb_len/2-wall, -pcb_thick/2-wall, 0])
31                         cube([pcb_groove+wall, pcb_thick+1.5*wall, pcb_width + 2*wall]);
32         };
33         // the PCB itself
34         translate([0, 0, wall + pcb_width/2])
35                 cube([pcb_len, pcb_thick, pcb_width+eps], center=true);
36 };
37
38 difference() {
39         union() {
40                 // lower part of the battery holder
41                 translate([0, 0, pcb_groove/2 + wall/2])
42                         cube([batt_len + 2*wall, batt_diam + 2*wall, pcb_groove + wall],
43                         center=true);
44                 // rear part of the battery clip
45                 translate([-(batt_len/2-pcb_len/2+pcb_groove+wall)/2-pcb_len/2+pcb_groove, 0, batt_clip_h/2+wall/2])
46                         cube([batt_len/2-pcb_len/2+pcb_groove + wall, batt_diam + 2*wall, batt_clip_h + wall], center=true);
47                 // front (+) part of the battery clip
48                 translate([batt_len/2+wall/2, 0, batt_clip_h/2+wall/2])
49                         hull() {
50                                 cube([wall, batt_diam + 2*wall, batt_clip_h + wall], center=true); 
51                                 translate([-10/2, 0, -batt_clip_h/2])
52                                 cube([10, batt_diam+2*wall, wall], center=true);
53                         };
54                 // middle clips
55                 translate([pcb_clip_off+pcb_clip_w/2, 0, batt_clip_h/2+wall/2])
56                         hull() {
57                                 cube([pcb_clip_w, batt_diam + 2*wall, batt_clip_h + wall], center=true);
58                                 translate([0, 0, -batt_clip_h/2])
59                                 cube([2*pcb_clip_w, batt_diam+2*wall, wall], center=true);
60                         };
61         };
62         // battery
63         translate([-batt_len/2, 0, batt_diam/2+wall])
64                 rotate([0, 90, 0])
65                 cylinder(r=batt_diam/2, h = batt_len);
66         // top part rounded
67         difference() {
68                 translate([0, 0, infty/4 + wall + batt_diam/2])
69                         cube([infty/2, infty/2, infty/2], center=true);
70                 translate([-infty/2, 0, batt_diam/2+wall])
71                         rotate([0, 90, 0])
72                         cylinder(r=batt_diam/2+wall, h = infty);
73         };
74         // wire holes
75         for (j=[-wire_sep/2, wire_sep/2]) 
76         for (i=[-wire_sep/2, wire_sep/2]) 
77         translate([-infty/2, i, batt_diam/2 + wall+j])
78                 rotate([0, 90, 0])
79                 rotate([0, 0, 90])
80                 cylinder(r=wire_thick/2, h = infty, $fn=6);
81
82         translate([-infty/2, -batt_diam/2, wall + pcb_groove + wire_thick/2])
83                 rotate([0, 90, 0])
84                 rotate([0, 0, 90])
85                 cylinder(r=wire_thick/2, h = infty, $fn=6);
86 };
87