Create a box that plays music when opened (triggered by a light sensor).
- LILYGO ESP32 Board
- Arduino IDE
- Processing
- TFT Espi Library (Downloadable) - Documentation
- USB-c cord
- 7 male/male wires (for breadboard)
- 10k Ω resistor
- Servo Motor
- Photoresistor
- Wires
- Breadboard
- (Optional) Figurine & Glue
- (Optional) Bluetooth Speaker
/lightsensing
- holds the arduino file for code to uploaded to the ESP32 board for sensing light and gathering serial communication
lightsensing.ino
- arduino file with ESP 32 code
/enclosuredesign
- holds the svg files related to the enclosure for laser cutting
/musicbox
- holds the code for launching the audio element of the music box through the Processing application
musicbox.pde
- processing file with audio playing code
- Solder wires to your photoresistor.
- Use the enclosure svg file in
/enclosuredesign
and some wood to laser cut the box design - Follow the Fritzing diagram and add your servo motor, photoresistor, 10K Ω resistor, and ESP32 board to the breadboard
- Loop your connected servo motor and photoresistor through the hole at the bottom of the closure design
- Glue the figurine to the servo motor while its inside the enclosure box
- Add the speaker inside the box and connect to your computer audio
- Connect your ESP32 board to your computer via a USB-C cord
- Download the
/lightsensing
and/musicbox
folders - Open these folders in the Arduino IDE application and Processing application, respectively
- Confirm that your ESP32 board connects to the Arduino application by running the arduino code file
lightsensing.ino
(you should see printed light values read from the serial communication) - Open the
musicbox.pde
from the/musixbox
folder in the Processing application and ensure that it runs and complies - Once a screen pops up from the Processing application, you should be able to test out your music box!
~ Feel free to make any edits to the code after downloading and experiment on your own! ~