Categories: BeagleBone Black, Demo, General Purpose, Intermediate
Our group created the Smart Christmas Wreath for our ECE434 Embedded Linux course at Rose-Hulman. We wanted to spread a bit of Christmas Cheer while studying for exams and completing other capstone projects.
The idea of the wreath is simple–control a song using a Blynk application and the wreath will light up accordingly.
Our software is somewhat complex–the most difficult part of the project was understanding multithreading and sub-processes well enough to use mplayer and control lights on the PRU of the beaglebone in parallel. Stopping music in mplayer from a python file was surprisingly difficult. Ultimately, we had to run the command as a sub-process and pipe keyboard commands to it in order to stop.
To combine mplayer, the lights on the PRU, and the Blynk application, we had to run threads in python. When a button is pressed on Blynk, our python code initiates a new thread that starts mplayer and runs the lights. When the stop button is pressed, this thread is terminated and the application goes back to normal operation.