Night Fright Light

This project was inspired by my younger sister, who when little had serious sleepwalking tendencies! She would routinely make it out the door and down the street before waking up confused and bewildered. It was obviously a concern for my parents, who wanted to keep their daughter safe, but didn't want to have to install a security system that would alert them whenever the door was opened. And so I developed the "Night Fright Light", which can be plugged into a wall outlet at any threshold that a parent wants to prevent their sleepwalking kid from crossing. When tripped, the alarm goes off, setting off a blaring noise and flashing red light meant to wake up the sleep-walker and alert parents from their bedroom. The device also doubles as a night light, which reacts to the ambient light in the room and lights up in blue only when it is dark out. The alarm will remain armed as long as the night light is plugged in.
Supplies
Laser Cutter (Can be found in most Makerspaces)
44 square inches of 1/8" thick birch wood
Hot Glue
Electrical Tape
USB-A to electric socket converter
Circuit Playground Bluefruit by Adafruit (with USB-A to micro USB data cable)
USB-A to micro USB cable (not data)
VL53L1X Time of Flight Sensor by Adafruit
Code for Programming CPB
1) Import all packages necessary for CPB and Time of Flight Sensor compatibility
2) Initialize ability to play audio from CPB
3) Define colors and CPB pixels
4) Enable CPB speaker, alarm sound file path and play_sound function
5) Create red and blue light functions
6) Initialize Time of Flight Sensor and set "tripping" window. I have it set as .1m to 1m, but that can be changed depending on the width of the hallway or room where the alarm is being set up
7) Run a "while True" loop that:
a. lights the pixels BLUE when the CPB light sensor detects low amount of ambient light
b. turns off the pixels when any significant amount of ambient light is detected
c. if anything passes in front of the time of flight sensor between the minimum distance and maximum distance, the "start_playing" function is initialized, which plays the alarm sign and lights up the pixels in a pulsing RED
Downloads
Cut Out the Template

Upload the attached .ai files, created in Adobe Illustrator, to your laser cutter. Make sure you follow your particular laser cutter's guidelines for ensuring a clean cut. I used 1/8" wood for the "Chassis" and 1/8" acrylic for the "Top" to ensure a light build. Also note that the hole for the wall socket plug should be exactly measured to the wall socket to ensure for a sturdy connection and that the housing doesn't wobble around when plugged into the wall socket. The material for the top, should be a clouded acrylic to both allow for ambient light to reach the CPB light sensor and diffuse the pixels' light.
**Note that the attached photo is from the model cut and isn't exactly to size of the true design.
Secure Time of Flight Sensor


This is maybe the most crucial step of the build, as the time of flight's sensor needs to be centered in the narrow slit in the front panel. Any amount that the sensor is off center and blocked by the case itself (especially as the rest of the case is being built) will compromise the night light's ability to gain an accurate reading. I used an abundance of electrical tape to secure the sensor from moving while being jostled. See in the attached photo that the ToF's sensors are centered perfectly in the opening.
Secure the USB to Electrical Socket Box

An underrated step in the build is making sure that the socket box is secured to the back panel. I used thin strips of electrical tape to form a tight connection. As mentioned in step 2, the tight fit will do most of the work, but the tape provides an extra sturdiness.
Secure the Panels to Each Other
Using Hot Glue on the inside of the panel connections, secure the wall panels to the bottom panel, leaving the top off for now.
Connect Time of Flight and Put in Chassis

Connect the red wire on the ToF to "3.3V" on the CPB, black wire to "GND", yellow wire to "SCL", blue wire to "SDA". Then put the entire build in the box.
Put Acrylic Top on Build
Put a dollop of hot glue on each panel, with the top of the dollop being 1/4" below the top of the build. This will allow the acrylic top to sit nicely a the top of the build, yet able to be removed for future improvements.
ENJOY THE BUILD!
