Hardware

The hardware for the smart music player consists of an 8-by-8 bicolor LED matrix, a USB microphone, and two pushbuttons. The LED matrix displayed the weather, and the microhpone was used to determine the sound level of the surroundings. The pushbuttons changed were used to change the song and for basic learning for the music selection algorithm.

Bicolor LED Matrix

The bicolor LED Matrix is an 8-by-8 neopixel matrix by Adafruit that displays red, green, and orange. We used the bicolor LED to display the weather. The digits of the temperature in degrees Fahrenheit were displayed, followed by the weather outside. For example, if the weather was "partly cloudy," a sun and a cloud were displayed. The weather symbols were animated to move across the screen. The weather display updated whenever the NOAA weather report changed. The color of the pixels depended on the temperature outside. If the temperatures is above 80 degrees Fahrenheit, the display is red. If the temperature is less than 30 degrees Fahrenheit, the display is green; otherwise, the display is orange. The bicolor LED Matrix was powered by a separate 6V battery pack and used I2C to communicate with the Raspberry Pi. LED initialization was done through the Adafruit LED and Python Imaging libraries. Below is an image of what a raindrop looks like on the LED Matrix:

Pushbuttons

Pushbuttons were initialized on GPIO pins 27 and 23 and were used to skip to the next song and "dislike" a song, respectively. Pressing the skip button triggers an interrupt which sends a new song identifier from the list generated by the song selection algorithm to the laptop. Pressing the "dislike" button removes the currently playing song identifier from the playlist generated by the algorithm. Because the attributes of the currently playing song are known, the "dislike" button could also be used to remove other songs with similar attributes in the software.

USB Microphone

The USB Microphone from eBerry records the sounds of the environment. We chose to use a USB microphone because the Raspberry Pi is a completely digital system and is therefore unable to read analog voltage outputs from a microphone and amplifier circuit. We attempted to use SPI to read analog values from an external ADC, but the hardware was much simpler with the USB microphone. The USB microphone records the surroundings for three seconds using the arecord function from ALSA and generates a WAV file of the recorded noise. When we played the WAV file back using the aplay function, the sound was very noisy, which we mostly remedied by changing the sampling rate. Even though there was some noise left in the WAV file, we were accurately able to distinguish between loud and soft environments, which was our main goal. We calculated the noise level of the WAV file by taking the FFT of the file and summing the power of all of the frequencies. We were able to return the noise level from the python script; however, the noise level has not yet been implemented into the algorithm.