Adafruit Alarm Clock

This project encompasses a adafruit CPX that is programmed as an alarm clock that is light sensitive. This alarm clock will be used to wake up an individual with the sun by making noises and flashing lights. This product is supposed to be interactive and help one live a healthier sleeping lifestyle.
Supplies




- 3D Printer
- Hot Glue
- Battery Pack
- Computer
- USBC Connector
- Adafruit CPX
- 3D print
Find a Holder/stand for CPX

To use the same holder than we used for our project, you need to go to thingiverse.com and search for the CPX holder. The exact one that we used is in the photo attached. If you want to use a different holder you can but you just need to make sure the sunlight will be able to reach the light sensors on the CPX.
3D Print Holder

Print holder, but make sure it's to scale. The holder needs to be the same size as your CPX so it will fit in the holder and doesn't need to be printed with supports. To print this you need to go to tinkercad and upload the file there to get a .stl file to bring to the 3D printer.
Circuit Python Code
The code attached is the code used to make the CPX work as an alarm clock.
# Threshold for light detection
BRIGHT_THRESHOLD = 200 # Adjust this based on your environment
while True:
# Check if the light level is bright
if cp.light > BRIGHT_THRESHOLD:
for _ in range(10):
# Play a siren sound - simulated by tones (no siren preset)
cp.play_tone(880, 0.2)
cp.play_tone(440, 0.2)
# Show a rainbow-like pattern on NeoPixels
colors = [
(255, 0, 0), # Red
(255, 128, 0), # Orange
(255, 255, 0), # Yellow
(0, 255, 0), # Green
(0, 255, 255), # Cyan
(0, 0, 255), # Blue
(128, 0, 255), # Indigo
(255, 0, 255), # Violet
(255, 255, 255),# White
(0, 0, 0) # Off (optional)
]
for i in range(10):
cp.pixels[i] = colors[i % len(colors)]
cp.pixels.show()
time.sleep(0.2)
# Optional: turn off pixels after
cp.pixels.fill((0, 0, 0))
time.sleep(0.1)
Final Assembly

To put everything together you need to get all your materials in one place. To start, you need to download you python code onto your CPX using the USBC cord, once you do that you need to take your battery pack, with batteries already inside and connect it to the CPX so it can run without the power from the computer. Next, you can put your CPX into the holder and hot glue the battery back to the underside of the holder so it doesn't interfere with the sun getting to the light sensors. Once all those steps are completed, you can put your CPX in a place where there'll be light in the morning to have the alarm clock go off to the suns rays.