My self-made 3D-printable designs, mainly in OpenSCAD
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

basetech_bt305_cover.scad 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413
  1. // 0=none, 1=usb, 2=bluetooth
  2. add_optional_module = 2;
  3. face_width = 130;
  4. face_height = 150;
  5. face_wall = 6.0;
  6. border_bottom = 3.55;
  7. border_top = 3.65;
  8. inner_width = 126.65;
  9. inner_height = 148;
  10. inner_depth = 10;
  11. top_wall_height = 15.0;
  12. top_support_height = 12;
  13. top_support_depth = 1.9;
  14. bottom_wall_width = 119.5;
  15. bottom_wall_height = 6.75;
  16. cutout_width = 118.4;
  17. cutout_height = 145;
  18. cutout_bottom = 1.7;
  19. bottom_cut_width = cutout_width + 4;
  20. bottom_cut_height = 3;
  21. bottom_cut_depth = inner_depth;
  22. connector_dist_x = 0;//12;
  23. connector_dist_y = 17;//30;//15;
  24. connector_off_x = 25; //18;
  25. connector_off_y = 58;//65; //105;
  26. connector_dia_outer = 14.0;
  27. connector_len_top = 21.7;
  28. connector_dia_post = 4.3;
  29. connector_len_post = 15.5;
  30. connector_ring_dia = 7.5;
  31. conenctor_ring_tab_width = 2.0;
  32. connector_ring_tab_len = 1.0;
  33. connector_ring_height = 2.7 + 0.3;
  34. screw_a_head_height = 2.0;
  35. screw_a_head_d1 = 6.2;
  36. screw_a_head_d2 = 3.5;
  37. screw_a_off_z = top_wall_height + top_support_height / 2;
  38. screw_a_dist = 22.0 - screw_a_head_d2;
  39. screw_b_head_height = 2.0;
  40. screw_b_head_d1 = 7.5;
  41. screw_b_head_d2 = 5.0;
  42. screw_b_off_z = 9.8 + screw_b_head_d2 / 2;
  43. screw_b_dist = 82.8 - screw_b_head_d2;
  44. open_size_w = 77;//71;
  45. open_size_h = 40;//39;
  46. open_off_x = 46;
  47. open_off_y = 6;
  48. disp_w = 79;
  49. disp_h = 43;
  50. disp_d = 38;
  51. pcb_width = 96;//93;//72;
  52. pcb_length = 72;//93;
  53. pcb_height = 42;
  54. pcb_off_x = 85;
  55. pcb_off_y = 6;
  56. pcb_screw_dist_length = 64;//86;
  57. pcb_screw_dist_width = 86;//64;
  58. pcb_hole_dia = 3.2;
  59. button_width = 10.0;
  60. button_length = 30;
  61. button_post_height = 11.15;
  62. button_post_dia = 7.0;
  63. button_post_hole = 2.4;
  64. button_pcb_width = 42.2;
  65. button_pcb_height = 31.8;
  66. button_pcb_depth = 1.5;
  67. button_pcb_hole_dist_x = 32;
  68. button_pcb_hole_dist_y = 12;
  69. button_off_x = 6.3;
  70. button_off_y = 15;
  71. button_off_top = 14.8 + 14.15 / 2;
  72. nut_width = 20;
  73. nut_height = 17;
  74. nut_depth = 1.0;
  75. nut_gap = 0.5;
  76. nut_holder_width = (inner_width - cutout_width) / 2;
  77. nut_holder_height = 22.75;
  78. nut_holder_depth = 10 + border_bottom + inner_depth;
  79. nut_holder_off_y = 53.4;
  80. bt_width = 20.5;
  81. bt_height = 40.6;
  82. bt_depth = 1.0;
  83. bt_hole_dia = 3.2;
  84. bt_hole_dist_x = 1.4 + bt_hole_dia / 2;
  85. bt_hole_dist_y = 1.7 + bt_hole_dia / 2;
  86. bt_off_x = 8;
  87. bt_off_y = 105;
  88. bt_post_height = 2;
  89. bt_post_dia = 6;
  90. text_depth = 2;
  91. text_type = "RD DPH5005";
  92. text_type_font = "Liberation Sans:style=Bold";
  93. text_type_size = 10;
  94. text_type_off_x = 8;
  95. text_type_off_y = 75;//13;
  96. text_author = "xythobuz 2021";
  97. text_author_font = "Liberation Sans:style=Bold";
  98. text_author_size = 8;
  99. text_author_off_x = 25;
  100. text_author_off_y = 6;
  101. text_max = [ "0-50 Volt", "0-5 Amps", "0-150 Watt" ];
  102. text_max_font = "Liberation Sans:style=Bold";
  103. text_max_size = 10;
  104. text_max_line_space = 3;
  105. text_max_off_x = 15;
  106. text_max_off_y = 97;
  107. $fn = 42;
  108. module screw(type, length = 30) {
  109. if (type == 0) {
  110. translate([0, 0, -0.01])
  111. cylinder(d2 = screw_a_head_d1, d1 = screw_a_head_d2, h = screw_a_head_height);
  112. translate([0, 0, -length])
  113. cylinder(d = screw_a_head_d2, h = length);
  114. } else {
  115. translate([0, 0, -0.01])
  116. cylinder(d2 = screw_b_head_d1, d1 = screw_b_head_d2, h = screw_b_head_height);
  117. translate([0, 0, -length])
  118. cylinder(d = screw_b_head_d2, h = length);
  119. }
  120. }
  121. module text_cutouts() {
  122. translate([face_width - text_type_off_x, face_height - text_type_off_y, text_depth])
  123. rotate([0, 180, 0])
  124. linear_extrude(text_depth + 1)
  125. text(text_type, size = text_type_size, font = text_type_font);
  126. translate([face_width - text_author_off_x, text_author_off_y, text_depth])
  127. rotate([0, 180, 0])
  128. linear_extrude(text_depth + 1)
  129. text(text_author, size = text_author_size, font = text_author_font);
  130. for (i = [0 : len(text_max) - 1])
  131. translate([face_width - text_max_off_x, face_height - text_max_off_y - i * (text_max_size + text_max_line_space), text_depth])
  132. rotate([0, 180, 0])
  133. linear_extrude(text_depth + 1)
  134. text(text_max[i], size = text_max_size, font = text_max_font);
  135. }
  136. module nut_holder(only_cutout = 0) {
  137. difference() {
  138. if (!only_cutout)
  139. color("green")
  140. cube([nut_holder_width, nut_holder_height, nut_holder_depth]);
  141. union() {
  142. translate([(nut_holder_width - nut_depth - 2 * nut_gap) / 2, (nut_holder_height - nut_width - 2 * nut_gap) / 2, nut_holder_depth - nut_height - nut_gap])
  143. cube([nut_depth + 2 * nut_gap, nut_width + 2 * nut_gap, nut_height + nut_gap + 1]);
  144. translate([-1, (nut_holder_height - nut_width / 2) / 2, nut_holder_depth - nut_height])
  145. cube([nut_holder_width / 2 + 1, nut_width / 2, nut_height + 1]);
  146. translate([nut_holder_width / 2, (nut_holder_height - nut_width / 2) / 2, nut_holder_depth - nut_height / 2])
  147. cube([nut_holder_width / 2 + 1, nut_width / 2, nut_height / 2 + 1]);
  148. }
  149. }
  150. %color("red")
  151. if (!only_cutout)
  152. translate([(nut_holder_width - nut_depth) / 2, (nut_holder_height - nut_width) / 2, nut_holder_depth - nut_height])
  153. cube([nut_depth, nut_width, nut_height]);
  154. }
  155. module face_body() {
  156. // base / face plate
  157. cube([face_width, face_height, border_bottom]);
  158. // side supports
  159. translate([(face_width - inner_width) / 2, 0, border_bottom])
  160. cube([inner_width, inner_height, inner_depth]);
  161. // top support wall
  162. translate([0, face_height - border_bottom, 0])
  163. cube([face_width, border_bottom, top_wall_height]);
  164. // second top support wall
  165. translate([(face_width - inner_width) / 2, face_height - border_bottom, top_wall_height])
  166. cube([inner_width, top_support_depth, top_support_height]);
  167. // bottom support wall
  168. translate([(face_width - bottom_wall_width) / 2, 0, inner_depth + border_bottom])
  169. cube([bottom_wall_width, cutout_bottom, bottom_wall_height]);
  170. }
  171. module connector_ring_tab(s) {
  172. difference() {
  173. union() {
  174. cylinder(d = connector_ring_dia + s * 3, h = connector_ring_height + s * 2);
  175. translate([-conenctor_ring_tab_width / 2, 0, 0])
  176. cube([conenctor_ring_tab_width + s, connector_ring_dia / 2 + connector_ring_tab_len + s, connector_ring_height + s * 2]);
  177. }
  178. if (s != 0)
  179. translate([0, 0, -1])
  180. cylinder(d = connector_dia_post, h = connector_ring_height + 2);
  181. }
  182. }
  183. module connector() {
  184. translate([0, 0, -connector_len_post + 0.1])
  185. cylinder(d = connector_dia_post, h = connector_len_post + 0.1);
  186. connector_ring_tab(0);
  187. translate([0, 0, connector_ring_height])
  188. cylinder(d = connector_dia_outer, h = connector_len_top);
  189. }
  190. module pcb_holes(h) {
  191. for (i = [-pcb_screw_dist_length / 2, pcb_screw_dist_length / 2])
  192. for (j = [-pcb_screw_dist_width / 2, pcb_screw_dist_width / 2])
  193. translate([i, j, -1])
  194. cylinder(d = pcb_hole_dia, h = h + 2);
  195. }
  196. module pcb() {
  197. difference() {
  198. cube([pcb_length, pcb_width, pcb_height]);
  199. translate([pcb_length / 2, pcb_width / 2, 0])
  200. pcb_holes(pcb_height);
  201. }
  202. }
  203. module disp() {
  204. cube([open_size_w - 4, open_size_h - 4, disp_d]);
  205. translate([-(disp_w - open_size_w + 4) / 2, -(disp_h - open_size_h + 4) / 2, -2])
  206. cube([disp_w, disp_h, 2]);
  207. }
  208. module button(posts = 1, pcb = 1, switch = 1) {
  209. color("orange")
  210. if (pcb)
  211. translate([0, 0, 0.1])
  212. difference() {
  213. translate([0, -0, 0])
  214. cube([button_pcb_width, button_pcb_height, button_pcb_depth]);
  215. for (i = [1, -1])
  216. translate([button_pcb_width / 2 + i * button_pcb_hole_dist_x / 2, button_pcb_height - button_off_top - i * button_pcb_hole_dist_y / 2, -1])
  217. cylinder(d = button_post_hole + 1, h = button_pcb_depth + 2);
  218. translate([button_pcb_width / 2, button_pcb_height - button_off_top, -1])
  219. cylinder(d = 12, h = button_pcb_depth + 2);
  220. }
  221. color("green")
  222. if (posts)
  223. for (i = [1, -1])
  224. translate([button_pcb_width / 2 + i * button_pcb_hole_dist_x / 2, button_pcb_height - button_off_top - i * button_pcb_hole_dist_y / 2, -button_post_height])
  225. difference() {
  226. cylinder(d = button_post_dia, h = button_post_height);
  227. translate([0, 0, -1])
  228. cylinder(d = button_post_hole, h = button_post_height + 2);
  229. }
  230. color("red")
  231. if (switch)
  232. translate([(button_pcb_width - button_width) / 2, button_pcb_height - button_width / 2 - button_off_top, -button_length])
  233. cube([button_width, button_width, button_length]);
  234. }
  235. module bluetooth_pcb(post, pcb, holes) {
  236. color("blue")
  237. if (pcb)
  238. difference() {
  239. cube([bt_width, bt_height, bt_depth]);
  240. for (i = [bt_hole_dist_x, bt_width - bt_hole_dist_x])
  241. for (j = [bt_hole_dist_y, bt_height - bt_hole_dist_y])
  242. translate([i, j, -1])
  243. cylinder(d = bt_hole_dia, h = bt_depth + 2);
  244. }
  245. color("green")
  246. if (post)
  247. for (i = [bt_hole_dist_x, bt_width - bt_hole_dist_x])
  248. for (j = [bt_hole_dist_y, bt_height - bt_hole_dist_y])
  249. translate([i, j, -bt_post_height])
  250. difference() {
  251. cylinder(d = bt_post_dia, h = bt_post_height);
  252. translate([0, 0, -1])
  253. cylinder(d = bt_hole_dia, h = bt_post_height + 2);
  254. }
  255. if (holes)
  256. for (i = [bt_hole_dist_x, bt_width - bt_hole_dist_x])
  257. for (j = [bt_hole_dist_y, bt_height - bt_hole_dist_y])
  258. translate([i, j, -15])
  259. cylinder(d = bt_hole_dia, h = 21);
  260. }
  261. module face() {
  262. difference() {
  263. color("green")
  264. face_body();
  265. // inner cutout
  266. translate([(face_width - cutout_width) / 2, cutout_bottom, face_wall])
  267. cube([cutout_width, cutout_height, inner_depth + border_bottom + top_support_height]);
  268. translate([(face_width - bottom_cut_width) / 2, cutout_bottom, face_wall])
  269. cube([bottom_cut_width, bottom_cut_height, bottom_cut_depth]);
  270. // holes for power connectors
  271. for (i = [0 : 2])
  272. translate([connector_off_x + ((i == 1) ? connector_dist_x : 0), i * connector_dist_y + connector_off_y, connector_ring_height - 0.01])
  273. rotate([180, 0, 90])
  274. connector();
  275. // top screws
  276. for (i = [0 : 1])
  277. translate([i * screw_a_dist + (face_width - screw_a_dist) / 2, face_height - screw_a_head_height - border_bottom + top_support_depth + 0.1, screw_a_off_z])
  278. rotate([-90, 0, 0])
  279. screw(0);
  280. // bottom screws
  281. for (i = [0 : 1])
  282. translate([i * screw_b_dist + (face_width - screw_b_dist) / 2, screw_b_head_height - 0.1, screw_b_off_z])
  283. rotate([90, 0, 0])
  284. screw(1);
  285. // DPH5005
  286. translate([open_off_x, face_height - open_size_h - open_off_y, -1])
  287. cube([open_size_w, open_size_h, face_wall + 2]);
  288. // nut_holders
  289. translate([(inner_width) / 2 + (face_width - inner_width) / 2, nut_holder_off_y, 0])
  290. for (i = [-1, 1])
  291. scale([i, 1, 1])
  292. translate([(inner_width) / 2 - nut_holder_width, 0, 0])
  293. nut_holder(1);
  294. text_cutouts();
  295. translate([pcb_off_x, pcb_off_y + pcb_width / 2, -1])
  296. pcb_holes(face_wall + 2);
  297. translate([button_off_x, button_off_y, face_wall + button_post_height])
  298. button(0, 0, 1);
  299. // bluetooth
  300. if (add_optional_module == 2)
  301. translate([bt_off_x, bt_off_y, face_wall + bt_post_height])
  302. bluetooth_pcb(0, 0, 1);
  303. }
  304. // nut_holders
  305. translate([(inner_width) / 2 + (face_width - inner_width) / 2, nut_holder_off_y, 0])
  306. for (i = [-1, 1])
  307. scale([i, 1, 1])
  308. translate([(inner_width) / 2 - nut_holder_width, 0, 0])
  309. nut_holder();
  310. // power connectors
  311. for (i = [0 : 2])
  312. translate([connector_off_x + ((i == 1) ? connector_dist_x : 0), i * connector_dist_y + connector_off_y, connector_ring_height - 0.01])
  313. rotate([180, 0, 90]) {
  314. %color("blue")
  315. connector();
  316. color("cyan")
  317. translate([0, 0, -face_wall + 2 * 0.3])
  318. connector_ring_tab(-0.3);
  319. }
  320. // DPH5005
  321. %color("orange")
  322. translate([open_off_x + 2, face_height - open_size_h - open_off_y + 2, 0])
  323. disp();
  324. %color("orange")
  325. translate([-pcb_length / 2 + pcb_off_x, pcb_off_y, face_wall + 2])
  326. pcb();
  327. translate([button_off_x, button_off_y, face_wall + button_post_height]) {
  328. button(1, 0, 0);
  329. %button(0, 1, 1);
  330. }
  331. // bluetooth
  332. if (add_optional_module == 2)
  333. translate([bt_off_x, bt_off_y, face_wall + bt_post_height]) {
  334. bluetooth_pcb(1, 0, 0);
  335. %bluetooth_pcb(0, 1, 0);
  336. }
  337. }
  338. face();