+++ /dev/null
-// 18650 is ~18mm diameter, ~65mm length,
-batt_diam = 18;
-batt_len = 65+1;
-batt_clip_h = 0.75 * batt_diam;
-wall = 2.2;
-
-eps = 0.01;
-infty = 300;
-
-pcb_len = 36;
-pcb_thick = 1.3;
-pcb_groove = 2;
-pcb_width = 11;
-pcb_clip_off = 5;
-pcb_clip_w = 8;
-
-wire_thick = 2;
-wire_sep = 3;
-
-translate([0, -batt_diam/2-wall-pcb_thick/2+eps, 0])
-difference() {
- union() {
- // lower part of the PCB holder
- translate([0, 0, (pcb_groove + wall) / 2])
- cube([pcb_len + 2*wall, pcb_thick + 2*wall, pcb_groove + wall], center=true);
- // rear part of the PCB holder (behind S1)
- translate([pcb_clip_off, 0, 0])
- cube([pcb_clip_w, pcb_thick/2+wall/2, pcb_width + 2*wall]);
- // side part of the PCB holder (near the battery wires)
- translate([-pcb_len/2-wall, -pcb_thick/2-wall, 0])
- cube([pcb_groove+wall, pcb_thick+1.5*wall, pcb_width + 2*wall]);
- };
- // the PCB itself
- translate([0, 0, wall + pcb_width/2])
- cube([pcb_len, pcb_thick, pcb_width+eps], center=true);
-};
-
-difference() {
- union() {
- // lower part of the battery holder
- translate([0, 0, pcb_groove/2 + wall/2])
- cube([batt_len + 2*wall, batt_diam + 2*wall, pcb_groove + wall],
- center=true);
- // rear part of the battery clip
- translate([-(batt_len/2-pcb_len/2+pcb_groove+wall)/2-pcb_len/2+pcb_groove, 0, batt_clip_h/2+wall/2])
- cube([batt_len/2-pcb_len/2+pcb_groove + wall, batt_diam + 2*wall, batt_clip_h + wall], center=true);
- // front (+) part of the battery clip
- translate([batt_len/2+wall/2, 0, batt_clip_h/2+wall/2])
- hull() {
- cube([wall, batt_diam + 2*wall, batt_clip_h + wall], center=true);
- translate([-10/2, 0, -batt_clip_h/2])
- cube([10, batt_diam+2*wall, wall], center=true);
- };
- // middle clips
- translate([pcb_clip_off+pcb_clip_w/2, 0, batt_clip_h/2+wall/2])
- hull() {
- cube([pcb_clip_w, batt_diam + 2*wall, batt_clip_h + wall], center=true);
- translate([0, 0, -batt_clip_h/2])
- cube([2*pcb_clip_w, batt_diam+2*wall, wall], center=true);
- };
- };
- // battery
- translate([-batt_len/2, 0, batt_diam/2+wall])
- rotate([0, 90, 0])
- cylinder(r=batt_diam/2, h = batt_len);
- // top part rounded
- difference() {
- translate([0, 0, infty/4 + wall + batt_diam/2])
- cube([infty/2, infty/2, infty/2], center=true);
- translate([-infty/2, 0, batt_diam/2+wall])
- rotate([0, 90, 0])
- cylinder(r=batt_diam/2+wall, h = infty);
- };
- // wire holes
- for (j=[-wire_sep/2, wire_sep/2])
- for (i=[-wire_sep/2, wire_sep/2])
- translate([-infty/2, i, batt_diam/2 + wall+j])
- rotate([0, 90, 0])
- rotate([0, 0, 90])
- cylinder(r=wire_thick/2, h = infty, $fn=6);
-
- translate([-infty/2, -batt_diam/2, wall + pcb_groove + wire_thick/2])
- rotate([0, 90, 0])
- rotate([0, 0, 90])
- cylinder(r=wire_thick/2, h = infty, $fn=6);
-};
-