Project Apollo is a wireless bluetooth speaker that is able to process the music being played to provide a interactive light show customized for that song. What exactly does this mean? Well Apollo has two speakers and a 8×8 led panel. As the music plays leds on the panel will light up corresponding to the notes being played.
Wow that sounds pretty cool! How does it work?
Apollo has several different components. The first is a raspberry pi which acts as the bluetooth manager, light manager, and audio player. The second is an Arduino that is connected to the raspberry pi that acts as a light card. The raspberry pi commands the Arduino via a usb serial connection. The Arduino then connects to the led panel turning off and on the lights that the raspberry pi tells it to. The third component are the speakers. They are wired to a small amplifier that connects to the raspberry pi via aux cable. The fourth piece is the power which is diverted from a usb micro connector to the three boards. In case this description was not satisfactory the whole thing looks like:
Ok I understand how you built it but from a user perspective, how does it work?
A user, like yourself, connects to the bluetooth speaker the same way you would any other bluetooth speaker. Once connected the raspberry pi turns on a light by subscribing to UDEV events. ( If you don’t know what these are or want to learn more learn more check out the git repo!) Once the light is on then the raspberry pi turns off discoverable mode.
Now you are able to start playing music normally. When your phone starts playing music it sends it to the raspberry pi via bluetooth. The raspberry pi adapter then streams the music to pulse audio. Pulse audio splits the music stream to two places. The first is out to the AUX cable to the amplifier which then plays through the speakers. The second is to the light daemon. The light daemon gets the current music as an array of bytes. This array is the actual waveform of the music. It then runs a FFT on the music to turn it into a frequency array. Then it iterates through the array checking if there is a peak at any of the bins. If there it it marks that the light should be turned on in a bit mask. After the analysis is done the light daemon sends the bit mask to the Arduino. The Arduino then turns on the corresponding led for each bit in the bit mask.
So how does the bluetooth speaker look?
So all the pieces that we have talked about are mounted in a rectangular enclosure. This enclosure designed specifically for the Apollo system has four vertical layers. The top two are for “beautification” purposes hiding all the nuts and bolts of the box. The middle two are where the raspberry pi, Arduino, usb, and amplifier are mounted to.
The front mounts the two speakers and the led square for everyone to see.
The sides have a transparent square so the raspberry pi bluetooth light can be seen glowing.
Finally the back has an opening so you can plug in a 5V 2A usb cable for power.
Wow that speaker looks really good! Can I see it in action?
Sure there is a live video right here: https://www.youtube.com/watch?v=ADI2s9f0lzY
Now that I saw the video I would really like to know what the lights mean?
The outside boarder represents the bass. If there is ever a change in the base then the lights change color and position. Really strong base turns on more lights. The middle lights each correspond to a note. The top left is the lowest note going all the way to the bottom, left to right, to the highest note. If the light is on it means that note is being played.
Is there a place I can learn more about the math and how you built Apollo?
Sure thing. Check out my Github repo. https://github.com/nbroeking/Apollo
That repo contains everything it took to build the Apollo speaker.