Maketober Day 25: Making a light box
/After a whole bunch of posts that have shown some creative uses of the word “make” but not actually described making anything, today I’ve actually made something. I’ve also done some time travel, going back to a program that I wrote quite a few years ago when I was designing boxes to put things in. I wanted to give the program a list of components and then have it turn out a box box for them. It worked especially well with the Microsoft Gadgeteer devices which were brilliant, wonderful and way ahead of their time.
def PirSensorBoxWemosWithPixelRing():
print("Making PIR Sensor Box")
proc = WEMOS("Wemos",verticalAlignment=VerticalAlignment.TOP,
horizontalAlignment=HorizontalAlignment.LEFT,xMargin=0.5, yMargin=0.5)
holder = Device("blank", "blank", PixelRing.boardHeight, PixelRing.boardWidth,grid=[[proc]])
lid1 = PIRSensorLidHole("PIRSensorLidHole")
lid2 = PixelRingLightPipeLid("PixelRingLid")
case = Case(wall_thickness=3,base_side_height=20,base_thickness=3.0,lid_side_height=5)
case.makeParts([[holder]],[[lid1,lid2]])
holeHeight=13
holePos = Base.Vector((case.width-holeHeight)/2.0,case.height-1,-3.0)
hole = Part.makeBox(holeHeight,4,8,holePos)
case.baseDesign = case.baseDesign.cut(hole)
case.show()
My box making system is written in Python and runs inside the FreeCAD tool. You can create component objects and then the system put them into boxes for you. The program works on pre-built software objects and has the ability to put components inside components. Above you can see the Python that makes a box that contains a PIR sensor, a 12 pixel neopixel ring and an ESP8266. The idea is that the will come on when you walk past the light. And, because the ESP8266 can do WiFi and other connected stuff I can make other lights come on too.
This is the output of the function. The ESP8266 is placed on the base of the box and the pixel ring and PIR sensor are fitted on the top. All I have to do now is print the boxes….