Cov txheej txheem:

Lub Suab Tswj Dhia Dhia Jack- Google Voice AIY Version: 3 Kauj Ruam
Lub Suab Tswj Dhia Dhia Jack- Google Voice AIY Version: 3 Kauj Ruam

Video: Lub Suab Tswj Dhia Dhia Jack- Google Voice AIY Version: 3 Kauj Ruam

Video: Lub Suab Tswj Dhia Dhia Jack- Google Voice AIY Version: 3 Kauj Ruam
Video: 10 самых АТМОСФЕРНЫХ мест Дагестана. БОЛЬШОЙ ВЫПУСК #Дагестан #ПутешествиеПоДагестану 2024, Kaum ib hlis
Anonim
Lub Suab Tswj Dhia Dhia Jack- Google Voice AIY Version
Lub Suab Tswj Dhia Dhia Jack- Google Voice AIY Version
Lub Suab Tswj Dhia Dhia Jack- Google Voice AIY Version
Lub Suab Tswj Dhia Dhia Jack- Google Voice AIY Version
Lub Suab Tswj Dhia Dhia Jack- Google Voice AIY Version
Lub Suab Tswj Dhia Dhia Jack- Google Voice AIY Version
Lub Suab Tswj Dhia Dhia Jack- Google Voice AIY Version
Lub Suab Tswj Dhia Dhia Jack- Google Voice AIY Version

Yog li koj tau txais cov khoom AIY lub suab rau Christmas, thiab tau ua si nrog nws, ua raws cov lus qhia. Nws lom zem, tab sis tam sim no?

Txoj haujlwm tau piav qhia hauv qab no nthuav tawm cov cuab yeej yooj yim uas tuaj yeem tsim siv AIY lub suab HAT rau Raspberry Pi. Nws siv Google lub suab lees paub system los tswj LEDs thiab ob lub servos, tsav caj npab thiab txhais ceg ntawm lub dhia dhia los ntawm cov iav yooj yim heev.

Lub software ua haujlwm tom qab yog kev hloov kho ntawm servo_demo.py tsab ntawv, raws li nws tau piav qhia hauv AIY lub suab khoom siv phau ntawv. Tsuas yog ua raws cov lus qhia muab rau teeb tsa nyuaj- thiab software. Cov cuab yeej nws tus kheej yog ib qho yooj yim los tsim thiab yuav tsum tsis muaj ntau txuj ci tes. Ntxiv nrog rau rab riam txiav, laum thiab cov laug cam yuav pab tau.

Yog tias koj qhib lub suab lees paub nrog lub ntsej muag ntawm koj txhais tes thiab hais tias 'txhais tes nce' lub dhia dhia yuav tsa tes thiab txhais ceg, 'txhais tes nruab nrab' yuav txav ob qho kev pabcuam mus rau txoj haujlwm nruab nrab thiab ntawm 'txhais tes nqis' txhais tes thiab txhais ceg yuav yuav qis. Ntawm 'sab laug' txhais tes laug thiab txhais ceg yuav raug tsa thiab ntawm "sab xis" tus sab xis qis, ntawm 'sab xis' rov qab ua ke. "Dance", yuav ua rau nws seev cev, yam tsawg kawg yog yam. Nws tseem tab tom tham, thov saib ntawm daim vis dis aus txuas.

Yog li nrog kev mob siab rau me me, koj tuaj yeem tsim koj tus kheej kev seev cev, sib tham thiab hu nkauj neeg hlau.

Txhawm rau ua kom yooj yim nws siv tshwj xeeb los ntawm cov menyuam yaus me, thiab txhawm rau txhim kho qhov "khawv koob", lub pob ntawm AIY lub thawv tau hloov los ua qhov ntsuas los ntawm qhov ntsuas qhov sib thooj. Rau nws qhov yooj yim, Kuv tau siv lub ntsuas nrug deb ntawm qhov tawg los ntawm Pololu uas lees paub yog tias ib yam khoom ze dua 5 cm, thiab tuaj yeem siv tau zoo li lub pob. LEDs qhia thaum lub cuab yeej tos kev xaj, mloog lossis "xav". Servos, sensor thiab LEDs raug tswj los ntawm GPIOZero software tsev qiv ntawv.

Tus qauv tau tsim los ntawm Forex, PVC ua npuas ncauj daim hlau, uas tuaj yeem txiav tau yooj yim heev nrog rab riam txiav thiab kaw, tab sis kuj tseem ruaj khov. Xav tias dawb los tsim qhov loj dua, zoo dua, txhim kho lossis zoo nkauj dua, tab sis nws yuav zoo yog tias koj yuav sau thiab nthuav qhia koj qhov kev txhim kho.

