Cov txheej txheem:
- Khoom siv
- Kauj ruam 1: Nkag mus rau Raspberry Pi
- Kauj ruam 2: Txheeb tawm Bluetooth
- Kauj Ruam 3: Pairing, Txuas thiab Ntseeg Siab
- Kauj Ruam 4: Ua Si Suab Nkauj
Video: Raspberry Pi Bluetooth Hais Lus: 4 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:24
Nyob zoo sawv daws.
Nov yog Cov Lus Qhia Txog Yuav Ua Li Cas Hais Lus Bluetooth Siv Raspberry Pi. Qhov no tau ua tom qab kev teeb tsa tshiab ntawm Raspbian tshiab (raws li ntawm 2020-10-31.) Hauv Cov Lus Qhia no peb yuav hloov pauv Raspberry Pi kom tau txais lub suab hla Bluetooth thiab tso tawm nws los ntawm kev ua hauv 3.5 lub suab tso. Yog tias koj siv Raspberry Pi 1 lossis 2 ces koj yuav tau siv cais Bluetooth Adapter. Txog qhov Qhia Qhia no peb yuav siv Raspberry Pi 3B.
Khoom siv
Raspberry Pi 1, 2, 3 lossis 4.
Hais lus nrog 3.5 lub suab tso suab.
Lub hwj chim muab rau Raspberry Pi.
Mouse thiab Keyboard rau Raspberry Pi (lossis koj tuaj yeem SSH nrog lwm lub khoos phis tawj).
Bluetooth dongle yog siv Raspberry Pi 1 lossis 2.
Kauj ruam 1: Nkag mus rau Raspberry Pi
Cov kauj ruam no yog tus kheej-nkag siab zoo!
Koj yuav tsum tau nkag mus rau hauv Raspberry Pi los ntawm SSH lossis nrog tus saib xyuas, nas thiab keyboard. Yog tias koj nyob hauv Raspian GUI ces qhib Terminal. Yog tias koj yog SSH'ing ces koj yuav nyob ntawd.
Ua ntej koj mus nrog cov kauj ruam tom ntej nws raug nquahu kom paub tseeb tias koj tau hloov kho koj lub system.
sudo apt-tau hloov tshiab
sudo apt-tau hloov tshiab
Qhov no yuav siv ob peb feeb.
Kauj ruam 2: Txheeb tawm Bluetooth
Yog koj nkag mus
sudo systemctl xwm txheej xiav*
ces nws yuav zaum rov qab qee yam zoo li hauv qab no.
pi@raspberrypi: ~ $ sudo systemctl xwm txheej xiav*
● bluetooth.service-Bluetooth kev pabcuam Loaded: loaded (/lib/systemd/system/bluetooth.service; qhib; tus muag khoom preset Ua haujlwm: nquag (khiav) txij hnub Sat 2020-10-31 12:36:04 GMT; 40 feeb dhau los Cov Ntawv: txiv neej: bluetoothd (8) Lub ntsiab PID: 523 (bluetoothd) xwm txheej: "Khiav" Cov Haujlwm: 1 (txwv: 2065) CGroup: /system.slice/bluetooth.service └─523/usr/lib/bluetooth/bluetoothd Oct 31 12: 36: 04 raspberrypi systemd [1]: Pib siv Bluetooth… Oct 31 12:36:04 raspberrypi bluetoothd [523]: Bluetooth daemon 5.50 Oct 31 12:36:04 raspberrypi systemd [1]: Pib Bluetooth kev pab. Oct 31 12: 36: 04 raspberrypi bluetoothd [523]: Pib SDP server Oct 31 12:36:04 raspberrypi bluetoothd [523]: sap-server: Ua haujlwm tsis raug tso cai Oct 31 12:36:04 raspberrypi bluetoothd [523]: Endpoint register: sender =: 1.10 p Oct 31 12:36:04 raspberrypi bluetoothd [523]: Qhov kawg r egistered: sender =: 1.10 p Oct 31 12:36:04 raspberrypi bluetoothd [523]: Ua tsis tau raws txoj cai ntiag tug: raug tsis lees paub (0x ● bluealsa.service - BluezALSA proxy Loaded: loaded (/lib/systemd/system/bluealsa.service; zoo li qub; tus muag khoom preset:
Koj yuav pom tias muaj tus lej yuam kev. Peb yuav xub txheeb xyuas cov no.
Thawj qhov peb yuav txheeb yog "Sap tsav tsheb pib ua tsis tiav." thiab "sap-server: Tsis pub ua haujlwm". Nkag mus
sudo nano /lib/systemd/system/bluetooth.service
mus rau hauv lub davhlau ya nyob twg. Nws yuav los nrog qhov no.
[Chav]
Kev piav qhia = Kev pabcuam Bluetooth Cov ntaub ntawv = tus txiv neej: bluetoothd (8) ConditionPathIsDirectory =/sys/class/bluetooth [Service] Hom = dbus BusName = org.bluez ExecStart =/usr/lib/bluetooth/bluetoothd NotifyAccess = main #WatchdogSec = 10 #Restart = on-failure CapabilityBoundingSet = CAP_NET_ADMIN CAP_NET_BIND_SERVICE LimitNPROC = 1 ProtectHome = true ProtectSystem = full [Install] WantedBy = bluetooth.target Alias = dbus-org.bluez.service
Ntxiv
--noplugin = sap
tom qab
ExecStart =/usr/lib/bluetooth/bluetoothd
kom nws zoo li hauv qab no.
[Chav]
Nqe lus piav = Bluetooth kev pabcuam Cov ntaub ntawv = tus txiv neej: bluetoothd (8) ConditionPathIsDirectory =/sys/class/bluetooth [Service] Hom = dbus BusName = org.bluez ExecStart =/usr/lib/bluetooth/bluetoothd --noplugin = sap NotifyAccess = main # WatchdogSec = 10 #Restart = on-failure CapabilityBoundingSet = CAP_NET_ADMIN CAP_NET_BIND_SERVICE LimitNPROC = 1 ProtectHome = true ProtectSystem = full [Install] WantedBy = bluetooth.target Alias = dbus-org.bluez.service
Txuag thiab tawm. (ctrl-x, y, nkag). Ces
sudo rov pib dua
Thaum koj rov qab los ntawm lub davhlau ya nyob twg nkag
sudo systemctl xwm txheej xiav*
Qhov yuam kev yuav tsum tau daws, tshwj tsis yog ib qho.
Ua tsis tiav kev ceev ntiag tug: Tsis lees paub (0x0b)
Nkag mus
sudo systemctl rov pib dua xiav*
kho.
Peb tseem tsis tau tiav. Peb tseem yuav xav tau ntxiv tus neeg siv "pi" rau bluetooth siv
sudo adduser pi bluetooth
pi@raspberrypi: ~ $ sudo adduser pi bluetooth Ntxiv cov neeg siv 'pi' rau pawg `bluetooth '… Ntxiv cov neeg siv pi rau pab pawg bluetooth Ua tiav.
Tom ntej no peb yuav tsum muab bluealsa lub peev xwm los ua suab ntws los ntawm Raspberry Pi lub suab cuam tshuam (uas yog 3.5 lub suab tso).
sudo nano /lib/systemd/system/bluealsa.service
Nws yuav tsum tuaj nrog
[Chav]
Nqe lus piav qhia = BluezALSA tus neeg thov yuav tsum = bluetooth.service Tom qab = bluetooth.service [Kev pabcuam] Hom = tus neeg siv yooj yim = hauv paus ExecStart =/usr/bin/bluealsa
Ntxiv
-p a2dp-qhov chaw -p a2dp-dab dej
tom qab
ExecStart =/usr/bin/bluealsa
ua
[Chav]
Nqe lus piav qhia = BluezALSA tus neeg yuav tsum tau = bluetooth.service Tom qab = bluetooth.service [Kev pabcuam] Hom = tus neeg siv yooj yim = hauv paus ExecStart =/usr/bin/bluealsa -p a2dp -source -p a2dp -sink
Txuag thiab tawm (ctrl-x, y, nkag mus).
Ces
sudo rov pib dua
Qhov no ua rau peb Bluetooth ntau dua lossis tsawg dua npaj tau. Tam sim no peb yuav khub thiab txuas rau peb Raspberry Pi.
Kauj Ruam 3: Pairing, Txuas thiab Ntseeg Siab
Tam sim no peb tau tso tawm cov hauv paus los ua Bluetooth Hais Lus. Tab sis peb tseem yuav tsum muaj peev xwm txuas mus ua suab paj nruag los ntawm nws.
Ua ntej tshaj, nkag mus
sudo bluetoothctl cov
ces
zog on
ces
luam theej duab
ib yam dab tsi zoo li no yuav tsum tuaj
pi@raspberrypi: ~ $ sudo bluetoothctl
Tus neeg sawv cev sau npe [bluetooth]# lub zog hloov pauv lub zog ntawm kev ua tiav [bluetooth]# scan ntawm Discovery pib [CHG] Controller B8: 27: EB: A2: FD: 3C Tshawb pom: yog [TSHIAB] Ntaus 60: D8: 19: C0: 2E: 41 FARTHINGSLAPTOP [TSHIAB] Ntaus A4: E4: B8: 59: BE: 8D A4-E4-B8-59-BE-8D [CHG] Ntaus A4: E4: B8: 59: BE: 8D Lub Npe: APR-BLACKBERRY [CHG] Ntaus A4: E4: B8: 59: BE: 8D Alias: APR-BLACKBERRY [CHG] Ntaus A4: E4: B8: 59: BE: 8D TxPower: 0 [CHG] Ntaus A4: E4: B8: 59: BE: 8D UUIDs: 00001800-0000-1000-8000-00805f9b34fb [CHG] Ntaus A4: E4: B8: 59: BE: 8D UUIDs: 00001801-0000-1000-8000-00805f9b34fb [CHG] Ntaus A4: E4: B8: 59: BE: 8D UUIDs: 00001200-0000-1000-8000-00805f9b34fb [CHG] Ntaus A4: E4: B8: 59: BE: 8D UUIDs: 0000113b-0000-1000-8000-00805f9b34fb [CHG] Ntaus A4: E4: B8: 59: BE: 8D UUIDs: 00001124-0000-1000-8000-00805f9b34fb [CHG] Ntaus A4: E4: B8: 59: BE: 8D UUIDs: 0000110e-0000-1000-8000-00805f9b34fb [CHG] Ntaus A4: E4: B8: 59: BE: 8D UUIDs: 0000110f-0000-1000-8000-00805f9b34fb [CHG] Ntaus A4: E4: B8: 59: BE: 8D UUIDs: 0000110c-0000-1000-8000-00805f9b34fb [CHG] Ntaus A4: E4: B8: 59: BE: 8D UUIDs: 0000110a-0000-1000-8000-00805f9b34fb [CHG] Ntaus A4: E4: B8: 59: BE: 8D UUIDs: 0000111f-0000-1000-8000 -00805f9b34fb [CHG] Ntaus A4: E4: B8: 59: BE: 8D UUIDs: 00001203-0000-1000-8000-00805f9b34fb [CHG] Ntaus A4: E4: B8: 59: BE: 8D UUIDs: 00001116-0000-1000 -8000-00805f9b34fb [CHG] Ntaus A4: E4: B8: 59: BE: 8D UUIDs: 0000112f-0000-1000-8000-00805f9b34fb [CHG] Ntaus A4: E4: B8: 59: BE: 8D UUIDs: 00001105-0000 -1000-8000-00805f9b34fb [CHG] Ntaus A4: E4: B8: 59: BE: 8D UUIDs: 00001132-0000-1000-8000-00805f9b34fb [CHG] Ntaus 60: D8: 19: C0: 2E: 41 RSSI:- 66 [bluetooth]#
hauv qhov piv txwv no peb yuav ua khub thiab txuas rau lub cuab yeej hu ua FarthingsLaptop.
Yog li (hloov chaw nyob mac nrog lub cuab yeej koj yuav txuas rau).
khub 60: D8: 19: C0: 2E: 41
[bluetooth]# khub 60: D8: 19: C0: 2E: 41
Sim ua khub nrog 60: D8: 19: C0: 2E: 41 [CHG] Ntaus 60: D8: 19: C0: 2E: 41 Txuas: yog thov thov lees paub [tus sawv cev] Paub meej tus lej cim 478737 (yog/tsis): yog [CHG] Ntaus 60: D8: 19: C0: 2E: 41 UUIDs: 00000002-0000-1000-8000-0002ee000002 [CHG] Ntaus 60: D8: 19: C0: 2E: 41 UUIDs: 00001000-0000-1000-8000-00805f9b34fb [CHG] Ntaus 60: D8: 19: C0: 2E: 41 UUIDs: 00001104-0000-1000-8000-00805f9b34fb [CHG] Ntaus 60: D8: 19: C0: 2E: 41 UUIDs: 00001105-0000-1000-8000 -00805f9b34fb [CHG] Ntaus 60: D8: 19: C0: 2E: 41 UUIDs: 00001106-0000-1000-8000-00805f9b34fb [CHG] Ntaus 60: D8: 19: C0: 2E: 41 UUIDs: 00001107-0000-1000 -8000-00805f9b34fb [CHG] Ntaus 60: D8: 19: C0: 2E: 41 UUIDs: 0000110a-0000-1000-8000-00805f9b34fb [CHG] Ntaus 60: D8: 19: C0: 2E: 41 UUIDs: 0000110b-0000 -1000-8000-00805f9b34fb [CHG] Ntaus 60: D8: 19: C0: 2E: 41 UUIDs: 0000110c-0000-1000-8000-00805f9b34fb [CHG] Ntaus 60: D8: 19: C0: 2E: 41 UUIDs: 0000110e -0000-1000-8000-00805f9b34fb [CHG] Ntaus 60: D8: 19: C0: 2E: 41 UUIDs: 00001112-0000-1000-8000-00805f9b34fb [CHG] Ntaus 60: D8: 19: C0: 2E: 41 UUIDs: 00001115-0000-1000-8000-00805f9b34fb [CHG] Ntaus 60: D8: 19: C0: 2E: 41 UUIDs: 0000111b-0000-1000-8000-00805f9b34fb [CHG] Ntaus 60: D8: 19: C0: 2E: 41 UUIDs: 0000111e-0000-1000-8000-00805f9b34fb [CHG] Ntaus 60: D8: 19: C0: 2E: 41 UUIDs: 0000111f-0000-1000-8000-00805f9b34fb [CHG] Ntaus 60: D8: 19: C0: 2E: 41 UUIDs: 0000112f-0000-1000-8000-00805f9b34fb [CHG] Ntaus 60: D8: 19: C0: 2E: 41 UUIDs: 00001304-0000-1000-8000-00805f9b34fb [CHG] Ntaus 60: D8: 19: C0: 2E: 41 Cov Kev Pab Cuam: yog [CHG] Ntaus 60: D8: 19: C0: 2E: 41 Paired: yog Pairing ua tiav
Tom qab ntawd peb tuaj yeem txuas rau lub cuab yeej.
txuas 60: D8: 19: C0: 2E: 41
Kev sib txuas tau zoo
[bluetooth]# txuas 60: D8: 19: C0: 2E: 41
Sim ua txuas mus rau 60: D8: 19: C0: 2E: 41 [CHG] Ntaus 60: D8: 19: C0: 2E: 41 Txuas: yog txuas tau zoo [CHG] Ntaus 60: D8: 19: C0: 2E: 41 ServicesResolved: yog [CHG] Ntaus 60: D8: 19: C0: 2E: 41 RSSI: -59
Tom ntej no peb yuav ntseeg lub cuab yeej yog li peb tuaj yeem txuas rau nws yam tsis muaj kev lees paub.
ntseeg 60: D8: 19: C0: 2E: 41
[bluetooth]# ntseeg 60: D8: 19: C0: 2E: 41
[CHG] Ntaus 60: D8: 19: C0: 2E: 41 Tso siab tau: yog Hloov 60: D8: 19: C0: 2E: 41 ntseeg tau ua tiav
Txog ntawm no koj yuav tsum tau txuas nrog tab sis koj yuav pom tias yog koj ua suab paj nruag, nws tsis ua si los ntawm tus hais lus txuas nrog Raspberry Pi. Qhov ntawd yog qhov peb yuav ua nyob rau theem tom ntej.
Kauj Ruam 4: Ua Si Suab Nkauj
Txog tam sim no koj yuav tsum txuas nrog koj li Raspberry Pi, tab sis tsis muaj suab paj nruag ua si los ntawm tus hais lus.
Koj tuaj yeem kho qhov no los ntawm cov lus txib
bluealsa-aplay 00: 00: 00: 00: 00: 00
Tam sim no koj yuav tsum hnov lub suab los ntawm koj tus neeg hais lus thaum koj tshaj tawm xov xwm, tab sis koj tsis xav kom ua raws cov lus txib no txhua lub sijhawm koj xav ua nkauj, yog li peb yuav ua kom nws khiav ntawm khau raj.
Nkag mus
sudo nano /etc/rc.local
Nws yuav tsum tuaj nrog qhov no.
#!/bin/sh -e
# # rc.local # # Tsab ntawv no tau ua tiav ntawm qhov kawg ntawm txhua qhov kev ua haujlwm ntau ntau # Nco ntsoov tias tsab ntawv yuav "tawm 0" ntawm kev ua tiav lossis lwm yam # tus nqi ntawm kev ua yuam kev. # # Txhawm rau pab lossis lov tes taw tsab ntawv no tsuas yog hloov qhov ua tiav # khoom. # # Los ntawm lub neej ntawd tsab ntawv no tsis ua dab tsi. # Luam tus IP chaw nyob _IP = $ (hostname -I) || muaj tseeb yog tias ["$ _IP"]; ces printf "Kuv tus IP chaw nyob yog %s / n" "$ _IP" fi tawm 0 Ente
bluealsa-aplay 00: 00: 00: 00: 00: 00
ua ntej xwb
ua ex0
yog li nws zoo li no.
#!/bin/sh -e
# # rc.local # # Tsab ntawv no tau ua tiav ntawm qhov kawg ntawm txhua qhov kev ua haujlwm ntau ntau # Nco ntsoov tias tsab ntawv yuav "tawm 0" ntawm kev ua tiav lossis lwm yam # tus nqi ntawm kev ua yuam kev. # # Txhawm rau pab lossis lov tes taw tsab ntawv no tsuas yog hloov qhov ua tiav # khoom. # # Los ntawm lub neej ntawd tsab ntawv no tsis ua dab tsi. # Luam tus IP chaw nyob _IP = $ (hostname -I) || muaj tseeb yog tias ["$ _IP"]; ces printf "Kuv tus IP chaw nyob yog %s / n" "$ _IP" fi bluealsa-aplay 00: 00: 00: 00: 00: 00: 00 tawm 0 Txuag thiab tawm (ctrl-x, y, nkag mus)
Ces
sudo rov pib dua
Thaum nws khau raj, txuas thiab ntaus nkauj!
Tam sim no koj yuav tsum muaj lub mloog pob ntseg Bluetooth ua haujlwm tau zoo!
Yog tias koj muaj lus nug dab tsi tawm hauv qab cov lus thiab kuv yuav muab rau lawv sai li kuv tuaj yeem ua tau.
Tsaug rau saib.
Pom zoo:
Peb Lub Suab Hais Lus Li Cas -- Cov Lus Qhia Ib Leeg-Kauj Ruam: 3 Kauj Ruam
Peb Lub Suab Hais Lus Li Cas || Cov Lus Qhia Ib Leeg-Ib Leeg: Loudspeaker Circuit ntxiv dag zog rau lub suab tau txais los ntawm ib puag ncig mus rau MIC thiab xa nws mus rau Tus Hais Lus los ntawm qhov ua kom muaj suab nrov tau tsim los ntawm no, Kuv yuav qhia koj peb txoj hauv kev sib txawv los ua qhov Loudspeaker Circuit siv:
Coco Tus Hais Lus - Siab Fidelity Hais Lus: 6 Cov Kauj Ruam
Coco Speaker - Cov Neeg Hais Lus Siab Zoo: Nyob Zoo Instructabler's, Siddhant ntawm no. Koj puas xav mloog lub suab zoo? Tej zaum koj yuav nyiam … Zoo … qhov tseeb txhua leej txhua tus nyiam. tsis tsuas yog muab HD suab zoo tab sis kuj " MUAJ TSHAJ Qhov muag
Tig Txhua Tus Hais Lus Rau Hauv Bluetooth Hais Lus: 4 Cov Kauj Ruam
Tig Ib Tus Neeg Hais Lus Rau Tus Hais Lus Bluetooth: Ntau xyoo dhau los nws yog ib qho rau cov neeg hais lus nqa tau kom muaj 3.5 hli nkaus thiab kom siv los ntawm AA roj teeb. Los ntawm cov qauv niaj hnub no, nws me ntsis dhau los tshwj xeeb tshaj yog lub roj teeb txij li txhua lub cuab yeej niaj hnub no muaj lub roj teeb rov tau. Lub mloog pob ntseg yog st
Txee Hais Lus W/ipod Dock (Ntu Kuv - Lub Thawv Hais Lus): 7 Cov Kauj Ruam
Txee Hais Lus W/ipod Dock (Ntu Kuv - Lub Thawv Hais Lus): Kuv tau txais ipod nano thaum lub Kaum Ib Hlis thiab txij li tau xav tau lub tshuab hais lus zoo rau nws. Ntawm kev ua haujlwm ib hnub kuv pom tias cov hais lus hauv computer kuv siv tau ua haujlwm zoo, yog li kuv tau mus rau Goodwill tom qab thiab pom qhov sib tham ntawm lub khoos phis tawj hais lus zoo rau $
Hais Lus Portable / Hais Lus ntawm Roj Teeb: 7 Cov Kauj Ruam
Hais Lus Portable / Hais Lus ntawm Roj Teeb: Nyob zoo cov neeg no yog kuv thawj zaug qhia Yog li hnub no kuv tuaj yeem qhia koj yuav ua li cas los ntawm cov laus hais lus pc rau cov hais lus ntawm lub roj teeb. Nws yog qhov yooj yim zoo nkauj thiab kuv muaj duab ntau;