My self-made 3D-printable designs, mainly in OpenSCAD
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.

xiaomi-yi.scad 5.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. /*
  2. * Created by:
  3. * Thomas Buck <xythobuz@xythobuz.de> in May 2016
  4. *
  5. * Licensed under the
  6. * Creative Commons - Attribution - Share Alike license.
  7. */
  8. // -----------------------------------------------------------
  9. cam_width = 61; // 60.5
  10. cam_depth = 22; // 21.3
  11. cam_height = 43; // 42.1
  12. button_size = 12;
  13. button_dist = 14;
  14. mic_hole = 2.5;
  15. mic_hole_dist = 17.8;
  16. mic_hole_2_width = 2;
  17. mic_hole_2_height = 8;
  18. mic_hole_2_dist = 4.5;
  19. bottom_hole = 8.5;
  20. bottom_hole_dist = 17.2;
  21. light_hole = 3;
  22. light_hole_dist_x = 9;
  23. light_hole_dist_y = 5.5;
  24. wifi_hole = 6.4;
  25. wifi_hole_dist = 17.5;
  26. wifi_hole_2 = 3;
  27. wifi_hole_2_dist = 6;
  28. mount_width = 3; // 3.1
  29. mount_gap = 3.2; // 3.1
  30. mount_depth = 16.4; // 16.4
  31. mount_height = 16.2; // 16.1
  32. mount_hole = 5.2; // 5
  33. mount_hole_dist = 7.8; // 7.7
  34. mount_offset = -7; // -7
  35. wall_size = 1.8;
  36. lip_height = 1;
  37. lip_width = 1.4;
  38. print_support_size = 10;
  39. print_support_height = 0.4;
  40. $fn = 20;
  41. // -----------------------------------------------------------
  42. module print_support() {
  43. difference() {
  44. cylinder(d = print_support_size, h = print_support_height);
  45. translate([0, 0, -1])
  46. cube([print_support_size / 2, print_support_size / 2, print_support_height + 2]);
  47. }
  48. }
  49. module half_cylinder(d, h) {
  50. rotate([0, 0, 180])
  51. difference() {
  52. cylinder(d = d, h = h);
  53. translate([-(d / 2), 0, -1])
  54. cube([d, d / 2, h + 2]);
  55. }
  56. }
  57. module frame() {
  58. // left wall
  59. translate([0, wall_size, 0])
  60. cube([wall_size, cam_height, cam_depth]);
  61. // right wall
  62. translate([wall_size + cam_width, wall_size, 0])
  63. cube([wall_size, cam_height, cam_depth]);
  64. // bottom wall
  65. cube([cam_width + (2 * wall_size), wall_size, cam_depth]);
  66. // top wall
  67. translate([0, wall_size + cam_height, 0])
  68. cube([cam_width + (2 * wall_size), wall_size, cam_depth]);
  69. }
  70. module frameWithButton() {
  71. difference() {
  72. frame();
  73. // button
  74. translate([wall_size + button_dist, (2 * wall_size) + cam_height + 1, cam_depth / 2])
  75. rotate([90, 0, 0])
  76. cylinder(d = button_size, h = wall_size + 2);
  77. // mic hole
  78. translate([wall_size + cam_width - mic_hole_dist, (2 * wall_size) + cam_height + 1, cam_depth / 2])
  79. rotate([90, 0, 0])
  80. cylinder(d = mic_hole, h = wall_size + 2);
  81. // mic slit
  82. translate([wall_size + cam_width - mic_hole_2_dist, -1, (cam_depth - mic_hole_2_height) / 2])
  83. cube([mic_hole_2_width, wall_size + 2, mic_hole_2_height]);
  84. // bottom hole
  85. translate([wall_size + cam_width - bottom_hole_dist, wall_size + 1, cam_depth / 2])
  86. rotate([90, 0, 0])
  87. cylinder(d = bottom_hole, h = wall_size + 2);
  88. // light hole
  89. translate([wall_size + light_hole_dist_x, wall_size + 1, cam_depth - light_hole_dist_y])
  90. rotate([90, 0, 0])
  91. cylinder(d = light_hole, h = wall_size + 2);
  92. // wifi hole
  93. translate([wall_size + cam_width - 1, wall_size + wifi_hole_dist, cam_depth / 2])
  94. rotate([0, 90, 0])
  95. cylinder(d = wifi_hole, h = wall_size + 2);
  96. // wifi light hole
  97. translate([wall_size + cam_width - 1, wall_size + wifi_hole_dist + wifi_hole_2_dist, cam_depth / 2])
  98. rotate([0, 90, 0])
  99. cylinder(d = wifi_hole_2, h = wall_size + 2);
  100. }
  101. }
  102. module lip() {
  103. // left lip
  104. translate([0, wall_size, 0])
  105. cube([wall_size + lip_width, cam_height, lip_height]);
  106. // right lip
  107. translate([wall_size + cam_width - lip_width, wall_size, 0])
  108. cube([wall_size + lip_width, cam_height, lip_height]);
  109. // bottom lip
  110. cube([cam_width + (2 * wall_size), wall_size + lip_width, lip_height]);
  111. // top lip
  112. translate([0, wall_size + cam_height - lip_width, 0])
  113. cube([cam_width + (2 * wall_size), wall_size + lip_width, lip_height]);
  114. }
  115. module frameLips() {
  116. translate([0, 0, lip_height])
  117. frameWithButton();
  118. lip();
  119. translate([0, 0, cam_depth + lip_height])
  120. lip();
  121. print_support();
  122. translate([cam_width + (2 * wall_size), 0, 0])
  123. rotate([0, 0, 90])
  124. print_support();
  125. translate([cam_width + (2 * wall_size), cam_height + (2 * wall_size), 0])
  126. rotate([0, 0, 180])
  127. print_support();
  128. translate([0, cam_height + (2 * wall_size), 0])
  129. rotate([0, 0, 270])
  130. print_support();
  131. }
  132. module mountArm() {
  133. difference() {
  134. union() {
  135. translate([0, mount_height - (mount_depth / 2), 0])
  136. rotate([0, 90, 0])
  137. half_cylinder(mount_depth, mount_width);
  138. translate([0, -wall_size, -(mount_depth / 2)])
  139. cube([mount_width, mount_height - (mount_depth / 2) + wall_size, mount_depth]);
  140. }
  141. translate([-1, mount_height - mount_hole_dist, 0])
  142. rotate([0, 90, 0])
  143. cylinder(d = mount_hole, h = mount_width + 2);
  144. }
  145. }
  146. module mount() {
  147. mountArm();
  148. translate([mount_width + mount_gap, 0, 0])
  149. mountArm();
  150. }
  151. module cover() {
  152. difference() {
  153. frameLips();
  154. translate([wall_size + ((cam_width - (mount_gap + (2 * mount_width))) / 2) + mount_offset + mount_width, wall_size + cam_height - lip_width - 1, -1])
  155. cube([mount_gap, wall_size + lip_width + 2, cam_depth + (2 * lip_height) + 2]);
  156. }
  157. translate([wall_size + ((cam_width - (mount_gap + (2 * mount_width))) / 2) + mount_offset, (2 * wall_size) + cam_height, lip_height + (cam_depth / 2)])
  158. mount();
  159. translate([wall_size + (cam_width / 2) + mount_offset, wall_size + cam_height, 0])
  160. cylinder(d = print_support_size, h = print_support_height);
  161. }
  162. // -----------------------------------------------------------
  163. translate([print_support_size / 2, print_support_size / 2, 0])
  164. cover();