-
1Step 1
Hardware and Omega Setup
Since the Omega only has one USB port, we need a USB Hub to connect the BLE Dongle and USB soundcard. The sound card is where you will provide the auxillary output to the speakers.After you are done this, make sure you are running the latest version of the Omega's firmware:
oupgrade
-
2Step 2
Installing Packages
Here is the list of packages we will be using:
- obluez-libs
- obluez-utils
- opulseaudio-daemon
- pulseaudio-profiles
- pulseaudio-tools
- alsa-lib
- alsa-utils
Before we start installing any packages, we need to run the following command.
opkg update
Then run the following command to install the packages:
opkg install obluez-libs obluez-utils opulseaudio-daemon pulseaudio-profiles pulseaudio-tools alsa-lib alsa-utils
-
3Step 3
Setting up the PulseAudio Daemon
We have to setup the PulseAudio Daemon so that it runs in the background. To do this enter the following commands:udevd --daemon chmod 0777 /dev/snd/* mkdir -p /var/lib/pulse pulseaudio --system --disallow-exit --no-cpu-limit &
PulseAudio is somewhat unpredictable in this regard. If you have trouble, we recommend rebooting and restarting the process. To check if PulseAudio successfully daemonized, run the ps command, which will run PulseAudio:
ps
-
4Step 4
Remote Bluetooth Device Setup
The bluetooth device setup is relatively simple. To make sure your dongle is connected properly run the command.hciconfig -a
and to turn on the dongle run the following commands.
hciconfig hci0 up hciconfig hci0 sspmode enable hciconfig hci0 piscan
At this point your donlge should be blinking a blue light.
Now to actually connect to a device we have to use bluetoothctl.
Enter the command:
bluetoothctl
You will enter into the bluetoothctl menu and your dongle will be listed as a controller. Run the following commands to make the dongle discoverable/pairable and allow it to discover other devices.
agent on discoverable on pairable on scan on
Once you target device is located your can pair with it using the command:
pair XX:XX:XX:XX:XX:XX
At this point you will be prompted to enter a PIN on the command line which you will then have to re-enter on you remote device for verification. We need to trust the remote device so that the remote device can initiate the connection. To do this, enter the command:
trust XX:XX:XX:XX:XX:XX
-
5Step 5
Initiating Connection from Remote Device
Try initiating the connection from your device and it should work. You should see a screen like so. The remote device should be registered as an input device.
You can now quit the bluetooth menu with the command:
quit
Also, your phone should recognize the OnionBLE as a media audio device.
-
6Step 6
Audio Playback with PulseAudio
Now you can check to make sure your device is still connected by running this command.hcitool con
Your device should be listed, if you see nothing. Try initiating the connection again from the remote device. If that doesn't work go back to the previous step.
To get the audio to play, we will be using the
pactl
utility.To see our audio sources run the command:
pactl list sources
Your device should show up as a source. For me it is source # 2.
We should do the same for the audio sinks, to confirm that our USB sound card is listed as a sink.
pactl list sinks
You should see a similar screenshot. In our case, the USB sound card is recognized as C-Media USB Headphone Set
Connect your speakers or headphones (make sure the volume is low). Run the command below, replacing the source/sink names as listed in the previous two commands.
pactl load-module module-loopback source=bluez_source.XX_XX_XX_XX_XX_XX sink=<Sink Name> rate=44100 adjust_time=0
-
7Step 7
Success!
You should be hearing music right now. We should mention that when testing with the iphone, we established connection however only heard noise.You can control the volume using pactl.
pactl set-sink-volume 1 -25%
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.