]> www.fi.muni.cz Git - openparking.git/commitdiff
OpenSCAD source files.
authorJan "Yenya" Kasprzak <kas@fi.muni.cz>
Wed, 20 May 2015 19:20:59 +0000 (21:20 +0200)
committerJan "Yenya" Kasprzak <kas@fi.muni.cz>
Wed, 20 May 2015 19:20:59 +0000 (21:20 +0200)
hc-sr04.scad [new file with mode: 0644]
semaphore.scad [new file with mode: 0644]

diff --git a/hc-sr04.scad b/hc-sr04.scad
new file mode 100644 (file)
index 0000000..d391355
--- /dev/null
@@ -0,0 +1,106 @@
+eps = 0.01;
+infty = 100;
+
+wall = 1.5;
+
+cyl_r = 8 + 0.5;
+cyl_x = 26.6 / 2;
+cyl_h = 8; // above pcb, max 13.8;
+
+pcb_x = 45.6 + 0.7;
+pcb_y = 20.2 + 0.5;
+xtal_h = 5;
+pcb_supp = 3; // side support thickness
+pcb_h = 8; // 1.2 + space for connector etc
+pcb_thick = 2.5;
+
+cyl_base = pcb_x/2 + wall - cyl_x;
+
+conn_x = 10 + 0.5;
+conn_y = 15;
+
+cable_w = 7;
+cable_h = 4;
+
+screw_head = 7.5;
+screw_d = 4;
+screw_base = 2*wall;
+
+clip_r = 1;
+clip_h = 8;
+
+module sensor() {
+       hull() {
+               // space above pcb
+               translate([-pcb_x/2, -pcb_y/2, -eps])
+                       cube([pcb_x, pcb_y, pcb_h-pcb_thick+eps]);
+               // connector
+               translate([-conn_x/2, pcb_y/2-eps, -eps])
+                       cube([conn_x, conn_y+eps, pcb_h-pcb_thick+eps]);
+       }
+       // cable protrusion
+       translate([-cable_w/2, pcb_y/2+conn_y-eps, -eps])
+               cube([cable_w, 2*wall + eps, cable_h]);
+
+       // cylinders
+       for (x = [-1, 1]) translate([cyl_x*x, 0, pcb_h - eps])
+               cylinder(r = cyl_r, h = cyl_h + 2+wall + eps);
+       // pcb
+       translate([-pcb_x/2, -pcb_y/2, pcb_h-pcb_thick-eps])
+               cube([pcb_x, pcb_y, pcb_thick+eps]);
+       // space below the pcb (xtal, etc)
+       translate([-pcb_x/2+pcb_supp, -pcb_y/2, pcb_h-pcb_thick - eps])
+               cube([pcb_x - 2*pcb_supp, pcb_y, xtal_h+pcb_thick+eps]);
+};
+module case_body() {
+       hull() {
+               // pcb
+               translate([-pcb_x/2-wall, -pcb_y/2-wall, 0])
+                       cube([pcb_x+2*wall, pcb_y+2*wall, pcb_h+wall]);
+
+               // cylinders
+               for (x = [-1, 1]) translate([cyl_x*x, 0, pcb_h + cyl_h])
+                       cylinder(r = cyl_base, h = wall);
+
+               translate([0, 8, pcb_h + cyl_h])
+                       cylinder(r = cyl_base, h = wall);
+
+               // connector
+               translate([-conn_x/2-wall, pcb_y/2-wall, 0])
+                       cube([conn_x+2*wall, conn_y+2*wall, pcb_h-pcb_thick+wall]);
+               // screw mounts
+               for (x = [1, -1]) scale([x, 1, 1])
+                       translate([pcb_x/2+wall, -screw_head/2-wall, 0])
+                               cube([screw_head, screw_head+2*wall, screw_base]);
+       }
+}
+
+module case() {
+       difference() {
+               case_body();
+               difference() {
+                       sensor();
+                       // pcb clip
+                       translate([-clip_h/2, -pcb_y/2, pcb_h-pcb_thick-clip_r/2])
+                       rotate([0, 90, 0])
+                       cylinder(r=clip_r, h = clip_h, $fn = 4);
+               }
+               // mount holes
+               for (x = [-1, 1]) scale([x, 1, 1]) {
+                       translate([pcb_x/2+wall, -screw_head/2, screw_base])
+                               cube([screw_head+eps, screw_head, infty]);
+                       // screw hole
+                       translate([pcb_x/2+wall+screw_head/2-screw_d/2, -screw_head/2, -eps])
+                               cube([screw_d, screw_head, infty]);
+               }
+               // text
+               translate([0, 3.5, pcb_h + cyl_h + eps])
+                       rotate([0, 0, 90])
+                       linear_extrude(height=wall)
+                       text("CVT FI", font="DejaVu Sans:style=Bold", size=5,
+                               halign="center", valign="center");
+       }
+}
+
+rotate([180, 0, 0]) // rotate it for easier print
+       case();
diff --git a/semaphore.scad b/semaphore.scad
new file mode 100644 (file)
index 0000000..22719e4
--- /dev/null
@@ -0,0 +1,86 @@
+eps = 0.01;
+infty = 100;
+
+wall = 1.5;
+
+led_d = 10 + 0.5;
+led_angle = 10;
+led_depth = 4;
+led_x = led_d/2+0.75;
+
+body_x = led_d + 2*led_x + 15;
+body_d = 14;
+top_off = body_d*tan(led_angle);
+body_y = led_d + 2*top_off + 5*wall;
+base_w = led_d + 4*wall;
+
+screw_d = 3.8;
+screw_head = 8;
+// screw_y = led_d/2+screw_head/2+wall;
+screw_x = body_x/2 +wall + screw_head/2;
+screw_wall = 2.5;
+
+cable_w = 7;
+cable_h = screw_wall;
+
+module body() {
+       hull() {
+               for (i = [-1, 1]) translate([i*led_x, 0, 0])
+                       cylinder(r = base_w/2, h = eps);
+       //      translate([-led_x-led_d/2-wall, -led_d/2-wall, 0])
+       //              cube([2*led_x + led_d + 2*wall, led_d+2*wall, eps]);
+               translate([-body_x/2, -body_y/2, body_d-screw_wall])
+                       cube([body_x, body_y, screw_wall]);
+               for (i = [-1, 1]) scale([i, 1, 1]) {
+                       translate([screw_x-screw_head/2, -screw_head/2-wall, body_d-screw_wall])
+                               cube([screw_head, screw_head+2*wall, screw_wall]);
+                       translate([screw_x-screw_head/2, -screw_head/2-wall, 0])
+                               cube([screw_head/2, screw_head+2*wall, eps]);
+               }
+       }
+};
+       
+
+module main_hole() {
+       hull() {
+               for (i = [-1, 1])
+                       rotate([led_angle, 0, 0]) {
+                               translate([i*led_x, 0, led_depth])
+                                       cylinder(r = led_d/2+wall/2, h = eps);
+                       }
+               translate([-body_x/2+wall, -body_y/2+wall, body_d-screw_wall])
+                       cube([body_x-2*wall, body_y-2*wall, screw_wall+eps]);
+       }
+       for (i = [-1, 1])
+               rotate([led_angle, 0, 0])
+                       translate([i*led_x, 0, led_depth])
+                               cylinder(r = led_d/2+wall/2, h = infty);
+}
+
+difference() {
+       body();
+       // LED holes
+       for (i = [-1, 1])
+               rotate([led_angle, 0, 0])
+                       translate([i*led_x, 0, -infty/2])
+                               cylinder(r = led_d/2, h = infty);
+       // main hole
+       difference() {
+               main_hole();
+//             translate([-screw_head/2-wall, screw_y-screw_head/2-wall, 0])
+//                     cube([screw_head+2*wall, screw_head+2*wall, infty]);
+       };
+       for (i = [-1, 1]) scale([i, 1, 1]) {
+               // screw head hole
+               translate([screw_x-screw_head/2, -screw_head/2, -eps])
+                       cube([screw_head+wall, screw_head, body_d-screw_wall]);
+               // screw hole
+               translate([screw_x-screw_d/2, -screw_head/2, -eps])
+                       cube([screw_d, screw_head, infty]);
+       }
+       // cable hole
+       translate([-led_x, 0, 0])
+               rotate([0, 0, 30])
+               translate([-infty, -cable_w/2, body_d-cable_h])
+                       cube([infty, cable_w, cable_h+eps]);
+}