To tell you the truth, this week we had planned to continue our series on USB batteries, but it turns out that the associated experiments are taking longer than expected. Actually, this is rather good news, but this also means we had to fall back on an emergency topic...
Almost ten years ago, for the end-of-year celebrations, we built a shadow puppet diorama that was a big hit with the locals. We recently cleaned out our old premises and found the lighthouse. As it's still working, we thought it would be a real shame to throw away such a beautiful piece of Yoctopuce history.
10 years later, the lighthouse is still working
The basic idea is to turn this lighthouse into an IoT object. To do this, we plan to make a fake rock using 3D printing, hide the control electronics inside and perch the lighthouse on top.
The rock
The problem was that we didn't have the time, inclination or patience to manually model a rock in CAD software. Instead, we looked for a way to script the creation of the rock. We found FreeCAD which, in addition to being free, you can apparently fully control from Python scripts.
For simplicity's sake, we decided to create a stylized rock in the form of a cluster of interlocking cubes. The position of the cubes and their size are more or less random. Their angle to the horizontal is either 0° or 45°, to limit the risk of overhangs that would be difficult to print without support. After some trial and error, a little Python script enabled us to obtain a more or less satisfactory rock model.
import math
import random
from BOPTools import BOPFeatures
document = App.newDocument()
cubes = []
for i in range (0,300):
name="Cube "+str(i)
size = str(10+randrange(10))+" mm"
cube=App.ActiveDocument.addObject("Part::Box",name)
App.ActiveDocument.ActiveObject.Label = name
App.ActiveDocument.recompute()
cube.Length = size
cube.Width = size
cube.Height = size
angle = 2*math.pi*randrange(360)/360
z = randrange(50)
radius = 60.0-z/3
x = radius*math.cos(angle)
y = radius*math.sin(angle)
a=0
b=0
c=0
d=0
if random.random()>0.5: a=1
if random.random()>0.5: b=1
if random.random()>0.5: c=1
if random.random()>0.5: d=45
position = App.Vector(y,x,z)
rotation = App.Rotation(App.Vector(a,b,c),d)
cube.Placement = App.Placement(position,rotation)
cubes.append(name)
bp = BOPFeatures.BOPFeatures(App.activeDocument())
bp.make_multi_fuse(cubes)
App.ActiveDocument.recompute()
Mistletoe.SendMsgToActiveView("ViewFit")
The result in FreeCAD
As we didn't have enough time to learn how to use FreeCAD, we exported the model to a STEP file and re-imported it into Solidworks to remove the few overhangs that still appeared and provide a clean space in the center for the electronics.
After some modifications in Solidworks, it's ready for printing
Thanks to all these precautions, 3D printing went off without a hitch, even though it took almost ten hours.
It's ready!
The electronics
The architecture of the lighthouse is relatively simple. At the top is a Yocto-PowerColor LED mounted on a small platform driven by a tiny reduced motor running on 5 volts. The electrical connection between the LED and the rest of the lighthouse is provided by a small slip ring.
To drive the lighthouse from an Ethernet network, all we need is a PoE-powered YoctoHub-Ethernet, a Yocto-Relay to drive the motor, and the Yocto-PowerColor control unit to drive the LED. To power the motor, we simply draw a little current from one of the YoctoHub-Ethernet ports. Since the Yocto-Relay contains two STDP relays, we took the opportunity to wire them as H-Bridges, enabling the light to turn in either direction, depending on which relay is activated. To simplify H-bridge wiring, we've linked the two A outputs and the two B outputs directly below the Yocto-Relay.
Electronics
And does it work?
Once you've put it all together, the result looks pretty good - judge for yourself:
Now all that's left to do is to find a use for this gadget....