chiark / gitweb /
adafruit-powerboost-500: transfer from other tree
[reprap-play.git] / adafruit-powerboost-500.scad
diff --git a/adafruit-powerboost-500.scad b/adafruit-powerboost-500.scad
new file mode 100644 (file)
index 0000000..ddf2b2d
--- /dev/null
@@ -0,0 +1,186 @@
+// -*- C -*-
+
+include <nutbox.scad>
+
+psu_sz  = [ 21.7, 36.0 ] + [ 0.25, 0.25 ];
+
+psu_th = 1.70 + 0.25;
+psu_th_for_clamp = 1.50;
+
+psu_hole_pos = [ 2.05, // from back edge of psu_sz[0]
+                0.55 * 0.5 * 25.4, // from centreline
+                ];
+psu_hole_dia = 2.5 - 0.3;
+psu_baffle_gap = 1.0 + 0.5;
+psu_baffle_cnr_y = 7.45; // from connector end
+psu_baffle_th = [ 0.8, 3.5 ];
+psu_connector_z = 2.9 + 0.1;
+psu_connector_z_overlap = 0.15;
+psu_connector_depth = 6.25;
+psu_connector_w = 8.0 + 0.5;
+psu_usb_protr = 0.6;
+psu_usbend_led_x = 4.5;
+psu_innerend_led_depth = 10;
+
+psu_clamp_th = 4.0 + 0.75;
+psu_clamp_w = 8.0;
+psu_clamp_gap = 0.4;
+
+psu_board_clamp_ovlp = 4.5;
+psu_board_support_wall = 2;
+psu_board_nutbox = nutbox_data_M3;
+
+// ----- calculated -----
+
+psu_usbend_led_depth = psu_baffle_cnr_y*2 - psu_usbend_led_x;
+
+psu_z = NutBox_h_base(psu_board_nutbox);
+psu_z_down = psu_z + 0.1;
+
+
+module PsuBoardRepresentation(){
+  linear_extrude(height= psu_th)
+    square(center=true, [psu_sz[0],psu_sz[1]]);
+}
+
+module PsuRepresentation(){
+  PsuBoardRepresentation();
+  translate([0, -psu_sz[1]/2, -psu_connector_z])
+    linear_extrude(height= psu_connector_z + psu_connector_z_overlap)
+    rectfromto([ -psu_connector_w/2, -10 ],
+              [ +psu_connector_w/2, psu_connector_depth ]);
+}
+
+module AtPsuMountCorner(mx,my){
+  mirror([mx,0,0])
+    mirror([0,my,0])
+      translate(-0.5 * [psu_sz[0], psu_sz[1], 0]
+               -1 * [0,0, psu_z_down])
+       children();
+}
+
+module PsuMountCornerExtrude(mx,my, plus_z=board_support_z){
+  AtPsuMountCorner(mx,my){
+    linear_extrude(height= psu_z_down + plus_z, convexity=10) {
+      children();
+    }
+  }
+}
+
+module PsuLedBafflePlan(){
+  baffle_tr = [0, psu_baffle_cnr_y]
+    + 0.5 * [psu_baffle_th[1], psu_baffle_th[0]];
+  translate([0, -psu_sz[1]/2]) {
+    mirror([1,0,0]) {
+      rectfromto([-psu_baffle_th[1]/2, 0],
+                baffle_tr);
+      rectfromto([-psu_sz[0]/2 - psu_board_support_wall *2,
+                 baffle_tr[1] - psu_baffle_th[0]],
+                baffle_tr);
+    }
+  }
+}
+
+module PsuLedWindowsPlan(){
+  difference(){
+    union(){
+      AtPsuMountCorner(1,0) {
+       rectfromto([ -(psu_board_support_wall + 0.1),
+                    +psu_usbend_led_x ],
+                  [ psu_sz[0]/2,
+                    +psu_usbend_led_depth ]);
+      }
+      AtPsuMountCorner(0,0) {
+       sz = psu_baffle_cnr_y - psu_board_support_wall - psu_baffle_th[0];
+       translate([0, psu_baffle_cnr_y])
+         rectfromto([ -(psu_board_support_wall + 0.1),
+                      -sz/2 ],
+                    [ psu_sz[0]/2,
+                      +sz/2 ]);
+      }
+      AtPsuMountCorner(0,1){
+       rectfromto([0,0],
+                  [psu_sz[0]/2 - psu_hole_pos[1] - psu_hole_dia/2,
+                    psu_innerend_led_depth]);
+      }
+    }
+    PsuLedBafflePlan();
+    translate([0, -psu_sz[1]/2])
+      square(center=true, [psu_baffle_th[1], psu_sz[1]]);;
+  }
+}
+
+module PsuMountPositiveMain(){
+  for (mx=[0,1]) {
+    for (my=[0,1]) {
+      PsuMountCornerExtrude(mx,my){
+       rectfromto(-[1,1]*psu_board_support_wall,
+                  +[1,1]*board_support_ovlp);
+      }
+    }
+    // mount above at plug end
+    PsuMountCornerExtrude(mx,0, psu_th + psu_board_support_wall){
+      rectfromto(-[1,1]*psu_board_support_wall,
+                [board_support_ovlp,
+                 board_support_ovlp_ceil]);
+    }
+  }
+  translate([0,0, -psu_z_down])
+    linear_extrude(psu_z_down - psu_baffle_gap, convexity=10)
+      PsuLedBafflePlan();
+}
+
+module PsuMountNegative(){
+  axis = [0, -psu_sz[1]/2, psu_th];
+  PsuRepresentation();
+  translate(axis)
+    rotate([atan(2 * board_support_z / psu_sz[1]),
+           0,0])
+    translate(-axis)
+    PsuBoardRepresentation();
+}
+
+module PsuMountPositive(){
+  difference(){
+    PsuMountPositiveMain();
+    PsuMountNegative();
+    intersection(){
+      hull(){
+       PsuBoardRepresentation();
+       translate([0,0,5]) PsuBoardRepresentation();
+      }
+      translate([-20,0,-20]) cube(40);
+    }
+  }
+  for (mx=[0,1]) {
+    PsuMountCornerExtrude(mx,1){
+      translate([psu_sz[0]/2 - psu_hole_pos[1],
+                psu_hole_pos[0]]
+               + board_gap * [1,1] )
+       circle(r= psu_hole_dia/2);
+    }
+  }
+  translate([0, psu_sz[1]/2 + psu_board_nutbox[0]/2, 0])
+    rotate([0,0,180])
+    NutBox(psu_board_nutbox, psu_z_down);
+}
+
+module PsuClamp(){ ////toplevel
+  rotate([180,0,0]) difference(){
+    linear_extrude(height=psu_clamp_th + psu_th_for_clamp, convexity=5) {
+      difference(){
+       hull(){
+         circle(r = fix_sz/2);
+         translate([ -psu_board_nutbox[0]/2, 0])
+           square(center=true, [ psu_board_clamp_ovlp*2, psu_clamp_w ]);
+       }
+       circle(r = psu_board_nutbox[0]/2);
+      }
+    }
+    translate([0,0,-1]) linear_extrude(height=psu_th_for_clamp+1) {
+      translate([ -psu_board_nutbox[0]/2 + psu_clamp_gap, 0 ])
+       mirror([1,0])
+       translate([0,-20]) square(40);
+    }
+  }
+}