Koj tuaj yeem siv ob sab ntawm lub cev, nyob ntawm seb koj xav nthuav qhia cov khoom txav mus los lossis muaj qhov zoo nkauj, tsim rau menyuam yaus. --------- "Hampelmann" yog lus German rau "dhia dhia", muaj qee qhov ntsiab lus.

Kauj Ruam 1: Cov Khoom Siv

Cov Khoom Siv
Cov Khoom Siv
Cov Khoom Siv
Cov Khoom Siv

Raspberry Pi 3; 32 £ ntawm Pimoroni, UK

AIY lub suab khoom; 25 £ ntawm Pimoroni, UK

Pololu digital nrug sensor tawg nrog Ntse sensor, 5 cm; 5.90 € ntawm Exp-tec.de

2g9g siv

Ob lub LEDs dawb thiab ib tus tiv thaiv

Qee lub taub hau thiab jumper cables

2 hli Forex phaj, 250 x 500 hli; 1.70 € ntawm Modulor, Berlin, Lub Tebchaws Yelemees

M3 ntsia hlau, txiv ntseej thiab tshuab ntxhua khaub ncaws, txhawm rau txuas txhua qhov txav chaw. Kuv siv rau 10 thiab plaub 16 mm Nylon ntsia hlau.

Rau M2 ntsia hlau thiab txiv ntseej, txhawm rau txhim kho servos rau cov phaj thiab txuas cov servos caj npab thiab lub zog.

Ob peb tee ntawm cov kua nplaum yas

Kauj Ruam 2: Sib dhos thiab Siv Cov Khoom Siv

Sib dhos thiab Siv Cov Khoom Siv
Sib dhos thiab Siv Cov Khoom Siv
Sib dhos thiab Siv Cov Khoom Siv
Sib dhos thiab Siv Cov Khoom Siv
Sib dhos thiab Siv Cov Khoom Siv
Sib dhos thiab Siv Cov Khoom Siv

Hais txog AIY lub suab khoom nws tus kheej, tsuas yog ua raws cov lus qhia hauv cov lus piav qhia uas los nrog cov khoom siv, suav nrog ntu hais txog kev pabcuam. Kuv yuav pom zoo kom txuas ob peb tus lej taub hau rau cov chaw nres nkoj servo ntawm AIY lub suab tawm, yog li koj tuaj yeem txuas cov servos, sensor thiab LEDs yooj yim heev nrog HAT.

Hais txog qhov dhia dhia, koj tuaj yeem siv cov duab kos kuv muab ntawm no raws li svg- thiab PDF-cov ntaub ntawv ua tus qauv, lossis tsuas yog hloov kho lawv raws li koj tus kheej lub tswv yim. Koj tuaj yeem nyiam khaws cov txheej txheem yooj yim ntawm lub iav tsav ob txhais ceg thiab txhais caj npab ntawm lub dhia dhia, kom ntseeg tau tias qhov nrug nruab nrab ntawm qhov taw qhia piv txwv thiab lub iav zoo ib yam ntawm qhov kev pabcuam, caj npab thiab txhais ceg.

Xwb, koj kuj tseem tuaj yeem tsim kho ib qho yog txhais caj npab thiab txhais ceg tau tsav ncaj qha los ntawm plaub qhov kev sib cais, lossis los ntawm cov iav siab dua.

Siv daim duab, txiav daim los ntawm Forex, duab los qhia los yog plywood phaj thiab tho qhov ntawm txoj haujlwm tsim nyog. Muab cov khoom sib nrug deb mus rau cov ntsiab lus piv txwv ntawm caj npab thiab txhais ceg, ua kom ntseeg tau zoo ntawm cov qhov.

Kho cov servos thiab cov khoom txav mus rau lub hauv paus phaj. Ntxiv qhov ntsuas qhov nrug thiab LED raws li qhia. Cov kev pabcuam tau kho nrog M2 ntsia hlau, txhua qhov txav nrog M3 ntsia hlau. Kuv siv Nylon M3 screws, tab sis tsuas yog rau qhov laj thawj zoo nkauj.

Txheeb xyuas yog tias cov caj npab servo tau muab tso rau hauv txoj haujlwm nruab nrab. Txuas servo caj npab thiab zog, Kuv siv M2 screws rau lub hom phiaj no.

