Cov txheej txheem:
- Kauj ruam 1: Khoom
- Kauj ruam 2: Nruab Amazon Alexa Voice Service
- Kauj ruam 3: Nruab Google Assistant SDK
- Kauj Ruam 4: Nruab PulseAudio thiab Khiav 2 Navigators Ua Ke
Video: Tham Nrog Alexa thiab Google Assistant Ua Ke hauv Raspberry Pi: 4 Cov Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:29
Khiav Amazon Alexa thiab Google Assistant tib lub sijhawm hauv Raspberry Pi. Hu ib qho ntawm lawv lub npe, lawv qhib lawv tus kheej LEDs thiab lub suab nrov rau cov lus teb. Tom qab ntawd koj nug qee qhov kev thov thiab lawv teb nws rau koj feem. Koj tuaj yeem paub lawv tus yam ntxwv zoo.
[Tham nrog 2 Lub Suab Navigators Ua Ke (hauv Nyij Pooj)]
Nws tsis nyuaj rau nruab ob lub suab navigators hauv Raspberry Pi. Ua tib zoo Kauj Ruam ntawm Kauj Ruam Qhia yog muab hauv web rau ob leeg. Koj tsuas yog yuav tsum teeb tsa "PulseAudio" ntxiv rau tham nrog lawv ua ke. Txaus siab rau!
(*1) Tus Pi nrog 2 Navigators nkag mus rau Lub Suab Qhib Qhib. Yog tias koj nyiam, thov pov npav. Ua tsaug.
(*2) Kuv txaus siab rau Dimeiza rau nws tsab xov xwm dhau los piav ua lus Nyij Pooj.
Kauj ruam 1: Khoom
Cov Khoom Muag:
- Raspberry Pi 3
- Hwj chim Adapter: DC 5V, 2.5A
- Micro-SD Card: 16GB
- USB Microphone: Kuv siv lub microphone hauv lub koob yees duab USB pheej yig (Logitech C270).
- Qee cov LEDs
- Cov qhob cij
- Qee cov jumper xov hlau
- Hais lus lossis Lub Pob Ntseg: TV tuaj yeem siv tau ntawm HDMI chaw nres nkoj.
Kuv tau kov Raspberry Pi thawj zaug 4 lub hlis dhau los. Li no kuv tsis paub nws zoo. Lub OS uas tau teeb tsa yog Raspbian Stretch (NOOBS v.2.4.4). Kuv yuav tsis tuaj yeem muab kev daws teeb meem rau koj rau lwm OS lossis khoos phis tawj.
Kauj ruam 2: Nruab Amazon Alexa Voice Service
Ua tib zoo "cov lus qhia ib qib zuj zus" muaj nyob hauv lub vev xaib. Tsuas yog ua raws nws, koj tuaj yeem nruab Alexa Lub Suab Pabcuam SDK hauv koj tus Pi, thiab ua ib qho qauv piv txwv hauv nws. Hu rau "Alexa!"
Txhawm rau paub seb koj hu mus txog koj li Pi, tig LEDs On thiab ua suab nrov luv tau ntxiv hauv cov qauv piv txwv "/home/pi/sdk-folder/sdk-source/avs-device-sdk/SampleApp/src/UIManager.cpp".
1) Ntxiv 5 kab nrog "system (…);" hauv "tsis muaj dab tsi UIManager:: printState () {" hauv tus qauv c ++ code "UIManager.cpp", thiab khaws nws.
*******
hloov (m_dialogState) {
rooj DialogUXState:: IDLE:
system ("gpio -g hom 24 tawm");
system ("gpio -g sau 24 0");
ConsolePrinter:: prettyPrint ("Alexa tam sim no tsis ua haujlwm!");
rov qab;
rooj DialogUXState:: MLOOG:
system ("gpio -g hom 24 tawm");
system ("gpio -g sau 24 1");
system ("aplay /home/pi/sdk-folder/application-necessities/sound-files/re.wav 1>/dev/null 2>/dev/null");
ConsolePrinter:: prettyPrint ("Mloog …");
rov qab;
********
2) Rov qab mus rau "2. Tsim SDK" hauv Step by Step Guide thiab rov ua dua txhua kauj ruam mus txog "4. Khiav tus qauv app" tshwj tsis yog 3.1.
3) Luam cov ntawv luv luv "re.wav" thiab muab nws tso rau hauv "/home/pi/sdk-folder/application-necessities/sound-files".
Kauj ruam 3: Nruab Google Assistant SDK
Cov Kauj Ruam Kom Zoo Dua Hauv Phau Ntawv Qhia yog muab hauv web. Tsuas yog ua raws nws, koj tuaj yeem teeb tsa Google Assistant Lub Tsev Qiv Ntawv hauv koj Pi, thiab khiav tus qauv piv txwv hauv nws. Hu rau "OK Google!" lossis "Hav Google!"
Txhawm rau paub seb koj hu mus txog koj li Pi, tig LEDs On thiab ua suab nrov luv tau ntxiv hauv cov qauv piv txwv "/home/pi/assistant-sdk-python/google-assistant-sdk/googlesamples/assistant/library/hotword.py".
(*) Tus kws kho mob hauv Cov Lus Qhia tsis tuaj yeem hais tawm qhov nkag. Qhov tsim nyog yuav tsum tau nkag rau hauv txhua kab hauv qab no hauv sej code.
1) Ntxiv 3 kab tom qab "ntshuam json" hauv tus qauv piv txwv "hotword.py"
*******
ntshuam RPi. GPIO ua GPIO
lub sij hawm ntshuam
ntshuam subprocess
********
2) Ntxiv 2 kab tom qab "print ()" hauv "def process_event (event, device_id):" hauv cov qauv piv txwv "hotword.py".
*******
yog event.type == EventType. ON_CONVERSATION_ END_TURN_STARTED:
print () # Ntxiv 2 kab hauv qab no:
GPIO. tawm (23, 1)
subprocess.call ("aplay /home/pi/sdk-folder/application-necessities/sound-files/re2.wav", plhaub = Tseeb)
print (kev tshwm sim)
*******
3) Ntxiv 2 kab tom qab "'device_id:', assistant.device_id + '\ n')" hauv "def main ():" hauv tus qauv piv txwv "hotword.py", thiab khaws nws.
*******
nrog Assistant (daim ntawv pov thawj, args.device_model_id) ua tus pab:
txheej xwm = pab.start ()
print ('ntaus_model_id:', args.device_model_id + '\ n' +
'device_id:', assistant.device_id + '\ n') # Ntxiv 2 kab hauv qab no:
GPIO.setmode (GPIO. BCM)
GPIO.setup (23, GPIO. OUT, pib = GPIO. LOW)
*******
4) Luam cov ntawv luv luv "re2.wav" thiab muab nws tso rau hauv "/home/pi/sdk-folder/application-necessities/sound-files"
Kauj Ruam 4: Nruab PulseAudio thiab Khiav 2 Navigators Ua Ke
Qhov kawg ntawm cov kauj ruam qub, koj tuaj yeem khiav txhua lub suab navigators feem; Alexa thiab Google Assistant. Txawm li cas los xij koj tsis tuaj yeem khiav ob tus neeg tsav nkoj no tib lub sijhawm. Yog li nruab "PulseAudio". Koj tuaj yeem khiav ob tus neeg tsav nkoj no tib lub sijhawm.
********
sudo apt-tau nruab pulseaudio
********
[ceeb toom]
Koj yuav tsum khiav Alexa thawj zaug, thiab hu rau Google Assistant tom qab. Yog tias koj xav khiav tsuas yog Google Assistant, nres PulseAudio ua ntej hu nws.
********
pulseaudio -k
********
Yog tias koj hu tus navigator thaum lwm tus hais lus hais lus, koj Pi yuav tsis meej pem. Yog li koj yuav tsum tau tos lossis cuam tshuam qhov tom kawg kom hais lus tas. Txawm li cas los xij, nws yog qhov nthuav los daws qhov tsis meej pem Pi. Txaus siab rau!
Pom zoo:
SASSIE: Cov Txheej Txheem rau Kev Txaus Siab Tsis Txaus Siab thiab Kev Sib Tham Sib Tham: 5 Cov Kauj Ruam
SASSIE: Cov Txheej Txheem rau Kev Txom Nyem Tsis Txaus Siab thiab Kev Sib Tham Sib Tham: SASSIE yog lo lus teb rau lo lus nug peb txhua tus tau nug peb tus kheej thaum muaj kev ntsiag to txawv ntawm ib qho hauv peb lub neej, "Kuv puas yuav tham tom ntej?" Zoo tam sim no koj tsis tas yuav txhawj xeeb vim tias SASSIE tau tsim tshwj xeeb los lees paub qhov txawv txav uas ntsiag to
THIAB LUB NEEJ !! (Sib tham sib tham rooj sib tham): 4 Kauj Ruam
THIAB LUB NEEJ !! (sib tham sib tham txog Thruth Table): Nyob zoo cov phooj ywg, Kuv vam tias koj txhua tus nyob hauv koj lub tsev zoo thiab xav tsis thoob dab tsi ntawm cov ntaub ntawv uas muaj ?? Nkag siab cov rooj vag logic yog qhov tseem ceeb heev rau ob leeg
Ntse Suab Nkauj hauv Chav Dej thiab Da Dej Nrog Raspberry Pi - Sib Koom Ua Ke Hauv Chav, Tswb, Khawm Tswj thiab Kev Siv Tsev Hauv Tsev: 7 Kauj Ruam
Ntse Suab Nkauj hauv chav pw thiab Da Dej Nrog Raspberry Pi - Sib Koom Ua Ke Hauv Chav, Tswb, Khawm Tswj thiab Kev Siv Tsev Hauv Tsev: Niaj hnub no peb xav muab ob qho piv txwv txog yuav ua li cas koj tuaj yeem siv Raspberry Pi nrog peb Max2Play software rau hauv tsev automation: hauv chav dej thiab chav pw . Ob txoj haujlwm zoo ib yam nyob hauv cov suab paj nruag siab ncaj los ntawm ntau qhov chaw tuaj yeem rub tawm los
Kev Sib Tham Txog Qhov Kub thiab Vaum Sensor - Si7021 thiab Me Phooj Ywg Tham Nrog: 3 Kauj Ruam
Kev Sib Tham Txog Qhov Kub thiab Vaum Sensor - Si7021 thiab Me Tus Phooj Ywg Tham Nrog: Tus " Tus Me Phooj Ywg Tham " yog lub cuab yeej me me uas tso cai rau koj ntxiv cov suab yooj yim tso rau koj cov phiaj xwm Arduino. Nws muaj cov lus txwv ntawm 254 lus thiab tuaj yeem txuas nrog Arduino lossis lwm lub microcontrollers ntawm SPI. Tus Me Buddy T
Tham nrog De thiab Artificial Intelligence Tham Nrog Cleverbot: 14 Cov Kauj Ruam (nrog Duab)
Tham nrog De thiab Artificial Intelligence Tham Nrog Cleverbot: Ntawm no kuv sim tsis tsuas yog lub suab hais kom ua tab sis kuj yog Artificial Intelligence Tham nrog Lub Computer siv Cleverbot. Qhov tseeb lub tswv yim tuaj thaum pom cov menyuam sib xyaw xim hauv lub thawv xim thaum coj xim ntawm ib xim mus rau qhov ze tshaj plaws. Tab sis thaum kawg ua raws