2020-01-04 04:01:28 +00:00
|
|
|
/*
|
|
|
|
* title : Sonoff DEV box for lamp post
|
|
|
|
* author : Knut Ahlers
|
2020-01-11 17:06:36 +00:00
|
|
|
* revision : 0.2.6
|
2020-01-04 04:01:28 +00:00
|
|
|
*/
|
2020-01-03 13:40:00 +00:00
|
|
|
|
|
|
|
// All measurements in mm
|
2020-01-04 03:52:25 +00:00
|
|
|
const boardSize = 51 // 51x51mm
|
|
|
|
const boardSupportHeight = 6 // pins to put the board on
|
|
|
|
const boardSupportRadius = 1.25
|
2020-01-11 17:06:36 +00:00
|
|
|
const boardSupportEdgeDist = 3 // mm from the edges to hole center
|
|
|
|
const innerSpace = 10 // free room on the inside from the board not to bend the cables that hard
|
2020-01-04 03:52:25 +00:00
|
|
|
const innerSpaceHeight = 20
|
2020-01-03 18:20:31 +00:00
|
|
|
const lampPostRadius = 7 // 14mm diameter
|
2020-01-03 13:40:00 +00:00
|
|
|
const lampPostSupport = lampPostRadius + 4.5 // adjust for proper grip
|
2020-01-04 03:52:25 +00:00
|
|
|
const powerInletHeight = 8 // Size of power adapter
|
|
|
|
const powerInletWidth = 14 // Size of power adapter
|
2020-01-11 17:06:36 +00:00
|
|
|
const powerInletPosY = boardSize / -2 + 11 + powerInletWidth / 2
|
2020-01-03 17:16:53 +00:00
|
|
|
const ventSize = 1
|
|
|
|
const ventWidth = (boardSize + innerSpace - 5 * ventSize) / 2
|
2020-01-11 17:06:36 +00:00
|
|
|
const wall = 1 // wall thickness
|
2020-01-03 13:40:00 +00:00
|
|
|
|
2020-01-03 17:16:53 +00:00
|
|
|
function addVents(obj) {
|
|
|
|
const ventRow = difference(
|
|
|
|
union(
|
|
|
|
cube({ size: [
|
|
|
|
boardSize + innerSpace + wall + 10,
|
|
|
|
ventWidth * 2 + ventSize,
|
|
|
|
ventSize,
|
|
|
|
], center: true }),
|
|
|
|
cube({ size: [
|
|
|
|
ventWidth * 2 + ventSize,
|
|
|
|
boardSize + innerSpace + wall + 10,
|
|
|
|
ventSize,
|
|
|
|
], center: true })
|
|
|
|
),
|
|
|
|
union(
|
|
|
|
cube({ size: [
|
|
|
|
boardSize + innerSpace + wall + 10,
|
|
|
|
ventSize * 3,
|
2020-01-04 04:05:10 +00:00
|
|
|
ventSize,
|
|
|
|
], center: true }),
|
2020-01-03 17:16:53 +00:00
|
|
|
cube({ size: [
|
|
|
|
ventSize * 3,
|
|
|
|
boardSize + innerSpace + wall + 10,
|
2020-01-04 04:05:10 +00:00
|
|
|
ventSize,
|
|
|
|
], center: true })
|
2020-01-03 17:16:53 +00:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2020-01-04 04:05:10 +00:00
|
|
|
const endZ = (innerSpaceHeight + wall) / 2 * -1 + 1.5 * ventSize
|
|
|
|
const startZ = (innerSpaceHeight + wall) / 2 - 2 * ventSize - wall
|
2020-01-03 17:16:53 +00:00
|
|
|
for (let z = startZ; z >= endZ; z -= 3 * ventSize) {
|
|
|
|
obj = difference(
|
|
|
|
obj,
|
|
|
|
ventRow.translate([0, 0, z])
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
return obj
|
|
|
|
}
|
|
|
|
|
2020-01-04 04:05:10 +00:00
|
|
|
/* exported main */
|
2020-01-03 13:40:00 +00:00
|
|
|
function main() {
|
2020-01-03 17:16:53 +00:00
|
|
|
const boardSupport = cylinder({
|
|
|
|
h: boardSupportHeight + wall,
|
|
|
|
r: boardSupportRadius,
|
|
|
|
center: true,
|
|
|
|
})
|
|
|
|
|
|
|
|
return [
|
|
|
|
// Housing without lid
|
|
|
|
union(
|
|
|
|
// Housing with holder
|
2020-01-04 03:52:25 +00:00
|
|
|
difference(
|
|
|
|
union(
|
2020-01-04 04:05:10 +00:00
|
|
|
addVents(difference(
|
|
|
|
union(
|
|
|
|
// Main housing block
|
2020-01-04 03:52:25 +00:00
|
|
|
cube({ size: [
|
2020-01-04 04:05:10 +00:00
|
|
|
boardSize + innerSpace + wall * 2,
|
|
|
|
boardSize + innerSpace + wall * 2,
|
|
|
|
innerSpaceHeight + wall,
|
|
|
|
], center: true }),
|
|
|
|
|
|
|
|
// Lamp post holder
|
|
|
|
difference(
|
|
|
|
cylinder({
|
|
|
|
h: boardSize + innerSpace + wall,
|
|
|
|
r: lampPostSupport,
|
|
|
|
center: true,
|
|
|
|
resolution: 100,
|
|
|
|
}),
|
|
|
|
cylinder({
|
|
|
|
h: boardSize + innerSpace + wall,
|
|
|
|
r: lampPostRadius,
|
|
|
|
center: true,
|
|
|
|
resolution: 100,
|
|
|
|
}).translate([lampPostRadius * -1, 0, 0])
|
|
|
|
)
|
2020-01-11 13:51:10 +00:00
|
|
|
.rotateY(90)
|
|
|
|
.translate([0, 0, (innerSpaceHeight + wall) / 2])
|
2020-01-04 04:05:10 +00:00
|
|
|
),
|
|
|
|
|
|
|
|
// Inner housing
|
|
|
|
cube({ size: [
|
|
|
|
boardSize + innerSpace,
|
|
|
|
boardSize + innerSpace,
|
|
|
|
innerSpaceHeight,
|
|
|
|
], center: true }).translate([0, 0, wall * -0.5])
|
|
|
|
)),
|
2020-01-04 03:52:25 +00:00
|
|
|
// Outer border of power inlet
|
|
|
|
cube({ size: [wall, powerInletWidth + wall * 2, powerInletHeight + wall * 2], center: true })
|
2020-01-11 13:51:10 +00:00
|
|
|
.translate([
|
|
|
|
(boardSize + innerSpace + wall) / 2,
|
|
|
|
powerInletPosY,
|
|
|
|
(innerSpaceHeight + wall) / 2 - (wall + powerInletHeight / 2),
|
|
|
|
])
|
|
|
|
),
|
|
|
|
// Inner space of power inlet
|
|
|
|
cube({ size: [wall, powerInletWidth, powerInletHeight], center: true })
|
2020-01-04 03:52:25 +00:00
|
|
|
.translate([
|
|
|
|
(boardSize + innerSpace + wall) / 2,
|
|
|
|
powerInletPosY,
|
2020-01-04 04:05:10 +00:00
|
|
|
(innerSpaceHeight + wall) / 2 - (wall + powerInletHeight / 2),
|
2020-01-04 03:52:25 +00:00
|
|
|
])
|
2020-01-03 17:16:53 +00:00
|
|
|
),
|
|
|
|
|
|
|
|
// Board supports
|
|
|
|
translate([
|
|
|
|
boardSize / 2 - boardSupportEdgeDist,
|
|
|
|
boardSize / 2 - boardSupportEdgeDist,
|
|
|
|
(innerSpaceHeight + wall) / 2 - (boardSupportHeight + wall) / 2,
|
|
|
|
], boardSupport),
|
|
|
|
translate([
|
|
|
|
(boardSize / 2 - boardSupportEdgeDist) * -1,
|
|
|
|
boardSize / 2 - boardSupportEdgeDist,
|
|
|
|
(innerSpaceHeight + wall) / 2 - (boardSupportHeight + wall) / 2,
|
|
|
|
], boardSupport),
|
|
|
|
translate([
|
|
|
|
boardSize / 2 - boardSupportEdgeDist,
|
|
|
|
(boardSize / 2 - boardSupportEdgeDist) * -1,
|
|
|
|
(innerSpaceHeight + wall) / 2 - (boardSupportHeight + wall) / 2,
|
|
|
|
], boardSupport),
|
|
|
|
translate([
|
|
|
|
(boardSize / 2 - boardSupportEdgeDist) * -1,
|
|
|
|
(boardSize / 2 - boardSupportEdgeDist) * -1,
|
|
|
|
(innerSpaceHeight + wall) / 2 - (boardSupportHeight + wall) / 2,
|
2020-01-04 04:08:30 +00:00
|
|
|
], boardSupport)
|
2020-01-04 04:05:10 +00:00
|
|
|
).translate([(boardSize + innerSpace + wall + 5) * -0.5, 0, (innerSpaceHeight + wall) / 2]),
|
2020-01-03 17:16:53 +00:00
|
|
|
|
|
|
|
// Lid
|
2020-01-11 13:51:10 +00:00
|
|
|
union(
|
|
|
|
difference(cube({ size: [
|
|
|
|
boardSize + innerSpace + wall * 2,
|
|
|
|
boardSize + innerSpace + wall * 2,
|
|
|
|
wall,
|
|
|
|
], center: true })),
|
|
|
|
difference(
|
|
|
|
cube({ size: [
|
|
|
|
boardSize + innerSpace,
|
|
|
|
boardSize + innerSpace,
|
|
|
|
wall,
|
|
|
|
], center: true }),
|
2020-01-11 17:06:36 +00:00
|
|
|
// cut out inside to save material
|
2020-01-11 13:51:10 +00:00
|
|
|
cube({ size: [
|
|
|
|
boardSize + innerSpace - 2 * wall,
|
|
|
|
boardSize + innerSpace - 2 * wall,
|
|
|
|
wall,
|
2020-01-11 17:06:36 +00:00
|
|
|
], center: true }),
|
|
|
|
// cut out corners as they don't really fit when printed
|
|
|
|
cube({ size: [5 * wall, 5 * wall, wall], center: true })
|
|
|
|
.translate([(boardSize + innerSpace - wall) / 2, (boardSize + innerSpace - wall) / 2, 0]),
|
|
|
|
cube({ size: [5 * wall, 5 * wall, wall], center: true })
|
|
|
|
.translate([(boardSize + innerSpace - wall) / -2, (boardSize + innerSpace - wall) / 2, 0]),
|
|
|
|
cube({ size: [5 * wall, 5 * wall, wall], center: true })
|
|
|
|
.translate([(boardSize + innerSpace - wall) / -2, (boardSize + innerSpace - wall) / -2, 0]),
|
|
|
|
cube({ size: [5 * wall, 5 * wall, wall], center: true })
|
|
|
|
.translate([(boardSize + innerSpace - wall) / 2, (boardSize + innerSpace - wall) / -2, 0])
|
2020-01-11 13:51:10 +00:00
|
|
|
).translate([0, 0, wall])
|
|
|
|
).translate([(boardSize + innerSpace + wall + 5) * 0.5, 0, wall / 2]),
|
2020-01-03 17:16:53 +00:00
|
|
|
]
|
2020-01-03 13:40:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// vim: set ft=javascript:
|