Cov txheej txheem:

DIY Google Tsev Nrog Bluetooth Hais Lus ntawm Raspberry Pi Zero Docking Hub: 7 Kauj Ruam (nrog Duab)
DIY Google Tsev Nrog Bluetooth Hais Lus ntawm Raspberry Pi Zero Docking Hub: 7 Kauj Ruam (nrog Duab)

Video: DIY Google Tsev Nrog Bluetooth Hais Lus ntawm Raspberry Pi Zero Docking Hub: 7 Kauj Ruam (nrog Duab)

Video: DIY Google Tsev Nrog Bluetooth Hais Lus ntawm Raspberry Pi Zero Docking Hub: 7 Kauj Ruam (nrog Duab)
Video: 10 самых АТМОСФЕРНЫХ мест Дагестана. БОЛЬШОЙ ВЫПУСК #Дагестан #ПутешествиеПоДагестану 2024, Kaum ib hlis
Anonim
DIY Google Tsev Nrog Bluetooth Hais Lus ntawm Raspberry Pi Zero Docking Hub
DIY Google Tsev Nrog Bluetooth Hais Lus ntawm Raspberry Pi Zero Docking Hub
DIY Google Tsev Nrog Bluetooth Hais Lus ntawm Raspberry Pi Zero Docking Hub
DIY Google Tsev Nrog Bluetooth Hais Lus ntawm Raspberry Pi Zero Docking Hub

Peb muaj cov lus qhia ntawm DIY Amazon Echo Alexa - Alexa Voice Assistant ntawm Raspberry Pi Zero Docking Hub. Lub sijhawm no peb xav qhia koj yuav tsim DIY Google Tsev li cas. Hauv cov lus qhia no, peb yuav qhia koj yuav ua li cas teeb tsa thiab teeb tsa Google Assistant ntawm Pi Zero W nrog MakerSpot's Raspberry Pi Zero Docking Hub thiab hais lus Bluetooth.

Cia peb pib.

Kauj Ruam 1: Tau Cov Khoom No

Cov no yog cov khoom koj xav tau:

  1. 1x Raspberry Pi Zero W.
  2. 1x Raspberry Pi Zero Docking Hub
  3. 1x HDMI saib
  4. 1x HDMI cable (thov nco ntsoov Pi Zero W xav tau lub mini-HDMI txuas)
  5. 1 x 5v USB 1 A Power Adapter
  6. 1 x micro USB cable
  7. 1 x USB keyboard
  8. 1x USB nas
  9. 1x Mini-Microphone Rau Txawb Xov Tooj/Tablet
  10. 1x Bluetooth hais lus
  11. 1 x 8G micro SD daim npav
  12. PC (txhawm rau ua kom pom daim npav SD nrog Raspbian OS duab)

Kauj Ruam 2: Npaj SD Card Nrog Qhov Tseeb Raspbian OS (Ncab)

