Cov txheej txheem:
- Khoom siv
- Kauj ruam 1: Tsim Ib Yam Dab Tsi Channel
- Kauj Ruam 2: Siv IFTTT App
- Kauj ruam 3: Thaum kawg Pib rau Code
Video: Google Assistant Raws Li LED Tswj Siv Raspberry Pi: 3 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:24
Hav!
Hauv txoj haujlwm no, peb yuav siv Google Assistant raws li kev tswj hwm ntawm LED siv Raspberry Pi 4 siv HTTP hauv Python. Koj tuaj yeem hloov lub LED nrog lub teeb pom kev (pom tseeb tsis yog lus, koj yuav xav tau lub teeb hluav taws xob sib txuas hauv nruab nrab) lossis lwm yam khoom siv hauv tsev yog li qhov haujlwm no tuaj yeem ua tiav ntxiv rau lub hom phiaj siv hluav taws xob hauv tsev.
Khoom siv
Yam koj yuav xav tau rau qhov haujlwm no:
1. Raspberry Pi
2. LED
3. Jumper xov hlau -2 (txiv neej rau poj niam)
4. Cov qhob cij
5. IFTTT app (https://play.google.com/store/apps/details?id=com.ifttt.ifttt&hl=en_IN)
6. Thingspeak tus account (https://thingspeak.com/)
Qee qhov yuav tsum tau ua ua ntej:
1. Networking Basics-HTTP
2. Nab hab sej kom nkag mus saib cov ntaub ntawv hauv web
Kauj ruam 1: Tsim Ib Yam Dab Tsi Channel
Yog tias koj tshiab rau Thingspeak thiab tsis tau siv dua ua ntej, ua raws cov theem hauv qab no:
Mus rau
Koj yuav tsum tso npe ua ntej koj pib siv Thingspeak
Tom qab kos npe, mus rau ntu Channels
Hauv qab Cov Kab, xaiv Tshiab Channel (saib duab rau siv)
Hauv Channel Tshiab, koj yuav pom cov ntaub ntawv sib txawv lub thawv. Koj tsuas yog yuav tsum tau sau rau hauv Lub Npe Lub Npe. Koj tuaj yeem tso npe rau koj cov channel yam koj xav tau. Kuv tau txuas daim duab uas kuv tau tso kuv lub npe hu ua Raspberry Pi 4. Tawm ntawm lub thawv uas seem li nws yog.
Nrog koj zoo siab! Koj tau ua tiav tsim cov channel rau koj qhov haujlwm IoT. (saib cov duab txuas uas koj tuaj yeem pom kuv cov channel hu ua Raspberry Pi 4 tau tsim tiav)
Kauj Ruam 2: Siv IFTTT App
Peb yuav tsum siv daim ntawv thov no txhawm rau ua kom tau txais kev thov rau tshaj tawm cov ntaub ntawv ntawm koj tus Tsim Thingspeak channel siv Google Assistant. Xav txog lub app no ua kev sib cuam tshuam ntawm Google Assistant thiab koj Thingspeak channel.
Tom ntej no, peb tsim GET thov ntawm IFTTT app.
Rub tawm IFTTT app los ntawm
Tsim koj tus account
Mus rau Ua koj tus kheej Applets los ntawm kos
Coj mus rhaub Yog tias qhov kev xaiv no
Xaiv qhov kev pabcuam ua Google Assistant
Hauv qhov ntawd, xaiv Hais ib kab lus yooj yim
Hauv qab qhov kev xaiv ntawd, qee lub thawv xov xwm yuav tshwm sim. Txog qhov ntawd, xa mus rau cov duab thiab sau cov ntsiab lus kom haum! (muaj ob daim duab rau lub hom phiaj no: 1. Ua kom lub teeb ci LED 2. Ua kom lub teeb tawm)
Peb tau ua tiav Qhov Yog Qhov no yog Google Assistant. Tam sim no peb xaiv Tom qab ntawd qhov kev xaiv uas yog Webhooks.
Hauv qab no, xaiv Ua lub vev xaib thov
Xa daim duab rau cov ntaub ntawv uas yuav tsum tau sau rau hauv lub thawv. Xa mus rau qhov URL no https://api.thingspeak.com/update?api_key=INSERT KOJ YUAV TSUM sau API KEY & field1 = 1
Hauv qhov URL saum toj no, koj yuav pom tias kuv tau hais txog INSERT YOUR WRITE API KEY. Nov yog tus yuam sij API uas yog tus kheej ntawm cov channel uas koj tau tsim ntawm Thingspeak (saib duab). Sau tus lej API yuav pab koj sau cov ntaub ntawv tshwj xeeb rau koj cov channel thiab zoo ib yam Nyeem API qhov tseem ceeb yuav pab koj kom tau txais cov ntaub ntawv los ntawm cov channel.
Sib nrug los ntawm koj Sau API tus yuam sij, cov ntaub ntawv tas los ntawm cov thawv tseem zoo ib yam.
Yog li ntawm no koj tau tsim qhov tshwm sim qhov twg thaum koj hais rau koj tus Google Assistant, "Qhib lub LED rau" nws yuav xa "1" rau koj li Thingspeak channel.
Tam sim no, zoo ib yam, koj yuav tsum tsim Applet tshiab ntawm IFTTT app txhawm rau tig lub LED tawm. Kuv tau txuas cov duab yog tias koj tsis meej pem txog qhov zoo ib yam. Txwv tsis pub, cov txheej txheem tig lub LED tawm yog tib yam li qhov koj tau ua saum toj no sib nrug ntawm qee qhov kev hloov pauv me me.
Kauj ruam 3: Thaum kawg Pib rau Code
Kuv yuav piav qhia lub hom phiaj tseem ceeb ntawm Python code. Peb yuav tsum nqa cov ntaub ntawv los ntawm Thingspeak channel uas yuav yog "1" lossis "0" raws li qhov koj hais rau koj tus Google Assistant. Peb yuav tsum qhib lossis tua LED raws qhov no. Yog tias tus nqi tso tawm ntawm Thingspeak channel yog "1", tom qab ntawd peb qhib lub LED, thiab yog tias nws yog "0", peb tua nws.
Hauv txoj cai, koj yuav xav tau ob yam: 1. Koj Nyeem API qhov tseem ceeb 2. Koj li Channel ID (xa cov duab rau tib yam)
Nov yog tus lej (piv txwv tias koj paub qhov yuav tsum tau ua ntej ntawm HTTP thiab Python):
ntshuam urllib
ntshuam thov
ntshuam json
lub sij hawm ntshuam
ntshuam RPi. GPIO ua GPIO
GPIO.setmode (GPIO. BOARD)
GPIO.setup (7, GPIO. OUT)
sim:
thaum (1):
URL = 'https://api.thingspeak.com/channels/INSER KOJ CHANNEL ID/fields/1.json? Api_key =' KEY = 'INSERT YOUR READ API KEY'
HEADER = '& cov txiaj ntsig = 2'
NEW_URL = URL+KEY+HEADER
#print (NEW_URL)
get_data = thov.get (NEW_URL).json ()
#print (tau_data)
feild_1 = get_data ['txau']
#print ("Teb:", feild_1)
t =
rau x hauv feild_1:
t.append (x ['field1'])
luam tawm (t [1])
yog int (t [1]) == 1:
GPIO. tawm (7, 1)
elif int (t [1]) == 0:
GPIO.output (7, 0)
tshwj tsis yog KeyboardInterrupt:
GPIO.cleanup ()
Pom zoo:
Phab Ntsa Mount rau IPad Raws Li Tsev Automation Tswj Vaj Huam Sib Luag, Siv Servo Tswj Cov Hlau nplaum los Qhib Screen: 4 Cov Kauj Ruam (nrog Duab)
Phab Ntsa Mount rau IPad Raws Li Tsev Automation Tswj Vaj Huam Sib Luag, Siv Servo Tswj Cov Hlau nplaum los Qhib Screen: Tsis ntev los no kuv tau siv sijhawm qee lub sijhawm siv khoom hauv thiab ib puag ncig kuv lub tsev. Kuv tab tom siv Domoticz ua kuv daim ntawv thov Tsev Automation, saib www.domoticz.com kom paub meej. Hauv kuv tshawb nrhiav daim ntawv thov daim ntawv qhia uas qhia tag nrho Domoticz cov ntaub ntawv tog
Tswj Cov Khoom Siv Hauv Tsev Siv Node MCU thiab Google Assistant - IOT - ib Blynk - Cov IFTTT: 8 Kauj Ruam
Tswj Cov Khoom Siv Hauv Tsev Siv Node MCU thiab Google Assistant | IOT | ib Blynk | Cov IFTTT: Ib txoj haujlwm yooj yim los tswj Cov Khoom Siv Google Assistant: Ceeb Toom: Kev Siv Hluav Taws Xob Hluav Taws Xob tuaj yeem ua rau phom sij. Kov nrog kev saib xyuas hnyav. Ntiav tus kws tshaj lij hluav taws xob thaum ua haujlwm nrog qhib hluav taws xob. Kuv yuav tsis lees paub lub luag haujlwm rau
Tsheb Tswj Chaw Taws Teeb - Tswj Kev Siv Wireless Xbox 360 Tus Tswj: 5 Kauj Ruam
Lub Tsheb Tswj Chaw Taws Teeb - Tswj Kev Siv Wireless Xbox 360 Tus Tswj: Cov no yog cov lus qhia txhawm rau tsim koj tus kheej lub tsheb tswj chaw taws teeb, tswj siv wireless Xbox 360 maub los
ESP8266 RGB LED Sawb WIFI Tswj - NODEMCU Raws li IR Chaw Taws Teeb rau Led Sawb Tswj Hauv Wifi - RGB LED Sawb Smartphone Tswj: 4 Cov Kauj Ruam
ESP8266 RGB LED Sawb WIFI Tswj | NODEMCU Raws li IR Chaw Taws Teeb rau Led Sawb Tswj Hauv Wifi | RGB LED Sawb Smartphone Tswj: Nyob zoo cov neeg hauv qhov kev qhia no peb yuav kawm paub siv nodemcu lossis esp8266 li IR chaw taws teeb los tswj RGB LED sawb thiab Nodemcu yuav raug tswj los ntawm smartphone dhau wifi. Yog li hauv paus koj tuaj yeem tswj RGB LED Sawb nrog koj lub xov tooj
TIVA Tswj Kev Siv Cov Khoom Siv Raws Li Xim Sorter: 8 Cov Kauj Ruam
TIVA Kev Tswj Tus Kheej Tus Kheej Raws Li Xim Sorter: Cov khoom siv hluav taws xob muaj daim ntawv thov dav. Txhua daim ntawv thov xav tau ib qho kev sib txawv thiab ib qho software sib txawv nrog rau kho vajtse teeb tsa. Microcontroller yog tus qauv sib xyaw ua ke hauv lub nti uas cov ntawv thov sib txawv tuaj yeem ua haujlwm nrog