Korben, roi d’internet, logo bébé avec des lunettes en mode thug life Korben, roi d’internet, logo bébé avec des lunettes en mode thug life

Korben Upgrade your mind

Transformer un Raspberry Pi en récepteur audio Bluetooth

Si vous avez un vieil autoradio dans votre voiture ou une vieille chaine Hifi disposant d’une entrée auxiliaire, 2 solutions s’offrent à vous pour pouvoir y balancer de la musique en Bluetooth via votre téléphone ou votre ordinateur.

La première est très simple et s’adresse aux paresseux : Acheter un transmetteur Bluetooth comme celui-ci ou celui-là.

La seconde est beaucoup plus cool puisqu’elle permet tout simplement d’utiliser un Raspberry Pi pour en faire un récepteur audio Bluetooth.

Voici les explications de Parkerireed qui partage son montage avec les gens de l’Internet

I had always wanted to do something like this but never quite connected all the pieces. You need pulseaudio and bluez from your favorite package manager.

I did this in Arch linux but at least udev and maybe the bluetooth up service file should apply to more distros.

First, I created /etc/udev/rules.d/10-local.rules with the contents

# Set Bluetooth power up
ACTION== »add », KERNEL== »hci0″, RUN+= »/usr/bin/hciconfig hci0 up »

Second, I created a systemd target file for bringing the hci0 interface up right after the bluetooth daemon starts. The file is /lib/systemd/system/bluepower.target and contains

Description=Bluetooth power keeper
Requires=sys-subsystem-bluetooth-devices-%i.device bluetooth.service
After=bluetooth.service sys-subsystem-bluetooth-devices-%i.device suspend.target
Conflicts=shutdown.target systemd-sleep.service

ExecStart=/usr/bin/dbus-send –system –type=method_call –dest=org.bluez /org/bluez/%I org.freedesktop.DBus.Properties.Set string:org.bluez.Adapter1 string:Powered variant:boolean:true
ExecStop=/usr/bin/dbus-send –system –type=method_call –dest=org.bluez /org/bluez/%I org.freedesktop.DBus.Properties.Set string:org.bluez.Adapter1 string:Powered variant:boolean:false


Then I ran

sudo systemctl enable bluepower.target

Next, I enabled auto login to my user on the first tty1 by editing the file


(You might have to create the getty@tty1.service.d folder) with the contents

ExecStart=-/usr/bin/agetty –autologin username –noclear %I 38400 linux

Then at the end of my ~/.bashrc I added

pulseaudio -D

Finally comes the first time connect. Run

bluetoothctl (This is bluez5. If you are using an older bluez refer to the documentation to connect to your phone/audio device)
power on
agent on
scan on

Put device is discovery mode. It will show the device in the output.

pair macaddress

Follow pairing instructions.

trust macaddress
connect macaddress

If all goes well you should have audio being played from the phone/media player to the Raspberry Pi and everything auto launching at boot.


[1] https://bbs.archlinux.org/viewtopic.php?id=166362

[2] https://wiki.archlinux.org/index.php/automatic_login_to_virtual_console

Amusez-vous bien !