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.

195 lines
5.6KB

  1. use <stepper.scad>
  2. use <arm.scad>
  3. use <marker.scad>
  4. use <electronics.scad>
  5. use <sg90.scad>
  6. //module arm(holes, width, thinkness, bore){
  7. arm1 = 70;
  8. arm2 = 55;
  9. x = 55; //[15:85]
  10. y = 70; //[35:85]
  11. length = sqrt(pow(x,2) + pow(y,2));
  12. arm1_sq = pow(arm1,2);
  13. arm2_sq = pow(arm2,2);
  14. length_sq = pow(length,2);
  15. b = acos((arm1_sq + length_sq - arm2_sq)/(2 * arm1 * length));
  16. c = acos((arm1_sq - length_sq + arm2_sq)/(2 * arm1 * arm2));
  17. angle1 = b + atan2(y,x) - 90;
  18. angle2 = angle1 - 90 + c;
  19. stepper_spaceing = 47;
  20. stepper_offset = 55;
  21. arm_thickness = 3;
  22. arm_width = 10;
  23. arm_offset = 15;
  24. bus_diameter = 3 + arm_width;
  25. shaft_bore = 5.3;
  26. joint_bore = 3.2;
  27. joint_spacing = arm_thickness+1;
  28. set_screw_bore = 2.5;
  29. $fn = $preview? 32 : 72;
  30. module arm3 (){
  31. difference(){
  32. union(){
  33. translate([0,0,-arm_thickness/2])cylinder(d=bus_diameter,h=10-arm_thickness/2);
  34. arm([0,25],arm_width,arm_thickness,joint_bore);
  35. }
  36. cylinder(d=shaft_bore,h=16,center=true);
  37. rotate([0,-90,0]){
  38. rotate([45,0,0]) translate([arm_thickness,0,0]) cylinder(d=set_screw_bore,h=20);
  39. rotate([-45,0,0]) translate([arm_thickness,0,0]) cylinder(d=set_screw_bore,h=20);
  40. }
  41. }
  42. }
  43. module arm0 (){
  44. difference(){
  45. union(){
  46. cylinder(d=bus_diameter,h=20,center=true);
  47. arm([0,25],arm_width,arm_thickness,joint_bore);
  48. }
  49. cylinder(d=shaft_bore,h=21,center=true);
  50. rotate([0,-90,0]){
  51. translate([5,0,0]) cylinder(d=set_screw_bore,h=20);
  52. translate([-5,0,0]) cylinder(d=set_screw_bore,h=20);
  53. }
  54. }
  55. }
  56. module arm5a(){
  57. rotate([90, 0, 90]) arm([25,0,50],arm_width,arm_thickness,joint_bore);
  58. }
  59. module arm5b(){
  60. arm5a();
  61. difference(){
  62. translate([-arm_thickness/2-2.5,35,-14]) rotate([0,0,180]) {sg90_bracket();
  63. sg90(-90);
  64. }
  65. translate([0,25,0]) rotate([0,90,0]) cylinder(d=7,h=10,center=true);
  66. }
  67. }
  68. module arm5(){
  69. translate([joint_spacing,0,0]) arm5a();
  70. translate([-joint_spacing,0,0]) arm5b();
  71. translate([0,50,0]) difference() {cube([arm_thickness+2*joint_spacing,10,arm_width], center=true);
  72. cylinder(d=joint_bore,h=40,center=true);
  73. }
  74. }
  75. module arm6a(){
  76. union(){
  77. rotate([0,0,90]) arm([0,30-arm_width/2],arm_width,arm_thickness,joint_bore);
  78. translate([0,30-arm_width/2,0]) cube([arm_width,arm_width,arm_thickness],center=true); //cylinder(h=arm_thickness,d=arm_width,center=true);
  79. }
  80. }
  81. module arm6b(){
  82. difference() {
  83. length = 29;
  84. hull() {
  85. cylinder(h=arm_thickness, d=arm_width,center=true);
  86. translate([0,length,0]) cylinder(h=arm_thickness, d=5, center=true);
  87. }
  88. cylinder(h=arm_thickness+1, d=joint_bore,center=true);
  89. translate([0,length,0]) cylinder(h=arm_thickness+1, d=2, center=true);
  90. }
  91. }
  92. module arm6(){
  93. arm_offset = 5+arm_thickness/2+1;
  94. difference(){
  95. union(){
  96. // joint arms
  97. translate([0,0,arm_offset]) arm6a();
  98. translate([0,0,-arm_offset]) arm6a();
  99. // servo arm
  100. translate([0,0,arm_offset]) rotate([0,0,90]) arm6b();
  101. // cylinder for marker holder
  102. translate([0,30,0]) {
  103. translate([-20+arm_width/2,0,0]) rotate([0,90,0]) cylinder(d=20,h=20);
  104. translate([-5,0,0]) {
  105. // added thinkness for setscrews
  106. rotate([-45,0,0]) cylinder(d=7,h=11);
  107. rotate([-135,0,0]) cylinder(d=7,h=11);
  108. }
  109. }
  110. }
  111. translate([0,30,0]){
  112. // hole for marker
  113. translate([-20+arm_width/2-1,0,0])rotate([0,90,0]) cylinder(d=16,h=22);
  114. translate([-5,0,0]) {
  115. // holes for setscrew
  116. rotate([-45,0,0]) cylinder(d=set_screw_bore,h=40);
  117. rotate([-135,0,0]) cylinder(d=set_screw_bore,h=40);
  118. }
  119. }
  120. }
  121. }
  122. //!arm6();
  123. translate([stepper_offset,0,0]) {
  124. // stepper on joint C
  125. rotate([-90,0,-90]) stepper_103H5205();
  126. // stepper on joint A
  127. translate([0,stepper_spaceing,0]) rotate([90,0,90]) stepper_103H5205();
  128. translate([arm_offset,0,0]){
  129. //arm0
  130. translate([0,stepper_spaceing,0]) rotate([angle1,0,0]) rotate([0,90,0]) arm0();//([0,-25],arm_width,arm_thickness,5);
  131. //arm1
  132. rotate([angle1,0,0]) rotate([0,-90,0])
  133. difference(){
  134. arm([0,-25,arm1],arm_width,arm_thickness,joint_bore);
  135. cylinder(d=shaft_bore, h= 10, center=true);
  136. translate([45,10,0]) cylinder(d=16, h=10, center=true);
  137. }
  138. //arm2
  139. translate([3,0,0]) rotate([angle1,0,0]) translate([0,0,-25]) rotate([-angle1,0,0]) rotate([90,0,90]) arm([0,stepper_spaceing],arm_width,arm_thickness,joint_bore);
  140. translate([-3,0,0]) rotate([angle1,0,0]) translate([0,0,-25]) rotate([-angle1,0,0]) rotate([90,0,90]) arm([0,stepper_spaceing],arm_width,arm_thickness,joint_bore);
  141. //arm3
  142. rotate([angle2,0,0]){
  143. translate([3,0,0]) rotate([-90,0,-90]) arm3(); //([0,25],arm_width,arm_thickness,5);
  144. translate([-3,0,0]) rotate([90,0,-90]) arm3(); //arm([0,25],arm_width,arm_thickness,5);
  145. translate([0,-25,0]) rotate([angle1-angle2,0,0]) {
  146. // arm4
  147. rotate([0,-90,0]) arm([0,arm1],arm_width,arm_thickness,joint_bore);
  148. translate([0,0,arm1]) rotate([angle2-angle1,0,0]) rotate([0,0,0]) {
  149. arm5();
  150. translate([-stepper_offset-arm_offset,arm2+25]) rotate([0,90,0]) marker("red");
  151. translate([0,50,0]){
  152. arm6();
  153. }
  154. }
  155. }
  156. }
  157. }
  158. }
  159. // electronics
  160. translate([40,0,-60]) rotate([-0,-90,0]){
  161. color("olive") translate([-12,-2,5]) cube([40,61,1]);
  162. translate([20,5,0])
  163. rotate([0,0,90]) {
  164. stepper_controller();
  165. translate([30.4,0,0]) stepper_controller();
  166. }
  167. }
  168. //carriage
  169. translate([stepper_offset,0,0]){
  170. rotate([0,90,0]) {
  171. stepper_103H5205_bracket();
  172. translate([0,stepper_spaceing,0]) stepper_103H5205_bracket();
  173. }
  174. translate([-53,-25.5,-25.5])cube([40,98,4]);
  175. }