OpenSCAD 3D models for use with PD Buddy devices
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

programming-jig.scad 5.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. include <MCAD/polyholes.scad>;
  2. include <MCAD/units.scad>;
  3. include <sink.scad>;
  4. /*
  5. * Mill-Max Series 854 cutout
  6. *
  7. * Cutout is centered on the first pin, with the other pins along the positive
  8. * X axis.
  9. */
  10. module mill_max_854_cutout(pins, h, clearance) {
  11. translate([-0.025*inch - 0.115*inch/2 - clearance, -0.0435*inch - clearance, 0])
  12. cube([pins*.05*inch + 0.115*inch + 2*clearance, .087*inch + 2*clearance, h]);
  13. }
  14. /*
  15. * 3D-printed part of a PD Buddy programming jig
  16. */
  17. module programming_jig(board=sink_1_0, layer_thickness=0.4*mm,
  18. extrusion_width=0.6*mm, clearance=0.1*mm) {
  19. /* It would be ridiculous to try to cram enough information into the board
  20. * objects to properly parameterize this, so the board is only used to set
  21. * which object we're making. */
  22. if (board == sink_0_3 || board == sink_1_0) {
  23. /* Pin dimensions */
  24. pwr_bottom = 0.212*inch;
  25. pwr_stroke = 0.090*inch;
  26. pwr_mid = pwr_bottom + pwr_stroke/2;
  27. swd_bottom = 0.212*inch;
  28. swd_stroke = 0.055*inch;
  29. swd_mid = swd_bottom + swd_stroke/2;
  30. /* The ideal height for the pin jig: the average of the mid-stroke
  31. * heights for both types of pin */
  32. ideal_board_height = (pwr_mid + swd_mid)/2;
  33. /* The height of the pin jig, rounded to the nearest layer_thickness */
  34. board_height = round(ideal_board_height / layer_thickness) * layer_thickness;
  35. echo(ideal_board_height=ideal_board_height, board_height=board_height);
  36. echo(pwr_percent=100-(board_height-pwr_bottom)*100/pwr_stroke);
  37. echo(swd_percent=100-(board_height-swd_bottom)*100/swd_stroke);
  38. /* The board's ideal location */
  39. /*
  40. # translate([0, 0, ideal_board_height])
  41. sink(board);
  42. */
  43. /* The board's real location */
  44. /*
  45. translate([0, 0, board_height])
  46. sink(board);
  47. */
  48. /* Lip around the board */
  49. translate([-2*extrusion_width - clearance, -2*extrusion_width - clearance, board_height])
  50. cube([4*extrusion_width + 2*clearance + sink_length(board), 2*extrusion_width, sink_thickness(board)]);
  51. translate([-2*extrusion_width - clearance, sink_width(board) + clearance, board_height])
  52. cube([4*extrusion_width + 2*clearance + sink_length(board), 2*extrusion_width, sink_thickness(board)]);
  53. translate([-2*extrusion_width - clearance, -clearance, board_height])
  54. cube([2*extrusion_width, 2*clearance + sink_width(board), sink_thickness(board)]);
  55. translate([sink_length(board) + clearance, -clearance, board_height])
  56. cube([2*extrusion_width, 2*clearance + sink_width(board), sink_thickness(board)]);
  57. /* Box under the board
  58. * Every cutout is extended by clearance in X and Y. Since the board
  59. * can shift by that much, everything on it can too. */
  60. difference() {
  61. translate([-2*extrusion_width - clearance, -2*extrusion_width - clearance, 0])
  62. cube([4*extrusion_width + 2*clearance + sink_length(board),
  63. 4*extrusion_width + 2*clearance + sink_width(board),
  64. board_height]);
  65. /* Cutout for the output connector */
  66. hull() {
  67. translate([26.5*mm, 11*mm, -epsilon])
  68. polyhole(d=2*1.75*mm + 2*clearance, h=board_height + 2*epsilon);
  69. translate([26.5*mm, 14*mm, -epsilon])
  70. polyhole(d=2*1.75*mm + 2*clearance, h=board_height + 2*epsilon);
  71. }
  72. /* Cutout under the USB connector */
  73. translate([-clearance, sink_width(board)/2 - sink_connector_cutout(board)/2 - clearance, board_height - 2*layer_thickness])
  74. cube([2*clearance + sink_connector(board)[0] - sink_connector_extend(board), sink_connector_cutout(board) + 2*clearance, 2*layer_thickness + epsilon]);
  75. /* Cutout for the switch */
  76. switch_cutout_height = ceil((1.4*mm + layer_thickness)/layer_thickness)*layer_thickness;
  77. translate([12*mm - clearance, 3.5*mm - clearance, board_height - switch_cutout_height])
  78. cube([9*mm + 2*clearance, 6*mm + 2*clearance, switch_cutout_height + epsilon]);
  79. /* Cutout for the power pins */
  80. translate([11*mm - 0.05*inch - clearance, 2*mm - 0.05*inch - clearance, -epsilon])
  81. cube([0.2*inch + 2*clearance, 0.1*inch + 2*clearance, board_height + 2*epsilon]);
  82. /* Cutout to remove the thin piece between the switch and power
  83. * pins */
  84. translate([12*mm - clearance, 2*mm + 0.05*inch - epsilon, board_height - switch_cutout_height])
  85. cube([-1*mm + 0.15*inch + 2*clearance, 1.5*mm - 0.05*inch + 2*epsilon, switch_cutout_height + epsilon]);
  86. /* Cutouts for the SWD pins */
  87. translate([23.55*mm, 17.96*mm, -epsilon])
  88. rotate([0, 0, 90])
  89. mill_max_854_cutout(pins=5, h=board_height + 2*epsilon, clearance=clearance);
  90. translate([27.45*mm, 17.96*mm, -epsilon])
  91. rotate([0, 0, 90])
  92. mill_max_854_cutout(pins=5, h=board_height + 2*epsilon, clearance=clearance);
  93. }
  94. /* Mounting holes */
  95. difference() {
  96. translate([sink_length(board) + clearance + 2*extrusion_width,
  97. -clearance - 2*extrusion_width,
  98. 0])
  99. cube([8*mm, 8.5*mm, board_height + sink_thickness(board)]);
  100. translate([35*mm, 3*mm, -epsilon])
  101. polyhole(d=3.3*mm, h=board_height + sink_thickness(board) + 2*epsilon);
  102. }
  103. difference() {
  104. translate([-clearance - 2*extrusion_width,
  105. sink_width(board) + clearance + 2*extrusion_width,
  106. 0])
  107. rotate([0, 0, 180])
  108. cube([8*mm, 8.5*mm, board_height + sink_thickness(board)]);
  109. translate([-5*mm, 22*mm, -epsilon])
  110. polyhole(d=3.3*mm, h=board_height + sink_thickness(board) + 2*epsilon);
  111. }
  112. echo(total_height=board_height + sink_thickness(board));
  113. }
  114. }
  115. programming_jig();