Difference between revisions of "SolarLamp"
Jump to navigation
Jump to search
(→Parts) |
|||
(16 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | * https://i.ebayimg.com/images/i/370399513553-0-29/s-l140/p.jpg https://www.ebay.de/itm/x/ | + | = Parts = |
+ | * https://i.ebayimg.com/images/i/370399513553-0-29/s-l140/p.jpg https://www.ebay.de/itm/x/370399513553 | ||
* https://i.ebayimg.com/images/i/372958964165-0-1-00000014/s-l140/p.jpg https://www.ebay.de/itm/x/372958964165 | * https://i.ebayimg.com/images/i/372958964165-0-1-00000014/s-l140/p.jpg https://www.ebay.de/itm/x/372958964165 | ||
− | * https://i.ebayimg.com/images/i/371547306653-0-5/s-l140/p.jpg | + | * https://i.ebayimg.com/images/i/371547306653-0-5/s-l140/p.jpg https://www.ebay.de/itm/1x/371547306653 https://www.ebay.de/itm/x/371452179579 |
* https://i.ebayimg.com/images/i/350689689263-0-4/s-l140/p.jpg https://www.ebay.de/itm/x/350689689263 | * https://i.ebayimg.com/images/i/350689689263-0-4/s-l140/p.jpg https://www.ebay.de/itm/x/350689689263 | ||
+ | You also need some decent wire and soldering equipment. | ||
+ | Make sure your wire is well suite for soldering. | ||
+ | The Battery holders also need double checking that they work properly. | ||
+ | |||
+ | = Test = | ||
+ | For testing the parts you might want to first solder them together to check the functionality. | ||
+ | [[File:SolarRegler2020-05-01.JPG|800px]] | ||
+ | [[File:DSC00149.JPG|800px]] | ||
+ | [[File:SolarLampGear1.JPG|800px]][[File:SolarLampGear2.JPG|800px]] | ||
+ | [[File:DSC00153.JPG|400px]][[File:DSC00154.JPG|400px]] | ||
+ | [[File:DSC00155.JPG|400px]] | ||
+ | |||
+ | = Assembly = | ||
+ | [[File:DSC00156.JPG|800px]] | ||
+ | [[File:DSC00158.JPG|800px]] | ||
+ | [[File:DSC00161.JPG|800px]] | ||
+ | [[File:DSC00162.JPG|800px]] | ||
+ | [[File:DSC00164.JPG|800px]] | ||
+ | [[File:DSC00165.JPG|800px]] | ||
+ | [[File:DSC00168.JPG|800px]] | ||
+ | [[File:DSC00169.JPG|800px]] | ||
+ | = 3D Parts = | ||
+ | [[File:SolarLampTop2020-05-01.png|800px]][[File:SolarLampGear2020-05-01.png|800px]] | ||
+ | |||
+ | Just save the following file as "main.jscad" and drag and drop to http://www.openjscad.org or cut and paste the source ... | ||
+ | <source lang='javascript'> | ||
+ | // title : Solar Lamp Top | ||
+ | // author : Wolfgang Fahl | ||
+ | // license : Apache License | ||
+ | // revision : 0.0.4 | ||
+ | // tags : Solar | ||
+ | // file : SolarLampTop/main.jscad | ||
+ | |||
+ | function cap(size, topheight, topthickness) { | ||
+ | outerradius = size / 1.2; | ||
+ | panelhole = 4.5 | ||
+ | toprest = topheight - topthickness | ||
+ | return difference( | ||
+ | cylinder({ | ||
+ | r1: outerradius, | ||
+ | r2: outerradius, | ||
+ | h: topheight, | ||
+ | center: false | ||
+ | }), | ||
+ | cube({ | ||
+ | size: [size, size, topthickness], | ||
+ | center: true | ||
+ | }).translate([0, 0, topthickness / 2]), | ||
+ | cylinder({ | ||
+ | r1: panelhole, | ||
+ | r2: panelhole, | ||
+ | h: toprest, | ||
+ | center: true | ||
+ | }).translate([size / 2 - 10, 0, topheight - toprest / 2]), | ||
+ | cylinder({ | ||
+ | r1: panelhole, | ||
+ | r2: panelhole, | ||
+ | h: toprest, | ||
+ | center: true | ||
+ | }).translate([-size / 2 + 10, 0, topheight - toprest / 2]) | ||
+ | ); | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * create the topcylinder with the given radius and height | ||
+ | * for the number of sides make it extend a bit so that if fits tight | ||
+ | * add 4 connectors on top of the border | ||
+ | */ | ||
+ | function topcylinder(radius, height, sides, border) { | ||
+ | var topparts = []; | ||
+ | topparts.push(difference( | ||
+ | cylinder({ | ||
+ | r1: radius, | ||
+ | r2: radius, | ||
+ | h: height, | ||
+ | center: true | ||
+ | }), | ||
+ | cylinder({ | ||
+ | r1: radius - 1, | ||
+ | r2: radius - 1, | ||
+ | h: height, | ||
+ | center: true | ||
+ | }) | ||
+ | )); | ||
+ | // add the extensions | ||
+ | for (i = 0; i < sides; i++) { | ||
+ | angle = i * 360 / sides; | ||
+ | topparts.push(rotate([0, 0, angle], cube({ | ||
+ | size: [2, 2, height], | ||
+ | center: true | ||
+ | }).translate([radius - 0.1, 0, 0]))); | ||
+ | } | ||
+ | // add the connectors | ||
+ | csides = 4 | ||
+ | cheight = 10 | ||
+ | cwidth = 4.8 | ||
+ | slotheight = 2.5 | ||
+ | for (i = 0; i < csides; i++) { | ||
+ | angle = i * 360 / csides; | ||
+ | topparts.push(rotate([0, 0, angle], union( | ||
+ | cube({ | ||
+ | size: [border * 2, cwidth, slotheight], | ||
+ | center: true | ||
+ | }).translate([border / 2, 0, height / 2 + cheight / 2]), | ||
+ | cube({ | ||
+ | size: [border, cwidth, height + cheight], | ||
+ | center: true | ||
+ | }) | ||
+ | ).translate([radius - border / 2, 0, 0]))); | ||
+ | } | ||
+ | return (union(topparts)); | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * create a generic box with the given | ||
+ | * length, width, heigth (inner values) | ||
+ | * and the given border width (which makes the box border*2 bigger in all directions) | ||
+ | * all values are in mm | ||
+ | */ | ||
+ | function box(length, width, height, border) { | ||
+ | return difference( | ||
+ | cube({ | ||
+ | size: [length + border * 2, width + border * 2, height + border * 2], | ||
+ | center: true | ||
+ | }), | ||
+ | cube({ | ||
+ | size: [length, width, height], | ||
+ | center: true | ||
+ | }).translate([0, 0, border * 2]) | ||
+ | ).translate([0, 0, height / 2]); | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * create a battery holder with ghe given length, height and width | ||
+ | */ | ||
+ | function batteryHolder(len, height, width) { | ||
+ | border = 1.5; | ||
+ | var bparts = []; | ||
+ | bparts.push(cube({ | ||
+ | size: [len + 2 * border, width + 2 * border, height], | ||
+ | center: true | ||
+ | }).translate([0, 0, height / 2])); | ||
+ | bparts.push(box(len, width, width, border).translate([0, 0, height])); | ||
+ | slotWidth = 4; | ||
+ | slotThickness = 1.5; | ||
+ | slotDistance = 1.8; | ||
+ | slotHeight = width - border * 2; | ||
+ | for (fx = -1; fx <= 1; fx += 2) { | ||
+ | for (fy = -1; fy <= 1; fy += 2) { | ||
+ | bparts.push(cube({ | ||
+ | size: [slotThickness, slotWidth, slotHeight], | ||
+ | center: true | ||
+ | }).translate([fx * (slotDistance - len / 2), fy * slotWidth, slotHeight + height])); | ||
+ | } | ||
+ | } | ||
+ | return union(bparts); | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * create a support that follows the 45 degree rule | ||
+ | */ | ||
+ | function halfCubeSupport(distance, border, height, length) { | ||
+ | height = height + border; | ||
+ | cheight = height / 1.414; | ||
+ | var sparts = []; | ||
+ | for (fx = -1; fx <= 1; fx += 2) { | ||
+ | |||
+ | xf = 0.5; | ||
+ | zf = 0.5; | ||
+ | sparts.push(rotate([0, 45, 0], cube({ | ||
+ | size: [cheight * xf, length, cheight * zf], | ||
+ | center: true | ||
+ | })).translate([fx * height / 2, 0, distance-2])); | ||
+ | |||
+ | sparts.push(cube({ | ||
+ | size: [border, length, distance + 2], | ||
+ | center: true | ||
+ | }).translate([fx * height / 2, 0, (distance - height) / 2 + 2])); | ||
+ | } | ||
+ | sparts.push(cube({ | ||
+ | size: [length * 3 / 4, length, height / 3], | ||
+ | center: true | ||
+ | }).translate([0, 0, height / 6 + distance-2])); | ||
+ | |||
+ | return union(sparts); | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * create the socket top where the power led is put | ||
+ | */ | ||
+ | function socketTop(radius, cylheight) { | ||
+ | var tparts = []; | ||
+ | tparts.push(cylinder({ | ||
+ | r1: radius, | ||
+ | r2: radius, | ||
+ | h: cylheight, | ||
+ | center: true | ||
+ | })); | ||
+ | var tparts2 = []; | ||
+ | ssides = 4; | ||
+ | for (j = 1; j <= ssides; j++) { | ||
+ | angle = j * 360 / ssides; | ||
+ | tparts2.push(rotate([0, 0, angle], cube({ | ||
+ | size: [7, 2, 1.5], | ||
+ | center: true | ||
+ | }).translate([0, radius - 2, cylheight / 2]))); | ||
+ | } | ||
+ | wallheight = 7; | ||
+ | wall = 1; | ||
+ | var tholes = []; | ||
+ | tholes.push(cylinder({ | ||
+ | r1: radius - wall, | ||
+ | r2: radius - wall, | ||
+ | h: wallheight, | ||
+ | center: true | ||
+ | }).translate([0, 0, wallheight / 2])); | ||
+ | return union(difference(union(tparts), union(tholes)), tparts2); | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * create a socket of the given height | ||
+ | */ | ||
+ | function socket(height) { | ||
+ | radius = 12.3; | ||
+ | ssides = 4; | ||
+ | hole = 3; | ||
+ | bottom = 10; | ||
+ | distance = 7; | ||
+ | |||
+ | cylheight = height - bottom; | ||
+ | var sparts = []; | ||
+ | sparts.push(rotate([0, 0, 0], socketTop(radius, cylheight)).translate([0, 0, bottom + distance + 3])); | ||
+ | // sparts.push(halfCubeSupport(distance, 2, bottom, radius * 2)); | ||
+ | var holes = []; | ||
+ | holes.push(cylinder({ | ||
+ | r1: hole, | ||
+ | r2: hole, | ||
+ | h: cylheight + bottom + distance, | ||
+ | center: true | ||
+ | })); | ||
+ | |||
+ | return difference(union(sparts), union(holes)).translate([0, 0, bottom / 2]); | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * create the holder for a switch | ||
+ | */ | ||
+ | function switchholder(height) { | ||
+ | var sparts = []; | ||
+ | length = 6; | ||
+ | border = 2; | ||
+ | extra = 2; | ||
+ | width = 12; | ||
+ | sparts.push(box(length, width, height, border)); | ||
+ | for (fy = -1; fy <= 1; fy += 2) { | ||
+ | sparts.push(cube({ | ||
+ | size: [width, extra, height + border * 2], | ||
+ | center: true | ||
+ | }).translate([0, fy * (-(width + border) / 2 - extra), height / 2])); | ||
+ | } | ||
+ | return difference(union(sparts), cube({ | ||
+ | size: [width / 2, width, height + border * 2], | ||
+ | center: true | ||
+ | }).translate([width / 2, 0, height / 2])); | ||
+ | } | ||
+ | |||
+ | function at(list,o,h,dx,dy,dz,rx,ry,rz) { | ||
+ | list.push(rotate([rx,ry,rz],o).translate([dx, dy, dz+h/2])); | ||
+ | } | ||
+ | |||
+ | function cylinderAt(list,h,r,dx,dy,dz,rx,ry,rz) { | ||
+ | c=cylinder({ | ||
+ | h: h, | ||
+ | r:r, | ||
+ | center: true | ||
+ | }); | ||
+ | at(list,c,h,dx,dy,dz,rx,ry,rz) | ||
+ | } | ||
+ | |||
+ | function cubeAt(list,w,l,h,dx,dy,dz,rx,ry,rz) { | ||
+ | c=cube({ | ||
+ | size: [w, l, h], | ||
+ | center: true | ||
+ | }); | ||
+ | at(list,c,h,dx,dy,dz,rx,ry,rz) | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * screwHolder | ||
+ | */ | ||
+ | function screwHolder(dz,plate) { | ||
+ | var parts = []; | ||
+ | var holes = []; | ||
+ | h=6 | ||
+ | ro=2 | ||
+ | ri=0.7 | ||
+ | w=15 | ||
+ | for (x=-1;x<=1;x+=2) { | ||
+ | for (y=-1;y<=1;y+=2) { | ||
+ | if (plate) { | ||
+ | h=2.5 | ||
+ | ri=1 | ||
+ | cubeAt(parts,10,40,h,x*w, 0,0,0,0,0); | ||
+ | cubeAt(parts,40,10,h,0 ,y*w,0,0,0,0); | ||
+ | |||
+ | cylinderAt(holes,h,ri,x*w,y*w,0,0,0,0); | ||
+ | } | ||
+ | else { | ||
+ | cylinderAt(parts,h,ro,x*w,y*w,dz,0,0,0); | ||
+ | cylinderAt(holes,h-1,ri,x*w,y*w,dz+2,0,0,0); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | return difference(union(parts),union(holes)); | ||
+ | } | ||
+ | |||
+ | |||
+ | /** | ||
+ | * create the holder for the printed circuit board | ||
+ | */ | ||
+ | function pcbholder1(border) { | ||
+ | length = 6; | ||
+ | width = 7; | ||
+ | height = 15; | ||
+ | var parts = []; | ||
+ | var holes = []; | ||
+ | parts.push(box(length, width, height, border)); | ||
+ | cubeAt(holes,length,width+2*border,height/2,0,0,height*2/3+border,0,0,0); | ||
+ | return difference(union(parts),union(holes)); | ||
+ | } | ||
+ | |||
+ | function getParameterDefinitions() { | ||
+ | var parameters = [{name: 'top', type: 'checkbox', checked: false, caption: 'Top'} ]; | ||
+ | return parameters; | ||
+ | } | ||
+ | |||
+ | function pcbHolder2() { | ||
+ | var parts = []; | ||
+ | var holes = []; | ||
+ | // create a connector for pcb | ||
+ | dz=17 | ||
+ | dx=18 | ||
+ | dy=0 | ||
+ | cubeAt(parts,15,27,2.5,dx,dy,dz,0,0,0); | ||
+ | for (x=-1;x<=1;x+=2) { | ||
+ | cylinderAt(holes,3,0.6,dx+5.5,dy+10.5*x,dz,0,0,0); | ||
+ | } | ||
+ | return difference(union(parts),union(holes)); | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * create the Solar lamp top | ||
+ | * consisting of | ||
+ | * a cap which holds a 50x50x3 mm Solar panel | ||
+ | * a top cylinder which connnects the cap with the existing stainless steel tube | ||
+ | * a battery holder | ||
+ | * a socket for the power led | ||
+ | * a holder for a switch | ||
+ | * a holder for a printed circuit board | ||
+ | */ | ||
+ | function main(params) { | ||
+ | |||
+ | var parts = []; | ||
+ | var holes = []; | ||
+ | topheight = 7 | ||
+ | height = 25.6 - 7 | ||
+ | if (params.top) { | ||
+ | // create a cap which holds a 50x50x3 mm Solar panel | ||
+ | sq = 51 | ||
+ | |||
+ | topthickness = 5 | ||
+ | parts.push(cap(sq, topheight, topthickness)); | ||
+ | |||
+ | // create a top cylinder which connnects the cap with the existing stainless steel tube | ||
+ | radius = 30 | ||
+ | |||
+ | sides = 12 | ||
+ | border = 1.5 | ||
+ | parts.push(topcylinder(radius, height, sides, border).translate([0, 0, topheight + height / 2])) | ||
+ | parts.push(screwHolder(topheight,false)) | ||
+ | return union(parts) | ||
+ | } else { | ||
+ | // | ||
+ | parts.push(screwHolder(0,true)) | ||
+ | // create a battery holder | ||
+ | batteryHolderLen = 50; | ||
+ | batteryHolderSize = 10.8; | ||
+ | |||
+ | // parts.push(rotate([0, 0, 90], batteryHolder(batteryHolderLen, height, batteryHolderSize)).translate([0, 0, topheight])); | ||
+ | |||
+ | // create a socket for the power led | ||
+ | socketHeight = 20; | ||
+ | parts.push(socket(socketHeight).translate([0, 0, -3])); | ||
+ | cubeAt(holes,5,15,10,-7,8,17,0,0,45); | ||
+ | |||
+ | // create a holder for a switch | ||
+ | // parts.push(switchholder(height).translate([12, 14, topheight])); | ||
+ | |||
+ | // create a holder for a printed circuit board | ||
+ | parts.push(rotate([0,0,90],pcbholder1(1)).translate([7,0, 1])); | ||
+ | parts.push(rotate([0,270,0],pcbHolder2()).translate([29.2,0, -8])); | ||
+ | cylinderAt(holes,2,0.6,3.5,0,6.4+2.3,0,90,0); | ||
+ | //cubeAt(parts,2,40,4,-12.5,0,2,0,0,0); | ||
+ | return difference(union(parts),union(holes)); | ||
+ | } | ||
+ | |||
+ | } | ||
+ | |||
+ | |||
+ | </source> |
Latest revision as of 12:39, 1 May 2020
Parts
- https://www.ebay.de/itm/x/370399513553
- https://www.ebay.de/itm/x/372958964165
- https://www.ebay.de/itm/1x/371547306653 https://www.ebay.de/itm/x/371452179579
- https://www.ebay.de/itm/x/350689689263
You also need some decent wire and soldering equipment. Make sure your wire is well suite for soldering. The Battery holders also need double checking that they work properly.
Test
For testing the parts you might want to first solder them together to check the functionality.
Assembly
3D Parts
Just save the following file as "main.jscad" and drag and drop to http://www.openjscad.org or cut and paste the source ...
// title : Solar Lamp Top
// author : Wolfgang Fahl
// license : Apache License
// revision : 0.0.4
// tags : Solar
// file : SolarLampTop/main.jscad
function cap(size, topheight, topthickness) {
outerradius = size / 1.2;
panelhole = 4.5
toprest = topheight - topthickness
return difference(
cylinder({
r1: outerradius,
r2: outerradius,
h: topheight,
center: false
}),
cube({
size: [size, size, topthickness],
center: true
}).translate([0, 0, topthickness / 2]),
cylinder({
r1: panelhole,
r2: panelhole,
h: toprest,
center: true
}).translate([size / 2 - 10, 0, topheight - toprest / 2]),
cylinder({
r1: panelhole,
r2: panelhole,
h: toprest,
center: true
}).translate([-size / 2 + 10, 0, topheight - toprest / 2])
);
}
/**
* create the topcylinder with the given radius and height
* for the number of sides make it extend a bit so that if fits tight
* add 4 connectors on top of the border
*/
function topcylinder(radius, height, sides, border) {
var topparts = [];
topparts.push(difference(
cylinder({
r1: radius,
r2: radius,
h: height,
center: true
}),
cylinder({
r1: radius - 1,
r2: radius - 1,
h: height,
center: true
})
));
// add the extensions
for (i = 0; i < sides; i++) {
angle = i * 360 / sides;
topparts.push(rotate([0, 0, angle], cube({
size: [2, 2, height],
center: true
}).translate([radius - 0.1, 0, 0])));
}
// add the connectors
csides = 4
cheight = 10
cwidth = 4.8
slotheight = 2.5
for (i = 0; i < csides; i++) {
angle = i * 360 / csides;
topparts.push(rotate([0, 0, angle], union(
cube({
size: [border * 2, cwidth, slotheight],
center: true
}).translate([border / 2, 0, height / 2 + cheight / 2]),
cube({
size: [border, cwidth, height + cheight],
center: true
})
).translate([radius - border / 2, 0, 0])));
}
return (union(topparts));
}
/**
* create a generic box with the given
* length, width, heigth (inner values)
* and the given border width (which makes the box border*2 bigger in all directions)
* all values are in mm
*/
function box(length, width, height, border) {
return difference(
cube({
size: [length + border * 2, width + border * 2, height + border * 2],
center: true
}),
cube({
size: [length, width, height],
center: true
}).translate([0, 0, border * 2])
).translate([0, 0, height / 2]);
}
/**
* create a battery holder with ghe given length, height and width
*/
function batteryHolder(len, height, width) {
border = 1.5;
var bparts = [];
bparts.push(cube({
size: [len + 2 * border, width + 2 * border, height],
center: true
}).translate([0, 0, height / 2]));
bparts.push(box(len, width, width, border).translate([0, 0, height]));
slotWidth = 4;
slotThickness = 1.5;
slotDistance = 1.8;
slotHeight = width - border * 2;
for (fx = -1; fx <= 1; fx += 2) {
for (fy = -1; fy <= 1; fy += 2) {
bparts.push(cube({
size: [slotThickness, slotWidth, slotHeight],
center: true
}).translate([fx * (slotDistance - len / 2), fy * slotWidth, slotHeight + height]));
}
}
return union(bparts);
}
/**
* create a support that follows the 45 degree rule
*/
function halfCubeSupport(distance, border, height, length) {
height = height + border;
cheight = height / 1.414;
var sparts = [];
for (fx = -1; fx <= 1; fx += 2) {
xf = 0.5;
zf = 0.5;
sparts.push(rotate([0, 45, 0], cube({
size: [cheight * xf, length, cheight * zf],
center: true
})).translate([fx * height / 2, 0, distance-2]));
sparts.push(cube({
size: [border, length, distance + 2],
center: true
}).translate([fx * height / 2, 0, (distance - height) / 2 + 2]));
}
sparts.push(cube({
size: [length * 3 / 4, length, height / 3],
center: true
}).translate([0, 0, height / 6 + distance-2]));
return union(sparts);
}
/**
* create the socket top where the power led is put
*/
function socketTop(radius, cylheight) {
var tparts = [];
tparts.push(cylinder({
r1: radius,
r2: radius,
h: cylheight,
center: true
}));
var tparts2 = [];
ssides = 4;
for (j = 1; j <= ssides; j++) {
angle = j * 360 / ssides;
tparts2.push(rotate([0, 0, angle], cube({
size: [7, 2, 1.5],
center: true
}).translate([0, radius - 2, cylheight / 2])));
}
wallheight = 7;
wall = 1;
var tholes = [];
tholes.push(cylinder({
r1: radius - wall,
r2: radius - wall,
h: wallheight,
center: true
}).translate([0, 0, wallheight / 2]));
return union(difference(union(tparts), union(tholes)), tparts2);
}
/**
* create a socket of the given height
*/
function socket(height) {
radius = 12.3;
ssides = 4;
hole = 3;
bottom = 10;
distance = 7;
cylheight = height - bottom;
var sparts = [];
sparts.push(rotate([0, 0, 0], socketTop(radius, cylheight)).translate([0, 0, bottom + distance + 3]));
// sparts.push(halfCubeSupport(distance, 2, bottom, radius * 2));
var holes = [];
holes.push(cylinder({
r1: hole,
r2: hole,
h: cylheight + bottom + distance,
center: true
}));
return difference(union(sparts), union(holes)).translate([0, 0, bottom / 2]);
}
/**
* create the holder for a switch
*/
function switchholder(height) {
var sparts = [];
length = 6;
border = 2;
extra = 2;
width = 12;
sparts.push(box(length, width, height, border));
for (fy = -1; fy <= 1; fy += 2) {
sparts.push(cube({
size: [width, extra, height + border * 2],
center: true
}).translate([0, fy * (-(width + border) / 2 - extra), height / 2]));
}
return difference(union(sparts), cube({
size: [width / 2, width, height + border * 2],
center: true
}).translate([width / 2, 0, height / 2]));
}
function at(list,o,h,dx,dy,dz,rx,ry,rz) {
list.push(rotate([rx,ry,rz],o).translate([dx, dy, dz+h/2]));
}
function cylinderAt(list,h,r,dx,dy,dz,rx,ry,rz) {
c=cylinder({
h: h,
r:r,
center: true
});
at(list,c,h,dx,dy,dz,rx,ry,rz)
}
function cubeAt(list,w,l,h,dx,dy,dz,rx,ry,rz) {
c=cube({
size: [w, l, h],
center: true
});
at(list,c,h,dx,dy,dz,rx,ry,rz)
}
/**
* screwHolder
*/
function screwHolder(dz,plate) {
var parts = [];
var holes = [];
h=6
ro=2
ri=0.7
w=15
for (x=-1;x<=1;x+=2) {
for (y=-1;y<=1;y+=2) {
if (plate) {
h=2.5
ri=1
cubeAt(parts,10,40,h,x*w, 0,0,0,0,0);
cubeAt(parts,40,10,h,0 ,y*w,0,0,0,0);
cylinderAt(holes,h,ri,x*w,y*w,0,0,0,0);
}
else {
cylinderAt(parts,h,ro,x*w,y*w,dz,0,0,0);
cylinderAt(holes,h-1,ri,x*w,y*w,dz+2,0,0,0);
}
}
}
return difference(union(parts),union(holes));
}
/**
* create the holder for the printed circuit board
*/
function pcbholder1(border) {
length = 6;
width = 7;
height = 15;
var parts = [];
var holes = [];
parts.push(box(length, width, height, border));
cubeAt(holes,length,width+2*border,height/2,0,0,height*2/3+border,0,0,0);
return difference(union(parts),union(holes));
}
function getParameterDefinitions() {
var parameters = [{name: 'top', type: 'checkbox', checked: false, caption: 'Top'} ];
return parameters;
}
function pcbHolder2() {
var parts = [];
var holes = [];
// create a connector for pcb
dz=17
dx=18
dy=0
cubeAt(parts,15,27,2.5,dx,dy,dz,0,0,0);
for (x=-1;x<=1;x+=2) {
cylinderAt(holes,3,0.6,dx+5.5,dy+10.5*x,dz,0,0,0);
}
return difference(union(parts),union(holes));
}
/**
* create the Solar lamp top
* consisting of
* a cap which holds a 50x50x3 mm Solar panel
* a top cylinder which connnects the cap with the existing stainless steel tube
* a battery holder
* a socket for the power led
* a holder for a switch
* a holder for a printed circuit board
*/
function main(params) {
var parts = [];
var holes = [];
topheight = 7
height = 25.6 - 7
if (params.top) {
// create a cap which holds a 50x50x3 mm Solar panel
sq = 51
topthickness = 5
parts.push(cap(sq, topheight, topthickness));
// create a top cylinder which connnects the cap with the existing stainless steel tube
radius = 30
sides = 12
border = 1.5
parts.push(topcylinder(radius, height, sides, border).translate([0, 0, topheight + height / 2]))
parts.push(screwHolder(topheight,false))
return union(parts)
} else {
//
parts.push(screwHolder(0,true))
// create a battery holder
batteryHolderLen = 50;
batteryHolderSize = 10.8;
// parts.push(rotate([0, 0, 90], batteryHolder(batteryHolderLen, height, batteryHolderSize)).translate([0, 0, topheight]));
// create a socket for the power led
socketHeight = 20;
parts.push(socket(socketHeight).translate([0, 0, -3]));
cubeAt(holes,5,15,10,-7,8,17,0,0,45);
// create a holder for a switch
// parts.push(switchholder(height).translate([12, 14, topheight]));
// create a holder for a printed circuit board
parts.push(rotate([0,0,90],pcbholder1(1)).translate([7,0, 1]));
parts.push(rotate([0,270,0],pcbHolder2()).translate([29.2,0, -8]));
cylinderAt(holes,2,0.6,3.5,0,6.4+2.3,0,90,0);
//cubeAt(parts,2,40,4,-12.5,0,2,0,0,0);
return difference(union(parts),union(holes));
}
}