]> www.fi.muni.cz Git - things.git/blob - diffuser-adjustable.scad
switch holder.scad
[things.git] / diffuser-adjustable.scad
1 // A simple adjustable diffuser for the LED flashlights.
2 //
3 // Designed by Jan "Yenya" Kasprzak <kas at yenya.net>.
4 // Distributable under the terms of the Artistic License.
5 //
6 // Tested with ZHISHUNJIA ZSJ-T29 LED flashlight (dx.com SKU #317226).
7 // NOTE: I can't really recommend this particular flashlight, it is
8 // well below the specs (600/300/150 mA instead of stated 2.4 A).
9 //
10 // For any other flashlight, adjust the parameters below:
11
12 // the true _diameter_ of the flashlight + some space around
13 // ring_d = 34.3 + 1.0; // zsj-t29
14 ring_d = 44 + 0.5; // lzz-186
15
16 // the diaphragm thickness, set so that it is printed with two print layers
17 diaphragm = 0.4;
18
19 // outer wall thickness - preferably the integer multiple
20 // of the print trace width
21 wall = 1.0;
22
23 // height of the center of clip beams + some space below + diaphragm thickness
24 // clip_h = 7.3 + 0.5 + diaphragm; // zsj-t29
25 clip_h = 16 + 0.5 + diaphragm; // zsj-t29
26
27 // the clips protrude this much to the inner cylindrical hole
28 // the bigger value means more stiff fit
29 clip_w = 1.2;
30
31 clip_angle = 90; // at least 90 degrees; bigger is easier to put on and off,
32         // smaller is more stiff, but harder to remove
33
34 n_clips = 3; // number of clips; odd numbers prefered
35
36 // the height of the clip is computed so that there is wall/2-wide flat
37 // on top of the clip
38 clip_top = clip_h + (clip_w+wall/2)*tan(clip_angle/2);
39
40 // if the lens protrudes below the outer ring, it is better that
41 // the diffuser sits on the outer ring. So we can add an additional
42 // support ring
43 support_h = 3;
44 support_w = 3;
45
46 // the overall height:
47 ring_h = clip_top; // cylindrical shape without the clips protruding on the top
48 // ring_h = clip_h + wall; // clips protruding on the top
49
50 infty = 100;
51 eps = 0.01;
52
53 module diffuser() {
54         difference() {
55                 $fn = 256;
56                 // outer cylinder
57                 cylinder(r = ring_d/2 + wall, h = ring_h);
58                 // inner cylinder hole
59                 translate([0, 0, diaphragm + support_h])
60                         cylinder(r = ring_d/2, h = ring_h - support_h);
61                 // support ring
62                 translate([0, 0, diaphragm])
63                         cylinder(r = ring_d/2 - support_w, h = support_h + eps);
64                 translate([0, 0, ring_h + eps - wall])
65                         cylinder(r1 = ring_d/2, r2 = ring_d/2 + wall/2, h = wall);
66         }
67         // clip beams
68         for (angle = [0:360/n_clips:360-eps]) intersection() {
69                 rotate([0,0,angle])
70                         translate([ring_d/2-clip_w, -infty/2, clip_h]) {
71                                 rotate([0, 90-clip_angle/2, 0])
72                                         cube(infty);
73                                 rotate([0, clip_angle/2, 0])
74                                         cube(infty);
75                         }
76                 cylinder(r = ring_d/2 + wall, h = clip_top, $fn = 256);
77         }
78 }
79
80 diffuser();
81