summaryrefslogtreecommitdiff
path: root/led-light.scad
blob: e64140142976aaab60d5ee1c1c5cddb02d2c9239 (plain)
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
/*
 * LED light - 2k lumen luminaire designed around Cree XLamp 17 W modules
 */

$fn = 50;

module xlamp(bs, led) {
    translate([-bs/2, -bs/2, 0])
        cube([bs, bs, 1]);

    translate([0, 0, 1]) {
        color([1, 0.9, 0])
            cylinder(d=led-1, h=0.4);

        cylinder(d=led, h=0.3);
    }
}

module xlamp_clamp() {
    diam = 44;
    height = 3.4;
    difference() {
        /* main body */
        cylinder(d=diam, h=height);

        union() {
            hole_diam = 3;
            hole_spac = 35;
            /* mounting holes */
            translate([-hole_spac / 2, 0, -1]) cylinder(d=hole_diam, h=height+2);
            translate([ hole_spac / 2, 0, -1]) cylinder(d=hole_diam, h=height+2);

            /* main bore for LED */
            translate([0, 0, -1]) cylinder(d=16, h=height+2);

            /* bore taper */
            translate([0, 0, pcb_dz]) cylinder(d1=16, d2=21, h=height - pcb_dz + 0.01);

            /* retaining well for LED board
               FIXME rotation not correct*/
            pcb_dz = 1;
            pcb_dx = 18;
            pcb_dy = 18;
            rotate([0, 0, -26]) translate([-pcb_dx / 2, -pcb_dy / 2, -1]) cube([pcb_dx, pcb_dy, pcb_dz + 1]);
        }
    }
}

module diffuser(d, h, standoff_h, diff_col, bolt_col, standoff_col) {
    bolt_diam = 5;
    bolt_h = 2;
    bolt_from_edge = 4;

    module bolthead(con) {
        translate([con, 0, 0])
            scale([bolt_diam, bolt_diam, bolt_h])
                sphere(d=1);
    }

    module standoff(d, h, con) {
         translate([con, 0, 0])
            cylinder(d=d, h=h);
    }

    /* diffuser hardware (standoffs, bolts) */
    for (theta = [0 : 120 : 360]) {
        rotate([0, 0, theta]) {
            con = d / 2 - bolt_from_edge;
            color(bolt_col)
                translate([0, 0, standoff_h])
                    bolthead(con=con);

            color(standoff_col)
                standoff(d=bolt_diam, h=standoff_h, con=con);
        }
    }

    /* Diffuser plate. Needs to come last for correct alpha */
    color(diff_col) {
        translate([0, 0, standoff_h - h]) {
            cylinder(d=d, h=h);
        }
    }
}

module outer_case(di, h, wt) {
    difference() {
        cylinder(d=di+2*wt, h=h);
        translate([0, 0, -1])
            cylinder(d=di, h=h+2);
    }
}

module heatsink_style_pins(d, h, bt) {
    con_factor = 7;
    count_factor = 7;

    module pin(d, h, con) {
        translate([con, 0, 0])
            cylinder(d=d, h=h);
    }

    module pins_ring(d, h, n) {
        count = n * count_factor;
        con = n * con_factor;
        deg = 360/count;
        for (theta = [0 : deg : 360]) {
        rotate([0, 0, theta])
            pin(d=d, h=h, con=con);
        }
    }

    cylinder(d=d, h=bt);
    translate([0, 0, bt]) {
        pd = 2;
        ph = h - bt;
        rows = (d / 2 - pd) / con_factor;
        for (i = [0 : rows]) {
            pins_ring(pd, ph, i);
        }
    }
}

/* entire luminaire */
{
    color([0.2, 0.2, 0.2])
        outer_case(di=100, h=130, wt=3);

    /* fan */
    fan_h = 20;
    #cylinder(d=90, h=fan_h);

    /* FIXME circuit board, controls */

    /* heatsink and gear mounted to it */
    heatsink_h = 50;
    translate([0, 0, heatsink_h + fan_h]) {
        mirror([0, 0, 1]) {
            /* heatsink */
            color([0.2, 0.2, 0.2])
                heatsink_style_pins(d=90, h=heatsink_h, bt=10);
        }

        /* LED plus clamp */
        {
            rotate([0, 0, -26])
                xlamp(bs=18, led=16);

            color([0.9, 0.9, 0.9])
                xlamp_clamp();
        }

        /* diffuser */
        diffuser(d=90, h=3, standoff_h=50,
            diff_col=[0.8, 0.8, 0.8, 0.7], /* temporarily set opacity down */
            bolt_col=[0.6, 0.6, 0.6],
            standoff_col=[0.6, 0.6, 0.3]);
    }
}