Skip to content

Instantly share code, notes, and snippets.

@ednisley
Last active January 10, 2016 19:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ednisley/495b45d0a88618b57b8a to your computer and use it in GitHub Desktop.
Save ednisley/495b45d0a88618b57b8a to your computer and use it in GitHub Desktop.
OpenSCAD Source Code: Chip-on-board LED Retrofit for a Cheap Desk Lamp
// Chip-on-board LED light heatsink mount for desk lamp
// Ed Nisley KE4ZNU December 2015
Layout = "Show"; // Show Build
//- Extrusion parameters must match reality!
ThreadThick = 0.25;
ThreadWidth = 0.40;
HoleWindage = 0.2;
Protrusion = 0.1; // make holes end cleanly
inch = 25.4;
function IntegerMultiple(Size,Unit) = Unit * ceil(Size / Unit);
//----------------------
// Dimensions
ID = 0; // for round things
OD = 1;
LENGTH = 2;
Gooseneck = [3.0,5.0,15.0]; // anchor for end of gooseneck
COB = [25.0,23.0,2.5]; // Chip-on-board LED module
Heatsink = [35.5,31.5,4.0]; // height is solid base bottom
HSWire = [23.0,28.0,53.3]; // anchor width OC, width OAL, length OC
HSWireDia = 1.4;
HSLip = 1.0; // width of lip under heatsink
BaseMargin = 2*2*ThreadWidth;
BaseRadius = Gooseneck[OD]; // 2 x gooseneck = enough anchor, sets slab thickness
BaseSides = 2*4;
Base = [(Gooseneck[LENGTH] + Gooseneck[OD] + Heatsink[0] + 2*BaseRadius + BaseMargin),
(Heatsink[1] + 2*BaseRadius + 2*BaseMargin),
2*BaseRadius];
//----------------------
// Useful routines
module PolyCyl(Dia,Height,ForceSides=0) { // based on nophead's polyholes
Sides = (ForceSides != 0) ? ForceSides : (ceil(Dia) + 2);
FixDia = Dia / cos(180/Sides);
cylinder(r=(FixDia + HoleWindage)/2,
h=Height,
$fn=Sides);
}
//-- Lamp heatsink mount
module Lamp() {
difference() {
translate([(Base[0]/2 - BaseRadius - Gooseneck[LENGTH]),0,0])
hull()
for (i=[-1,1], j=[-1,1])
translate([i*(Base[0]/2 - BaseRadius),j*(Base[1]/2 - BaseRadius),Base[2]/2])
sphere(r=BaseRadius/cos(180/BaseSides),$fn=BaseSides);
translate([(Heatsink[0]/2 + Gooseneck[OD]),0,Heatsink[2] + COB[2]]) // main heatsink recess
scale([1,1,2])
cube((Heatsink + [HoleWindage,HoleWindage,0.0]),center=true);
translate([(Heatsink[0]/2 + Gooseneck[OD]),0,Heatsink[2] - Protrusion]) // lower lip to shade lamp module
scale([1,1,2])
cube(Heatsink - [2*HSLip,2*HSLip,0],center=true);
translate([0,0,Base[2]/2]) // goooseneck insertion
rotate([0,-90,0]) rotate(180/8)
PolyCyl(Gooseneck[OD],Base[0],8);
translate([0,0,Base[2]/2 + Gooseneck[ID]/2]) // wire exit
rotate([180,0,0])
PolyCyl(Gooseneck[ID],Base[2],6);
translate([Gooseneck[OD],0,(COB[2] - Protrusion)/2]) // wire slot
rotate([180,0,0])
cube([2*Gooseneck[OD],Gooseneck[ID],(COB[2] + Protrusion)],center=true);
}
}
//----------------------
// Build it
if (Layout == "Show") {
Lamp();
}
if (Layout == "Build") {
}
@ednisley
Copy link
Author

More detail on my blog at http://wp.me/poZKh-5vy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment