Note
This README is still under construction.
Harmony is a Bluetooth speaker and Ferrofluidic music visualizer.
- Overview
- Features
- Bill of Materials
- Compiling the firmware
- Flashing and running
- Monitoring UART
- Hardware Setup
- Software Architecture
Harmony combines Bluetooth audio streaming with the visual effects of a ferrofluid display reacting to the music's rhythm and bass.
Warning
This project involves power electronics which can be dangerous. Take proper safety precautions and consult a qualified professional if unsure.
- Bluetooth audio streaming (using the SBC codec)
- Ferrofluid visualization synchronized with music
- Volume and playback controls
- Customizable LED lighting effects
A detailed Bill of Materials (BOM) can be found in BillOfMaterials.md
. This document lists all the necessary components for building Harmony.
The firmware for Harmony is built using CMake and requires the Raspberry Pi Pico SDK.
-
Ensure you have the Pico SDK set up on your system. See the official Raspberry Pi Pico documentation for instructions: https://www.raspberrypi.com/documentation/pico/getting-started/
-
Clone the swift-embedded-examples repository (if not already done):
git clone https://github.com/apple/swift-embedded-examples.git cd harmony
-
Set the necessary environment variables:
export TOOLCHAINS='<toolchain-identifier>' # e.g., gcc-arm-none-eabi export PICO_BOARD=pico_w export PICO_SDK_PATH='<path-to-your-pico-sdk>' # e.g., ../pico-sdk export PICO_EXTRAS_PATH='<path-to-your-pico-extras>' # e.g., ../pico-extras export PICO_TOOLCHAIN_PATH='<path-to-the-arm-toolchain>' # e.g., /usr/bin
-
Generate the build files using CMake:
cmake -B build -G Ninja . -DCMAKE_EXPORT_COMPILE_COMMANDS=On
-
Build the firmware:
cmake --build build
To flash the compiled firmware onto the Raspberry Pi Pico, you'll need OpenOCD.
-
Connect your Pico to your computer using a USB cable and put it into BOOTSEL mode by holding the BOOTSEL button while plugging it in.
-
Run OpenOCD with the appropriate configuration files:
openocd -f interface/cmsis-dap.cfg -f target/rp2040.cfg -c "adapter speed 5000" -c "program build/app.elf verify reset exit"
For debugging and monitoring, you can connect to the Pico's UART using a serial terminal program like screen
.
-
Identify the serial port connected to your Pico. You can usually find it using
ls /dev/cu.usbmodem*
on macOS or by checking the Device Manager on Windows. -
Connect to the UART using
screen
:screen /dev/cu.usbmodem<...> 115200
(Replace
<...>
with the correct port identifier)
Note
This README is still under construction.
Note
This README is still under construction.
The firmware is designed with a modular architecture for efficient audio processing and visualization control.
- Bluetooth Handlers: Manage the Bluetooth connection and incoming audio stream using the SBC codec.
- SBC Ring Buffer: Stores the decoded SBC audio data for further processing.
- Audio Decoder: Decodes the SBC encoded audio stream into PCM (Pulse Code Modulation) format.
- PCM Ring Buffer: Stores the decoded PCM audio data.
- Audio Analyzer: Analyzes the PCM audio data to extract relevant information like amplitude and frequency. This data is used to control the ferrofluid display.
- Audio Driver: Sends the PCM audio data to the DAC (Digital-to-Analog Converter).
- DAC: Converts the digital audio signal to an analog signal.
- Amplifier: Amplifies the analog audio signal to drive the speaker.
- Electromagnet Driver: Controls the electromagnet based on the analyzed audio data, creating the ferrofluid movements.