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

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

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

[Service]
Type=oneshot
RemainAfterExit=yes
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

[Install]
WantedBy=bluetooth.target

Then I ran

sudo systemctl enable bluepower.target

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

/etc/systemd/system/[email protected]/autologin.conf

(You might have to create the [email protected] folder) with the contents

[Service]
ExecStart=
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.

Sources:

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

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

Amusez-vous bien !

Source


Reprenez le contrôle : Comment supprimer vos données personnelles d’Internet avec Incogni ?

🔒Votre vie privée est-elle vraiment privée❓

😮Vous l’ignorez peut-être, mais des sociétés appelées Data Brokers collectent, agrègent et monnaient vos données personnelles sans votre consentement.

📝Votre nom, votre prénom, votre date de naissance, 📧 votre email, 🏠 votre adresse postale, et bien d’autres informations sont ainsi collectés pour être revendus à des publicitaires. Il est donc temps de reprendre le contrôle de vos informations personnelles grâce à Incogni

🛡️Incogni est un service qui se charge pour vous de contacter ces Data Brokers et d’exiger la suppression de vos données personnelles.

💥 Profitez d’une offre spéciale avec le code INCOGNI60 et ne laissez pas votre vie privée entre de mauvaises mains❗🙅‍♀️

👇🔍 CLIQUEZ ICI POUR EN SAVOIR PLUS 🔍👇

Lien partenaire

Les articles du moment