Nws yuav yog lub tswv yim zoo los pib nrog Raspbian OS tshiab. Muaj ob peb txoj hauv kev los npaj Raspbian OS tshiab ntawm daim npav SD. Tab sis kuv pom tias siv Etcher nrog cov duab Raspbian tag nrho yog qhov ua tau zoo thiab tsis tshua muaj qhov ua yuam kev.

  1. Rub tawm thiab teeb tsa Etcher (https://etcher.io/) rau koj lub PC host.
  2. Rub tawm qhov tseeb Raspbian (Ncab) duab los ntawm https://downloads.raspberrypi.org/raspbian/images/… SD rau hauv koj lub PC
  3. Qhib Etcher, xaiv cov duab rub tawm, tom qab ntawd daim npav SD, thiab nyem Flash!

Thaum cov duab tau npaj tseg, tshem daim npav kom nyab xeeb thiab npaj rau theem tom ntej.

Kauj Ruam 3: Teeb Pi thiab Docking Hub

Teeb tsa Pi thiab Docking Hub
Teeb tsa Pi thiab Docking Hub
Teeb tsa Pi thiab Docking Hub
Teeb tsa Pi thiab Docking Hub

Koj yuav tsum teeb tsa koj Pi Zero W ntawm Raspberry Pi Zero Docking Hub. Muaj 4 txheej ntawm cov ntsia hlau thiab kev sawv ntsug thiab nws yuav siv sijhawm tsawg dua li ib feeb los sib sau ua ke.

Ntxig daim npav SD npaj rau hauv Pi Zero W. Txuas koj lub monitor mus rau Pi Zero W's HDMI chaw nres nkoj (yuav tsum ua kom tiav ua ntej lub zog Pi), txuas USB keyboard thiab nas thiab thaum kawg txuas lub microphone. Peb tab tom siv Saramonic Mini Directional Microphone zoo rau Smart Phone.

Txhawm rau ua kom muaj zog, txuas 5v USB fais fab cable rau lub zog txuas ntawm lub chaw nres nkoj (Tsis yog PWR PORT ON THE PI). Koj yuav tsum pom Raspbian OS ib txwm los ntawm tus saib.

Kauj ruam 4: Configure Pi

Configure Pi
Configure Pi
Configure Pi
Configure Pi
Configure Pi
Configure Pi

Teeb WiFi

Sab laug nas nias lub WiFi icon nyob rau sab saum toj. Xaiv koj lub network txuas. Koj tsuas yog yuav tsum tau ua ib zaug tshwj tsis yog lub network teeb tsa tau hloov pauv lossis xav tau hloov pauv.

Lov tes taw HDMI/Analog Audio

Cov kauj ruam no tseem ceeb kom tau txais Raspberry Pi Zero Docking Hub suab los ua haujlwm nrog Google Assistant software.

Pib lub davhlau ya nyob twg thiab kho /boot /config.txt

sudo nano /boot /config.txt

Lov tes taw analog thiab hdmi suab los ntawm kev sau '#' nyob rau hauv pem hauv ntej ntawm kab hauv qab no hauv cov ntawv:

#dtparam = audio = on

Nias ctrl-x, y, thiab nkag mus rau txuag.

Pab kom SSH/VNC (Tsis teb los tau)

Yog tias koj tsis xav siv lub saib, keyboard, thiab nas thaum pib tom ntej, ua kom cov kev xaiv no tso cai rau koj nkag mus rau Pi. Cov kev xaiv no nyob hauv Preference/Raspberry Pi Configuration, tom qab ntawd mus rau Interfaces thiab kos cim SSH thiab VNC xaiv.

Rov pib Pi kom coj qhov teeb tsa ua haujlwm.

Teeb Bluetooth Hais Lus

Tom qab rov pib dua thiab lub vijtsam duab rov qab los, ua ke nrog koj tus hais lus Bluetooth.

  1. Mus rau lub cim Bluetooth ntawm lub tshuab raj sab saum toj, qhib Bluetooth thiab tom qab ntawd ntxiv Bluetooth ntaus ntawv.
  2. Muab tus hais lus Bluetooth tso ua ke
  3. Koj yuav tsum pom tus hais lus pom. Qhib tus hais lus nkag thiab nyem Pair.
  4. Koj yuav tau txais cov lus ua tau zoo tab sis tus hais lus tseem tsis tau txuas nrog. Mus rau tus hais lus icon ntawm lub tshuab raj sab saum toj. Nyem rau ntawm tus hais lus Bluetooth. Koj tus neeg hais lus yuav tsum tsim lub suab nrov lossis lub suab ceeb toom los qhia tias Bluetooth txuas tau ua tiav.

Hloov Suab Teeb

Tom qab tus neeg hais lus Bluetooth txuas nrog, cov ntaub ntawv.asoundrc yuav tsim nrog cov ntaub ntawv hais lus Bluetooth hauv nws. Koj yuav tsum tau hloov kho cov ntaub ntawv no los teeb tsa lub built-in microphone ntawm lub docking hub.

Tus thawj ~/.asoundrc cov ntaub ntawv zoo li no:

pi@raspberrypi: ~ $ miv ~/.asoundrc

pcm.! default {type plug slave.pcm {ntaus bluealsa ntaus ntawv "40: 00: 88: 00: 18: 0E" profile "a2dp"}} ctl.! default {type bluealsa}

Koj yuav tsum hloov kho nws kom zoo li hauv qab no. Koj daim ntawv theej ntawm.asoundrc yuav tsum zoo ib yam li hauv qab no tshwj tsis yog Bluetooth chaw nyob "40: 00: 88: 00: 18: 0E", uas yuav tsum yog los ntawm koj li qub.

pwm! default {

ntaus asym capture.pcm "mic" playback.pcm "speaker"} pcm.mic {ntaus ntsaws qhev {pcm "hw: 1, 0"}} pcm.speaker {ntaus plug slave.pcm {ntaus bluealsa ntaus ntawv "40:00: 88: 00: 18: 0E "profile" a2dp "}}

Thaum kawg, khaws daim ntawv theej rau /etc/asound.conf thiab tiv thaiv kom tsis txhob sau dua

sudo cp ~/.asoundrc /etc/asound.conf

chmod a-w ~/.asoundrc

Kauj ruam 5: Nruab Google Assistant Software

Npaj Google Project thiab Account

Ua ntej koj nruab Google Assistant software, koj yuav tsum teeb tsa txoj haujlwm tsim tawm thiab teeb tsa tus account. Nyem qhov txuas no thiab ua raws cov kauj ruam muaj. Thaum ua tiav, rov qab los ntawm no.

Teeb ib puag ncig Virtual

Qhib lub davhlau ya nyob twg thiab ua raws cov kauj ruam los teeb tsa ib puag ncig virtual

sudo apt-tau hloov tshiab

sudo apt-tau nruab python3-dev python3-venv python3 -m venv env env/bin/python -m pip nruab pip setuptools-hloov kho qhov chaw env/bin/qhib

Nruab Ntau Lub Tsev Qiv Ntawv Ua Ntej Ua Ntej

Nyob rau tib lub davhlau ya nyob twg, ntaus:

sudo apt-tau nruab portaudio19-dev libffi-dev libssl-dev

pip nruab log

Nruab Google Assistant SDK

Ntawm tib lub davhlau ya nyob twg, teeb tsa Google Assistant SDK thiab cov cuab yeej oauth. Qhov lus txib kawg xav kom cov neeg siv khoom zais cov ntaub ntawv tsim thaum npaj Google Project thiab tus as khauj.

nab hab sej -m pip nruab google-assistant-sdk [piv txwv] pip nruab-hloov kho google-auth-oauthlib [cuab yeej]

google-oauthlib-tool -client-secrets path/to/client_secret_XXXXX.json --scope https://www.googleapis.com/auth/assistant-sdk-prototype --save --headless

Txheeb Xyuas Nws

Google Assistant yuav tsum ua haujlwm ntawm qhov no. Koj tuaj yeem txheeb xyuas nws los ntawm kev tshaj tawm cov lus txib hauv qab no.

googlesamples-pab-pushtotalk

Cov kauj ruam tom ntej yuav txhim kho lub tshuab tsim lo lus - snowboy - yog li koj tsis tas yuav nias nkag mus qhib.

Kauj Ruam 6: Nruab Snowboy Wake Word Engine

Clone Snowboy repository raws li hauv qab no:

ua -p ~/Kev Txhim Kho/Pabcuam

cd ~/Kev txhim kho/Pab git clone

Txhawm rau ua Snowboy ua haujlwm nrog Raspbian Stretch, koj yuav tsum rov tsim kho _snowboydetect.so rau nab hab sej 3

sudo apt-tau nruab swig3.0 python-pyaudio python3-pyaudio soxsudo libatlas-base-dev

pip nruab pyaudio sudo ln -s /usr/bin/swig3.0/usr/local/bin/swig cd ~/Kev txhim kho/Pab/snowboy/swig/Python3 ua

Tam sim no koj tuaj yeem khiav Google Assistant siv "OK Google" cov lus tsa.

cd ~/Kev Txhim Kho/Pabcuam/snowboy/piv txwv/Python3

nab hab sej pab_wrapper.py cov peev txheej/OK / google.pmdl

Daim ntawv "OK Google" tsim cov lus ua qauv yog tus qauv tus kheej uas yuav tsis ua haujlwm zoo rau koj. Yog tias koj pom cov lus tsa suab tsis ua haujlwm zoo, koj yuav txiav txim siab los qhia koj tus kheej cov qauv thiab hloov cov ntawv "OK google.pmdl". Mus rau https://snowboy.kitt.ai/ los qhia koj tus qauv. Koj tseem tuaj yeem xaiv koj tus kheej cov lus tsa suab - nws tsis tas yuav yog "OK Google".

Kauj Ruam 7: OK Google, Hu Nkauj

Nrog koj zoo siab! Hais "OK Google" (lossis yam lus twg uas koj tau teeb tsa), tos rau Ding sai, tom qab ntawd nug Google Assistant nrog koj cov lus nug.

Yog tias koj tau qhib SSH (lossis VNC server), koj tuaj yeem rov pib Pi thiab khiav Google Assistant software tsis muaj lub taub hau (tsis muaj lub saib/keyboard/nas). Hauv koj lub PC pib lub davhlau ya nyob twg SSH thiab txuas rau Pi.

Ua ntej, ua rau Pi Bluetooth kom pib txuas tus hais lus (tsuas yog xav tau ua ib zaug).

ncha -e "txuas" | bluetoothctl

ncha -e "ntseeg" | bluetoothctl

Txhua lub sijhawm Pi rov pib dua, nws tuaj yeem txuas mus rau tus hais lus, txawm li cas los xij, tsuas yog thaum tus hais lus tau tawm thiab ua haujlwm ib yam nkaus. Tom qab ntawd ua raws cov theem hauv qab no kom pib Google Assistant.

source ~/env/bin/qhib

cd ~/Kev Txhim Kho/Pabcuam/snowboy/piv txwv/Python3 python assistant_wrapper.py cov peev txheej/OK / google.pmdl

Pom zoo: