Bluetooth DJ Set — DIY Embedded Systems
As someone soon graduating from the University of Wisconsin Madison, I feel ripped off that I didn’t have the new Makerspace for the first 3 years here. What better way to capitalize on a late opportunity then a with a full semester hack!
The Prompt
- Something fun, I have done enough boring projects.
- Something the UW-Madison IEEE Student Chapter can show off.
- Something to utilize the Makerspace as well as my degree in Computer Engineering.
What It Is
In short, this is simply a Bluetooth speaker set. The Controller Box sends data over Bluetooth to the Speaker where it then plays music, visualizes the audio, and displays gifs. The Controller Box also has a nice set of controls and a UI to mess with.
The Controller Box
The Controller Box was a custom laser cut particle board which I then attached the HDMI screen, buttons, 3D printed jog wheel, and more. The box runs on a Raspberry Pi 3 running Raspbian. On boot it kicks off Chromium in kiosk mode on a separate X-Server process to help reduce the memory overhead of needing the full window manager. Using the custom basic HTTP Server I built in C, I was able to communicate over WebSockets between the browser and my system code. This means I am able to build a good looking web based CSS interface and have it directly communicate with all my system code to maintain good speed.
The Speaker
The speaker consisted of a Qualcomm Dragonboard 410c, a custom PCB, and some speakers. I cut the base with particle board as well as acrylic for the top. The main reason for the PCB was there was no good way to contain all the electronics on a protoboard as I did with the controller. The reason for the Dragonboard was I wanted to make sure the board had the power to:
- Play PCM audio packets
- Alter the audio in real time (volume and other signal processing effects I never ended up adding)
- Anaylsis the audio and write out the LED lights via SPI
- Read in and run various gifs over the LCD screen via SPI at least 30fps
- Send data bi-directional over Bluetooth
The Bluetooth Communication
Using BlueZ I has TCP style sockets streaming the data over RFCOMM sockets. Lets take the example of the adjusting the volume to see the flow of everything:
- Detect change in slider on the Pi and signal the UI to change.
- Get acknowledgement from UI of change, this is because the UI kept the state of everything.
- Send a custom socket message from the Pi to the Dragonboard. Something like
4:60
where the 4 means “change volume” and the 60 was the volume to set. - The Dragonboard on a separate thread receives the volume, and sets the gain variable so the other thread will read it in when reading the next audio packet.
What I Regret
As a Computer Engineer I realized I enjoyed the part of this project where I got it all to work over software and figuring out stuff like how to get the LCD Screen to work from reading the datasheet. Sadly this was about 33% of the work. The other 66% was me “Measuring once and cutting ten times”. This was a good wake up call that not everyone is good with their hands and might be better off sticking to a computer as their main tool
Code: https://github.com/uwmadisonieee/Bluetooth-Retro-DJ
Video: https://youtu.be/4wVTRmy3RTk
Personal thanks to Max Strange and the Makerspace staff for all the help