| 1 | /* |
| 2 | Copyright 2016 Daniel Watson |
| 3 | See the end of the file for license conditions. |
| 4 | */ |
| 5 | /* challenge-bot |
| 6 | // GNU AGPLv3 (or later at your option) |
| 7 | // project available here: |
| 8 | // https://challenge-bot.com/ */ |
| 9 | |
| 10 | /* |
| 11 | this holds an hc-sr04 sonar sensor to a 3/16 inch deck. |
| 12 | http://fritzing.org/projects/hc-sr04-project |
| 13 | it can hold the sonar sensor either facing down, or forwards. |
| 14 | when facing down, it can detect if it passes over the edge of a table. |
| 15 | when facing forwards, it can detect and follow something in front |
| 16 | of it. |
| 17 | */ |
| 18 | |
| 19 | $fn = 50; |
| 20 | |
| 21 | sonar_diameter_measured = 15.82; |
| 22 | sonar_diameter_print_fudge = 0.5; |
| 23 | sonar_diameter = sonar_diameter_measured + sonar_diameter_print_fudge; |
| 24 | sonar_radius = sonar_diameter / 2; |
| 25 | |
| 26 | between_sonar_cans = 10.82; |
| 27 | between_sonar_centers = sonar_diameter + between_sonar_cans; |
| 28 | |
| 29 | // the sonar cylinders are placed on the pcb at slightly different positions |
| 30 | // from one sensor to the next, so this allows for that variance. |
| 31 | between_sonar_centers_variation = 2; |
| 32 | |
| 33 | wall_thickness = 3; |
| 34 | |
| 35 | module sonar_sensors_2d(sonar_radius, |
| 36 | between_sonar_centers, |
| 37 | between_sonar_centers_variation) { |
| 38 | hull(){ |
| 39 | circle(sonar_radius); |
| 40 | translate([between_sonar_centers_variation, 0]){ |
| 41 | circle(sonar_radius); } } |
| 42 | translate([between_sonar_centers, 0]) { |
| 43 | circle(sonar_radius); } } |
| 44 | |
| 45 | module sonar_holder_outline_2d(sonar_radius, |
| 46 | between_sonar_centers, |
| 47 | wall_thickness) { |
| 48 | holder_radius = sonar_radius + wall_thickness; |
| 49 | hull() { |
| 50 | circle(holder_radius); |
| 51 | translate([between_sonar_centers, 0]) { |
| 52 | circle(holder_radius); } } } |
| 53 | |
| 54 | module sonar_binder_clip_holder(sonar_radius, |
| 55 | between_sonar_centers, |
| 56 | between_sonar_centers_variation, |
| 57 | wall_thickness) { |
| 58 | difference() { |
| 59 | sonar_holder_outline_2d(sonar_radius, |
| 60 | between_sonar_centers, |
| 61 | wall_thickness); |
| 62 | sonar_sensors_2d(sonar_radius, |
| 63 | between_sonar_centers, |
| 64 | between_sonar_centers_variation); } } |
| 65 | |
| 66 | /* |
| 67 | This file is part of challenge-bot. |
| 68 | |
| 69 | Challenge-bot is free software: you can redistribute it and/or modify |
| 70 | it under the terms of the GNU Affero General Public License as published by |
| 71 | the Free Software Foundation, either version 3 of the License, or |
| 72 | (at your option) any later version. |
| 73 | |
| 74 | GNU Affero Emacs is distributed in the hope that it will be useful, |
| 75 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 76 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 77 | GNU Affero General Public License for more details. |
| 78 | |
| 79 | You should have received a copy of the GNU Affero General Public License |
| 80 | along with challenge-bot. If not, see <http://www.gnu.org/licenses/>. |
| 81 | */ |