Txuas cov servos, LEDs thiab qhov ntsuas qhov nrug mus rau qhov kev pabcuam txuas ntawm AIY board. Koj yuav xav tau qee qhov txuas hluav taws xob/jumper cable. Kuv txuas tus sab laug rau "servo0" (GPIO 26) txoj cai servo rau "servo2" (GPIO 13), LEDs rau "servo5" (GPIO 24), thiab lub sensor rau "servo3" (GPIO 5) ntawm AIY lub suab HAT

Luam qhov muab "Hampelmann.py" cov ntaub ntawv mus rau AIY "src" subfolder thiab ua ncaj qha rau ua haujlwm rau leej twg. Txhawm rau ua li ntawd, koj tuaj yeem xaiv cov ntawv hauv tus thawj tswj ntaub ntawv, tom qab ntawv nyem rau thiab xaiv Cov Khoom, xaiv Tso Cai, mus rau Kev Ua Haujlwm, xaiv ~ leej twg. Los yog sau "chmod +x src/Hampelmann.py" hauv dev console.

Txheeb xyuas tias txhua yam tau teeb tsa hauv qhov chaw thiab tsau, lossis txav tau thaum xav tau. Qhib Dev kab hais kom ua, sau "src/Hampelmann.py" thiab pib qhov program. Yog tias koj txav koj txhais tes lossis ntiv tes nyob rau pem hauv ntej ntawm lub ntsuas qhov nrug, chav AIY yuav nug xaj thiab LEDs yuav ntsais. Kev xaj xaj yog "sab xis/sab laug/txhais tes nce/nqis/nruab nrab", "seev cev", "LED qhib/tawm" thiab "hais lus zoo".

Ua si. Tsiv koj txhais tes rau ntawm lub ntsej muag lub ntsej muag, hais lus thaum raug nug, thiab muab lub cuab yeej siv sijhawm me ntsis los teb. Latency yog qhov siab dua. Crtl+C lossis "Goodbye" yuav tso tseg txoj haujlwm.

Koj tuaj yeem hloov kho cov ntaub ntawv siv Nano lossis lwm cov ntawv sau yooj yim.

Cov Lus Cim: Thov nco ntsoov tias qee cov lus thiab cov lus tau lees paub tias yog cov lus pib nrog tsab ntawv loj, xws li 'Chaw' lossis 'Qhov Chaw Zoo', zoo li lwm qhov tsis yog, xws li 'Tiag tiag'. Koj yuav tsum siv daim ntawv qhia meej uas tau muab rov qab los ntawm lub suab lees paub lub suab los ua qee qhov kev nqis tes ua.

Kauj Ruam 3: Tus Python Script

Raws li tau hais ua ntej, tsab ntawv yog ua raws servo_demo.py tsab ntawv los ntawm AIY lub suab qhia, nrog qee qhov ntxiv. Thawj qhov ntawv yog Hampelmann.py cov ntaub ntawv koj yuav pom txuas nrog. AngularServo los ntawm GPIOZero tso cai txwv kev ua haujlwm ntawm servo thiab txhawm rau txheeb xyuas qhov tseeb tias yuav txav mus deb npaum li cas. Thiab lub cuab yeej tseem tuaj yeem hais lus, tab sis tsis nkag siab (?), Lus Askiv, German, Italis, Fabkis thiab Spanish. Hauv qab no koj pom Hampelmann2.py tsab ntawv, nrog lub suab Askiv, thiab me ntsis ntawm Italis thiab German. Thov nco ntsoov tias koj yuav tsum ua kom cov ntawv sau ua haujlwm kom khiav tau lawv.

