+// A simple adjustable diffuser for the LED flashlights.
+//
+// Designed by Jan "Yenya" Kasprzak <kas at yenya.net>.
+// Distributable under the terms of the Artistic License.
+//
+// Tested with ZHISHUNJIA ZSJ-T29 LED flashlight (dx.com SKU #317226).
+// NOTE: I can't really recommend this particular flashlight, it is
+// well below the specs (600/300/150 mA instead of stated 2.4 A).
+//
+// For any other flashlight, adjust the parameters below:
+
+// the true _diameter_ of the flashlight + some space around
+ring_d = 34.3 + 1.0;
+
+// the diaphragm thickness, set so that it is printed with two print layers
+diaphragm = 0.5;
+
+// outer wall thickness - preferably the integer multiple
+// of the print trace width
+wall = 1.5;
+
+// height of the center of clip beams + some space below + diaphragm thickness
+clip_h = 7.3 + 0.5 + diaphragm;
+
+// the clips protrude this much to the inner cylindrical hole
+// the bigger value means more stiff fit
+clip_w = 1.2;
+
+clip_angle = 120; // at least 90 degrees; bigger is easier to put on and off,
+ // smaller is more stiff, but harder to remove
+
+n_clips = 3; // number of clips; odd numbers prefered
+
+// the height of the clip is computed so that there is wall/2-wide flat
+// on top of the clip
+clip_top = clip_h + (clip_w+wall/2)*tan(clip_angle/2);
+
+// the overall height:
+// ring_h = clip_top; // cylindrical shape without the clips protruding on the top
+ring_h = clip_h + wall; // clips protruding on the top
+
+infty = 100;
+eps = 0.01;
+
+module diffuser() {
+ difference() {
+ // outer cylinder
+ cylinder(r = ring_d/2 + wall, h = ring_h);
+ // inner cylinder hole + diaphragm
+ translate([0, 0, diaphragm])
+ cylinder(r = ring_d/2, h = ring_h);
+ translate([0, 0, ring_h + eps - wall])
+ cylinder(r1 = ring_d/2, r2 = ring_d/2 + wall/2, h = wall);
+ }
+ // clip beams
+ for (angle = [0:360/n_clips:360-eps]) intersection() {
+ rotate([0,0,angle])
+ translate([ring_d/2-clip_w, -infty/2, clip_h]) {
+ rotate([0, 90-clip_angle/2, 0])
+ cube(infty);
+ rotate([0, clip_angle/2, 0])
+ cube(infty);
+ }
+ cylinder(r = ring_d/2 + wall, h = clip_top);
+ }
+}
+
+diffuser();
+