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.

187 line
5.4KB

  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.15;
  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. translate([0,0,arm_offset]) arm6a();
  97. translate([0,0,arm_offset]) rotate([0,0,90]) arm6b();
  98. translate([0,0,-arm_offset]) arm6a();
  99. translate([0,30,0]) {
  100. translate([-20+arm_width/2,0,0]) rotate([0,90,0]) cylinder(d=18,h=20);
  101. translate([-5,0,0]) {
  102. rotate([-45,0,0]) cylinder(d=7,h=11);
  103. rotate([-135,0,0]) cylinder(d=7,h=11);
  104. }
  105. }
  106. }
  107. translate([0,30,0]){
  108. translate([-20+arm_width/2-1,0,0])rotate([0,90,0]) cylinder(d=14.9,h=22);
  109. translate([-5,0,0]) {
  110. rotate([-45,0,0]) cylinder(d=set_screw_bore,h=40);
  111. rotate([-135,0,0]) cylinder(d=set_screw_bore,h=40);
  112. }
  113. }
  114. }
  115. }
  116. //!arm6();
  117. translate([stepper_offset,0,0]) {
  118. // stepper on joint C
  119. rotate([-90,0,-90]) stepper_103H5205();
  120. // stepper on joint A
  121. translate([0,stepper_spaceing,0]) rotate([90,0,90]) stepper_103H5205();
  122. translate([arm_offset,0,0]){
  123. //arm0
  124. translate([0,stepper_spaceing,0]) rotate([angle1,0,0]) rotate([0,90,0]) arm0();//([0,-25],arm_width,arm_thickness,5);
  125. //arm1
  126. rotate([angle1,0,0]) rotate([0,-90,0])
  127. difference(){
  128. arm([0,-25,arm1],arm_width,arm_thickness,joint_bore);
  129. cylinder(d=shaft_bore, h= 10, center=true);
  130. }
  131. //arm2
  132. 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);
  133. 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);
  134. //arm3
  135. rotate([angle2,0,0]){
  136. translate([3,0,0]) rotate([-90,0,-90]) arm3(); //([0,25],arm_width,arm_thickness,5);
  137. translate([-3,0,0]) rotate([90,0,-90]) arm3(); //arm([0,25],arm_width,arm_thickness,5);
  138. translate([0,-25,0]) rotate([angle1-angle2,0,0]) {
  139. // arm4
  140. rotate([0,-90,0]) arm([0,arm1],arm_width,arm_thickness,joint_bore);
  141. translate([0,0,arm1]) rotate([angle2-angle1,0,0]) rotate([0,0,0]) {
  142. arm5();
  143. translate([-stepper_offset-arm_offset,arm2+25]) rotate([0,90,0]) marker("red");
  144. translate([0,50,0]){
  145. arm6();
  146. }
  147. }
  148. }
  149. }
  150. }
  151. }
  152. // electronics
  153. translate([40,0,-60]) rotate([-0,-90,0]){
  154. color("olive") translate([-12,-2,5]) cube([40,61,1]);
  155. translate([20,5,0])
  156. rotate([0,0,90]) {
  157. stepper_controller();
  158. translate([30.4,0,0]) stepper_controller();
  159. }
  160. }
  161. //carriage
  162. translate([stepper_offset,0,0])
  163. rotate([0,90,0]) {
  164. stepper_103H5205_bracket();
  165. translate([0,stepper_spaceing,0]) stepper_103H5205_bracket();
  166. }