chiark / gitweb /
adafruit-powerboost: wip common
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 21 Nov 2021 13:30:04 +0000 (13:30 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 21 Nov 2021 13:30:04 +0000 (13:30 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
adafruit-powerboost-500.scad
adafruit-powerboost-common.scad

index defda26443ababfb6cb8241ca470935e1e48bf52..d946bdae287db0e0f0e0cda5055eb0c1d508ae92 100644 (file)
@@ -4,70 +4,20 @@ psu_sz  = [ 21.7, 36.0 ] + [ 0.25, 0.25 ];
 
 include <adafruit-powerboost-common.scad>
 
-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;
-
-psu_y = +psu_sz[1]/2 + psu_usb_protr;
-
 // ----- 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]
@@ -112,90 +62,3 @@ module PsuLedWindowsPlan(){
   }
 }
 
-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(){
-    intersection(){
-      PsuMountPositiveMain();
-      linextr_y_xz(-psu_y, psu_sz[1]*2) square(100, center=true);
-    }
-    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);
-    }
-  }
-}
-
-module PsuMountDemo(ceil = 2.5) { ////toplevel
-  translate([0, psu_y, psu_z]) {
-    PsuMountPositive();
-    %PsuMountNegative();
-    color("yellow") translate([0,0, -psu_z - ceil])
-      linear_extrude(height=0.4, convexity=10)
-      PsuLedWindowsPlan();
-  }
-}
index d9dcd8939bb083e6137ff9eea802a425185c9d94..555768b15f28f96ac8b72fa0977d3ac080bbfa7d 100644 (file)
@@ -2,3 +2,144 @@
 
 include <nutbox.scad>
 
+psu_th = 1.70 + 0.25;
+psu_th_for_clamp = 1.50;
+
+psu_hole_dia = 2.5 - 0.3;
+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_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;
+
+psu_y = +psu_sz[1]/2 + psu_usb_protr;
+
+// ----- calculated -----
+
+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 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(){
+    intersection(){
+      PsuMountPositiveMain();
+      linextr_y_xz(-psu_y, psu_sz[1]*2) square(100, center=true);
+    }
+    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);
+    }
+  }
+}
+
+module PsuMountDemo(ceil = 2.5) { ////toplevel
+  translate([0, psu_y, psu_z]) {
+    PsuMountPositive();
+    %PsuMountNegative();
+    color("yellow") translate([0,0, -psu_z - ceil])
+      linear_extrude(height=0.4, convexity=10)
+      PsuLedWindowsPlan();
+  }
+}