chiark / gitweb /
adafruit-powerboost: solder space prep nfc
[reprap-play.git] / adafruit-powerboost-common.scad
index eef9226c73781cfc08acd4cded2b74c694eb29e1..c731c224062fb0e150f8b8e5e42a1e80129e9d54 100644 (file)
@@ -1,9 +1,14 @@
 // -*- C -*-
 
 include <nutbox.scad>
+include <utils.scad>
 
 psu_sz  = psu_sz_nom + [ 0.11, 0.44 ] + [ 0.25, 0.25 ];
 
+psu_hole_pos = [ 2.05, // from back edge of psu_sz[0]
+                0.55 * 0.5 * 25.4, // from centreline
+                ];
+
 psu_th = 1.70 + 0.25;
 psu_th_for_clamp = 1.50;
 
@@ -19,15 +24,24 @@ 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_board_gap = 0.5;
+psu_board_support_wall = 2;
+psu_board_support_ovlp = 4.5;
+psu_board_support_ovlp_ceil = 2;
+psu_board_support_z = 2;
+
+psu_baffle_gap = 1.0 + 0.5;
+
 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;
+psu_fix_sz = NutBox_outer_size(psu_board_nutbox);
+psu_board_nutbox_y = psu_sz[1]/2 + psu_board_nutbox[0]/2;
 
 module PsuBoardRepresentation(){
   linear_extrude(height= psu_th)
@@ -50,7 +64,7 @@ module AtPsuMountCorner(mx,my){
        children();
 }
 
-module PsuMountCornerExtrude(mx,my, plus_z=board_support_z){
+module PsuMountCornerExtrude(mx,my, plus_z=psu_board_support_z){
   AtPsuMountCorner(mx,my){
     linear_extrude(height= psu_z_down + plus_z, convexity=10) {
       children();
@@ -63,14 +77,14 @@ module PsuMountPositiveMain(){
     for (my=[0,1]) {
       PsuMountCornerExtrude(mx,my){
        rectfromto(-[1,1]*psu_board_support_wall,
-                  +[1,1]*board_support_ovlp);
+                  +[1,1]*psu_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]);
+                [psu_board_support_ovlp,
+                 psu_board_support_ovlp_ceil]);
     }
   }
   translate([0,0, -psu_z_down])
@@ -82,7 +96,7 @@ module PsuMountNegative(){
   axis = [0, -psu_sz[1]/2, psu_th];
   PsuRepresentation();
   translate(axis)
-    rotate([atan(2 * board_support_z / psu_sz[1]),
+    rotate([atan(2 * psu_board_support_z / psu_sz[1]),
            0,0])
     translate(-axis)
     PsuBoardRepresentation();
@@ -107,13 +121,15 @@ module PsuMountPositive(){
     PsuMountCornerExtrude(mx,1){
       translate([psu_sz[0]/2 - psu_hole_pos[1],
                 psu_hole_pos[0]]
-               + board_gap * [1,1] )
+               + psu_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);
+  difference(){
+    translate([0, psu_board_nutbox_y, 0])
+      rotate([0,0,180])
+      NutBox(psu_board_nutbox, psu_z_down);
+  }
 }
 
 module PsuClamp(){ ////toplevel
@@ -121,7 +137,7 @@ module PsuClamp(){ ////toplevel
     linear_extrude(height=psu_clamp_th + psu_th_for_clamp, convexity=5) {
       difference(){
        hull(){
-         circle(r = fix_sz/2);
+         circle(r = psu_fix_sz/2);
          translate([ -psu_board_nutbox[0]/2, 0])
            square(center=true, [ psu_board_clamp_ovlp*2, psu_clamp_w ]);
        }
@@ -145,10 +161,46 @@ module PsuLedWindowsPlan(){
 
 module PsuMountDemo(ceil = 2.5) { ////toplevel
   translate([0, psu_y, psu_z]) {
-    PsuMountPositive();
+    difference(){
+      PsuMountPositive();
+      linextr(-20, 0.1)
+       PsuLedWindowsPlan();
+    }
     %PsuMountNegative();
     color("yellow") translate([0,0, -psu_z - ceil])
       linear_extrude(height=0.4, convexity=10)
       PsuLedWindowsPlan();
+
+    translate([0, psu_board_nutbox_y, 10])
+      rotate([180,0,0])
+      rotate([0,0,-90])
+      PsuClamp();
+  }
+}
+
+module PsuMountTest(ceil = 2.5) { ////toplevel
+  $fs = 0.1;
+  $fa = 3;
+  difference(){
+    union(){
+      translate([0, psu_y, psu_z])
+       PsuMountPositive();
+      difference(){
+       linextr_x_yz(-(psu_sz[0]/2 + 5),
+                    +(psu_sz[0]/2 + 5)){
+         difference(){
+           rectfromto([-ceil, -ceil], [psu_sz[1] + 10, psu_z + 10]);
+           rectfromto([0,0], 400*[1,1]);
+         }
+       }
+       translate([0, psu_y, psu_z]) {
+         PsuMountNegative();
+       }
+      }
+    }
+    translate([0, psu_y, psu_z]) {
+      linextr(-10, 0.1)
+       PsuLedWindowsPlan();
+    }
   }
 }