-
Notifications
You must be signed in to change notification settings - Fork 3
/
hc-sr04-ultrasonic-sensor_todiff.scad
85 lines (71 loc) · 1.79 KB
/
hc-sr04-ultrasonic-sensor_todiff.scad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
//HC-SR04 Ultrasonic distance sensor module
//Mark Benson
//23/07/2013
//Creative Commons non commercial
module sensorHCSR04()
{
difference()
{
union()
{
color("DARKBLUE")cube([45,20,1.2]);
translate([16/2+1,18/2+1,1.3]) ultrasonicSensor();
translate([16/2+27+1,18/2+1,1.3]) ultrasonicSensor();
color("SILVER")translate([45/2-3.25,20-4,1.3]) xtal();
translate([(45/2)-((2.45*4)/2)+0.6,2,-0.2]) rotate([180,0,0]) headerPin(4);
}
union()
{
color("DARKBLUE") translate([2.5,2.5,-1]) cylinder(r=2/2-jeu, h=3, $fn=50);
color("DARKBLUE") translate([2.5+40,2.5+15,-1]) cylinder(r=2/2-jeu, h=3, $fn=50);
}
}
}
module ultrasonicSensor()
{
union()
{
//Sensor body
color("SILVER")
difference()
{
//Body
translate([0,0,0]) cylinder(r=16/2, h=13.8, $fn=50);
//Hole in body
translate([0,0,0]) cylinder(r=12.5/2, h=14, $fn=50);
}
//Insert to indicate mesh
color("GREY") translate([0,0,0]) cylinder(r=12.5/2, h=13, $fn=50);
}
}
//ultrasonicSensor();
module xtal()
{
//Xtal maximum dimensions for checking model
//color("red")translate([0,0,-1]) cube([11.5,4.65,1]);
//color("red")translate([(11.54-10.3)/2,(4.65-3.8)/2,0]) cube([10.3,3.8,3.56]);
union()
{
//Base
hull()
{
translate([0,0,0]) cylinder(r=4.65/2, h=0.4, $fn=50);
translate([6.5,0,0]) cylinder(r=4.65/2, h=0.4, $fn=50);
}
//Body
hull()
{
translate([0,0,0]) cylinder(r=3.7/2, h=3.56, $fn=50);
translate([6.5,0,0]) cylinder(r=3.7/2, h=3.56, $fn=50);
}
}
}
module headerPin(numberOfPins)
{
for (i = [0:numberOfPins-1])
{
color("GOLD") translate([(i*2.54),0,-2]) cube([0.5,0.5,8]);
color("BLACK") translate([(i*2.54-2.54/2+0.25),-2.54/2+0.25,-2]) cube([2.54+jeu,6,8]);
}
}
//headerPin(4);