"! los ntawm gpiozero ntshuam AngularServo los ntawm gpiozero ntshuam khawm los ntawm lub sijhawm ntshuam pw def lub ntsiab (): lees paub = aiy.cloudspeech.get_recognizer () lees paub. Center ') # cov tsiaj ntawv loj muaj nyob rau ntawm lub hom phiaj recognizer.expect_phrase (' sab laug ') recognizer.expect_phrase (' sab laug ') lees paub. ('txhais tes nqis') recognizer.expect_phrase ('txhais tes Center') recognizer.expect_phrase ('Dance') recognizer.expect_phrase ('LED rau') recognizer.expect_phrase ('LED tawm') recognizer.expect_phrase ('goodbye') aiy.audio.get_recorder (). pib () servo0 = AngularServo (26, min_angle = -40, max_angle = 40) # 1st txuas lossis, GPIO 26 servo2 = AngularServo (13, min_angle = -40, max_angle = 40) # thib txuas, GPIO 13 coj0 = LED (24) # LEDs txuas nrog rau servo5/GPIO 24 nrug = Khawm (5) # nrug deb txuas nrog rau servo3/GPIO 05 # lwm tus: GPIO 6 ntawm servo1, 12 ntawm servo4 aiy.audio.say ("Nyob zoo!",) aiy.audio.say ("Txhawm rau pib, txav koj txhais tes ze rau lub sensor",) thaum Muaj Tseeb: led0.on () # LEDs ntawm kev luam tawm ("Txhawm rau qhib lub suab paub, txav ib txhais tes ze rau qhov ntsuas qhov deb, tom qab ntawd hais lus") luam tawm ('Cov ntsiab lus xav tau yog: txhais tes/sab laug/sab xis/nce/nqis,') print ('LED rau/tawm, seev cev thiab hais lus zoo.') luam tawm () nrug.wait_for_press () luam tawm ('Mloog …') aiy.audio.say ("Thov muab koj xaj",) led0.blink () # lub teeb blink text = recognizer.recognize () yog tias tsis muaj: aiy.audio.say ('Thov txim, kuv tsis hnov koj.',) else: print ('Koj hais "', text, '"') # Cia koj xyuas cov txheej txheem txhais lus yog 'txoj cai nce' hauv cov ntawv: luam tawm ('Tsiv servo0 mus rau txoj haujlwm siab tshaj') servo0.angle = 35 elif 'txoj cai nqes' hauv cov ntawv: luam tawm ('Tsiv servo0 mus rau txoj haujlwm yam tsawg kawg nkaus ') servo0.angle = -35 elif' Right Center 'hauv cov ntawv: #cov lus raug yog qhov tseem ceeb luam tawm (' Tsiv servo0 mus rau txoj haujlwm nruab nrab ') servo0.angle = 0 elif' sab laug 'hauv cov ntawv: luam tawm (' Tsiv servo2 mus rau qhov chaw siab tshaj ') servo2.angle = -35 elif' sab laug 'hauv cov ntawv: luam tawm (' Tsiv servo2 mus rau txoj haujlwm tsawg kawg ') servo2.angle = 35 elif' sab laug Center 'hauv cov ntawv: luam tawm (' Tsiv servo2 rau txoj haujlwm nruab nrab ') servo2.angle = 0 elif' tsa tes 'hauv cov ntawv: luam tawm (' Tsiv servo2 mus rau txoj haujlwm siab tshaj ') servo2.angle = -35 servo0.angle = 35 elif' txhais tes nqis 'hauv cov ntawv: luam tawm (' Tsiv servo2 rau txoj haujlwm tsawg kawg ') servo2.angle = 35 servo0.angle = -35 elif' txhais tes Center 'hauv cov ntawv: luam tawm (' Tsiv servo2 mus rau txoj haujlwm nruab nrab ') servo2.angle = 0 servo0.angle = 0 elif' LED tawm ' hauv cov ntawv nyeem: luam tawm ('hloov tawm sab nraud LED 0') led0.off () elif 'LED rau' hauv cov ntawv: luam tawm ('hloov ntawm sab nraud LED 0') coj0.on () # lub teeb elif 'dance' hauv cov ntawv: luam tawm ('tam sim no ua las voos tus lej ib') aiy.audio.say ("Zoo, kuv yuav sim kuv qhov zoo tshaj plaws!",) led0.on () # teeb rau rau kuv hauv ntau (3): servo0.angle = 0 servo2.angle = 0 pw (1) servo0.angle = 35 servo2.angle = -35 pw tsaug zog (1) servo0.angle = 0 servo2.angle = -35 pw tsaug zog (1) servo0.angle = -25 servo2.angle = 0 pw (1) servo0.angle = 30 servo2.angle = 20 pw tsaug zog (1) servo0.angle = 0 servo2.angle = 0 led0.off () # teeb tawm elif 'nyob zoo' hauv cov ntawv: aiy.audio.say ("Nyob Zoo",) aiy.audio.say ('Tuaj txog', 'aiy.audio.say (' Auf Wiedersehen ',) servo0.angle = 0 servo2.angle = 0 led0.off () pw tsaug zog (3) print ('bye!') so lwm yam: print ('tsis muaj lo lus tseem ceeb pom!') aiy.audio.say ("Thov txim, kuv tsis nkag siab koj",) yog _name_ == ' _main_ ': lub ntsiab ()

Pom zoo: