Cov txheej txheem:
- Khoom siv
- Kauj Ruam 1: GridDB Web API & FluentD
- Kauj ruam 2: Grafana
- Kauj Ruam 3: Khoom Noj
- Kauj Ruam 4: Xaus
Video: BBQ Pi (Nrog Kev Pom Duab Cov Ntaub Ntawv!): 4 Cov Kauj Ruam (nrog Duab)
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:25
Taw qhia
Barbecuing feem ntau yog hais txog cov txheej txheem qeeb ntawm kev siv cov cua sov ncaj qha los ua noj koj cov nqaij nyiam. Txawm hais tias txoj hauv kev ua noj ua haus no nrov heev-tshwj xeeb hauv Asmeskas-nws muaj qee yam yuav xav txog qhov tsis muaj zog loj: nws yuav tsum tau teev ib nrab ntawm kev saib xyuas ib nrab kom siv sijhawm ntsuas qhov kub ntawm koj lub qhov thiab zaub mov. Nkag mus: Raspberry Pi.
Thawj Txoj Haujlwm
Lub hauv paus tseem ceeb rau txoj haujlwm no tuaj yeem pom ntawm no: https://old.reddit.com/r/raspberry_pi/comments/a0… Cov ntsiab lus ntawm nws yog tias reddit cov neeg siv Produkt muaj peev xwm xa cov zaub mov thiab qhov kub qhov kub ntawm cov nqi pheej yig, kev lag luam muaj cov ntsuas cua sov tsis pub dhau mus rau Raspberry Pi (uas tau txuas nrog nws GPIO tus pin me me RF module). Hauv thawj qhov haujlwm (txuas rau saum toj no), Produkt muaj nws cov ntaub ntawv raug khaws cia hauv sqlite database thiab nthuav tawm mus rau hauv ib cheeb tsam uas tuav apache2 php lub vev xaib.
Cov kev daws teeb meem no twb daws qhov teeb meem qub uas tau kov rau hauv kev qhia ntawm blog no: tam sim no koj tuaj yeem saib xyuas koj cov zaub mov & qhov kub nyob deb nrog lub web browser. Tab sis dab tsi yog tias peb xav nthuav dav ntawm qhov no? Nkag mus: GridDB.
Khoom siv
Raspberry Pi 4
SUNKEE 433Mhz Superheterodyne Wireless Receiver Module
Kauj Ruam 1: GridDB Web API & FluentD
Thaum pom qhov haujlwm no, kuv thawj qhov kev xav - tom qab thawj nthwv dej ntawm kev zoo siab - tau xav txog txoj hauv kev kuv txuas ntxiv kev ua haujlwm. Los ntawm kev siv GridDB thiab nws cov Grafana plugin, Kuv nrhiav kom pom kuv cov zaub mov & cov ntaub ntawv qhov. Dhau ntawm qhov ntawd, Kuv xav teeb tsa Grafana cov lus piav qhia txhawm rau nrhiav cov ntsiab lus tsis txaus ntseeg - tsis tuaj yeem muaj nqaij hlawv!
Txhawm rau pib, Kuv xav tau siv C code los ntawm thawj qhov haujlwm los nyeem cov ntaub ntawv los ntawm tus pas ntsuas kub wireless thiab tshaj tawm cov ntaub ntawv ntawd rau hauv kuv li GridDB server. Txhawm rau ua qhov no thiab khiav, Kuv tau tig GridDB Server ntawm Azure siv CentOS lub tshuab virtual. Txoj hauv kev yooj yim tshaj plaws los qhia cov ntaub ntawv los ntawm peb lub tshuab ntug (Raspberry Pi) rau peb lub server huab tau dhau ntawm GridDB Web API. Yog li, ntawm qhov ntawd, kuv teeb tsa GridDB's WebAPI nrog rau Fluentd thiab txuas nrog GridDB txuas.
Ua ntej xa cov ntaub ntawv mus rau huab, Kuv xav tau los tsim cov phiaj xwm yooj yim rau kuv lub BBQ Pi ntim. Cov ntaub ntawv los rau hauv yog qhov yooj yim heev: peb muaj ob lub ntsuas kub, ib tus lej ua noj, thiab tau kawg, lub sijhawm. Yog li peb cov schema zoo li qhov no:
timeseries = gridstore.put_container ("bbqpi", [("sijhawm", griddb. GS_TYPE_TIMESTAMP), ("cookid", griddb. GS_TYPE_INT), ("probe1", griddb. GS_TYPE_INT), ("probe2", griddb. GS_TYPE_INT)], griddb. GS_CONTAINER_TIME_SER)
Txhawm rau tsim lub thawv ntim sijhawm no, Kuv yooj yim siv WebAPI (chaw nres nkoj 8080):
curl -X POST --basic -u admin: admin -H "Cov ntsiab lus -hom: thov/json" -d
'{"container_name": "bbqpi", "container_type": "TIME_SERIES", / "rowkey": tseeb, "kab": [{"name": "time", "type": "TIMESTAMP"}, {"npe": "cookid", "type": "INTEGER"}, {"name": "probe1", "type": "INTEGER"}, {"name": "probe2", "type": "INTEGER"}]} '\ https:// localhost: 8080/griddb/v2/defaultCluster/dbs/public/ntim
Nrog lub thawv tsim, kuv xav tau siv Fluentd (chaw nres nkoj 8888) tshaj tawm cov ntaub ntawv tiag tiag rau hauv peb lub thawv. Nov yog CURL hais kom tshaj tawm qee cov ntaub ntawv dag:
curl -X POST -d 'json = {"date": "2020-01-01T12: 08: 21.112Z", "cookid": "1", "probe1": "150", "probe2": "140" } 'https:// localhost: 8888/griddb
Los ntawm qhov ntawd, Kuv xav tau txuas ntxiv tus lej qub xa HTTP POST Thov thaum twg peb Pi tau nyeem cov ntaub ntawv los ntawm peb lub qhov taub (li ib zaug txhua txhua ~ 12 vib nas this).
Raws li cov lus ceeb toom: sau cov cai no qhia kuv kom txaus siab li cas hais lus C hom lus tuaj yeem yog:
int postData (sijhawm char , int cookid, int sojntsuam 1, int sojntsuam 2, char url )
{CURL *curl; CURLcode res; / * Hauv qhov rais, qhov no yuav pib cov khoom winsock */ curl_global_init (CURL_GLOBAL_ALL); char errbuf [CURL_ERROR_SIZE] = {0,}; tus neeg sawv cev char [1024] = {0,}; char json [1000]; snprintf (json, 200, "json = {" date / ": \"%s.112Z / ", \" cookid / ": \"%d / ", \" probe1 / ": \"%d / ", / "probe2 \": / "%d \"} ", sijhawm, ua noj ua haus, sojntsuam 1, sojntsuam 2); / * tau txais curl kov */ curl = curl_easy_init (); yog (curl) { /* Ua ntej teeb tsa URL uas tab tom yuav tau txais peb POST. Qhov URL no tuaj yeem yog https:// URL yog tias yog dab tsi yuav tsum tau txais cov ntaub ntawv. */ snprintf (tus neeg sawv cev, tus neeg sawv cev loj, "libcurl/%s", curl_version_info (CURLVERSION_NOW)-> version); tus neeg sawv cev [tus neeg sawv cev loj - 1] = 0; curl_easy_setopt (curl, CURLOPT_USERAGENT, tus neeg sawv cev); curl_easy_setopt (curl, CURLOPT_URL, url); curl_easy_setopt (curl, CURLOPT_USERNAME, "admin"); curl_easy_setopt (curl, CURLOPT_PASSWORD, "admin"); curl_easy_setopt (curl, CURLOPT_VERBOSE, 1L); curl_easy_setopt (curl, CURLOPT_ERRORBUFFER, errbuf); curl_easy_setopt (curl, CURLOPT_POSTFIELDS, json); / * Ua qhov kev thov, res yuav tau txais tus lej rov qab */ res = curl_easy_perform (curl); yog (res! = CURLE_OK) {size_t len = strlen (errbuf); fprintf (stderr, "\ nlibcurl: (%d)", res); yog (len) fprintf (stderr, "%s%s", errbuf, ((errbuf [len - 1]! = '\ n')? "\ n": "")); fprintf (stderr, "%s / n / n", curl_easy_strerror (rov)); tau txais kev ntxuav; } ntxuav: curl_easy_cleanup (curl); curl_global_cleanup (); rov 0; }}
Nrog rau txoj haujlwm no sau, Kuv tsuas yog xav kom nws ua haujlwm tib lub sijhawm uas cov ntaub ntawv sqlite tau tshaj tawm:
yog (goodData == 1) {
yog (last_db_write == 0 || (secs-last_db_write> = 10)) {snprintf (sql, 100, "INSERT INTO nyeem (cookid, sijhawm, sojntsuam 1, sojntsuam 2) VALUES (%d, '%s',%d, %d); ", cookID, buff, sojntsuam 1, sojntsuam 2); printf ("%s / n", sql); cov. rc = sqlite3_exec (db, sql, callback, 0, & zErrMsg); yog (rc! = SQLITE_OK) {printf ("SQL yuam kev: %s / n", zErrMsg); } lwm {last_db_write = secs; } char url = "https://xx.xx.xx.xx: 8888/griddb"; postData (buff, cookID, sojntsuam 1, sojntsuam 2, url); }}
Kom paub tseeb tias koj cov ntaub ntawv tau raug ntxig rau hauv koj lub server, koj tuaj yeem ua cov lus txib hauv qab no los nug koj cov ntaub ntawv thiab saib cov txiaj ntsig:
curl -X POST --basic -u admin: admin -H "Cov ntsiab lus -hom: thov/json" -d '{"txwv": 1000}' https:// localhost: 8080/griddb/v2/defaultCluster/dbs/ pej xeem/ntim/bbqpi/kab
Kauj ruam 2: Grafana
Nrog cov cai nyob hauv qhov chaw, tam sim no thaum peb siv lub vev xaib qub los pib "ua noj", peb yuav khaws cia peb cov ntaub ntawv ntsuas kub ib txhij rau hauv peb GridDB server.
Cov kauj ruam tom ntej yuav yog kom pom peb cov ntaub ntawv siv Grafana. Txhawm rau ua qhov no, peb ua raws cov ntaub ntawv los ntawm blog no: ntawm no. Qhov zoo ntawm qhov kev siv no yog qhov nws yooj yim heev kom pom peb cov ntaub ntawv teev tseg rau hauv daim duab zoo. Nws kuj ntxiv cov lus piav qhia.
Cov lus piav qhia tham hauv blog ua rau nws yooj yim heev rau peb saib xyuas thaum muaj qee yam tsis raug nrog peb cov zaub mov lossis lub qhov taub nws tus kheej. Hauv kuv qhov xwm txheej, kuv tau ua noj nqaij nyuj luv tav. Nrog rau cov ntawd, Kuv tsis xav kom qhov kub hauv qhov av nce siab tshaj 275 degrees Fahrenheit. Yog tias kuv pom qhov ntsuas kub mus dhau qhov ntawd, Kuv tuaj yeem tua lub qhov hluav taws kub thiab tso cua sov kom poob dua:
Kuv muaj txoj cai zoo sib xws rau lub ntsuas ntsuas ua kom tabs ntawm cov zaub mov nws tus kheej: yog tias cov zaub mov tau mus rau qhov ntsuas kub sab hauv ntawm 203 degrees fahrenheit, cov tav tau npaj txhij. Koj tuaj yeem pom cov lus piav qhia ib leeg ntawm qhov kawg ntawm tus ua noj ntawm no:
Tag nrho txhua qhov, tus ua noj tsuas yog coj kuv txog ~ 4 teev lossis yog li ntawd, tab sis qhov kev teeb tsa no yuav ua tau zoo tshaj yog tias kuv tau ua qee yam uas yuav xav tau sijhawm ntau dua hauv cov hniav nyiaj hniav kub (xav tias cov pa luam yeeb qis uas ntev ~ 12 teev). Txawm li ntawd los, kuv ntseeg tus nqi yog tias cov cuab yeej no pom tau yooj yim: muaj peev xwm nkag mus rau koj cov txiaj ntsig cov txiaj ntsig thiab tom qab ntawd sib piv nws rau kev ua noj ua haus yav dhau los txhais tau tias koj cov BBQing yuav maj mam zoo dua nyob rau lub sijhawm vim koj tuaj yeem siv cov ntaub ntawv los saib seb ua haujlwm li cas thiab ua dab tsi 'tsis
Kauj Ruam 3: Khoom Noj
Nov yog thawj zaug kuv tau ua nqaij nyuj luv tav; rau seasoning, kuv tsuas yog siv ntsev, kua txob dub, thiab qej hmoov. Txawm hais tias qee qhov teeb meem nrog lub hlawv kom siab dhau rau tad me ntsis nyob rau thaum pib, cov tav tav tawm los zoo heev. Thov ua tib zoo saib:
Kauj Ruam 4: Xaus
Thaum kawg, cov zaub mov tau tawm los zoo kawg nkaus, lub ntsuas cua, GridDB, thiab Grafana txhua tus ua haujlwm hauv kev hais kwv txhiaj zoo nkauj, thiab peb tau txais qee cov ntaub ntawv muaj txiaj ntsig ntawm yuav ua li cas ua cov khoom no ntxiv rau lub sijhawm tom ntej peb xav ua rau qee tus phooj ywg zoo siab.
Pom zoo:
LoRa-Raws Li Pom Kev Pom Kev Pom Zoo rau Kev Ua Liaj Ua Teb Iot - Tsim Tsim Daim Ntawv Thov Ua Ntej Siv Firebase & Angular: 10 Kauj Ruam
LoRa-Raws Li Pom Kev Pom Kev Pom Zoo rau Kev Ua Liaj Ua Teb Iot | Tsim Tsim Daim Ntawv Thov Ua Ntej Siv Firebase & Angular: Hauv tshooj yav dhau los peb tham txog yuav ua li cas cov ntsuas hluav taws xob ua haujlwm nrog loRa module txhawm rau nthuav tawm firebase Lub Sijhawm Teem Sijhawm, thiab peb tau pom daim duab siab heev tias peb txoj haujlwm tag nrho ua haujlwm li cas. Hauv tshooj lus no peb yuav tham txog yuav ua li cas peb tuaj yeem
IoT: Pom Kev Pom Kev Pom Cov Ntaub Ntawv Siv Node-RED: 7 Cov Kauj Ruam
IoT: Pom Kev Pom Teeb Pom Kev Pom Cov Ntaub Ntawv Siv Node-RED: Hauv cov lus qhia no, koj yuav kawm paub yuav tsim lub internet txuas nrog lub ntsej muag li cas! Kuv yuav siv lub teeb pom kev ib puag ncig (TI OPT3001) rau qhov ua piv txwv no, tab sis ib qho ntsuas ntawm koj xaiv (ntsuas kub, av noo, lub hwj chim ntsuas hluav taws xob, thiab lwm yam) yuav ua haujlwm. Tus nqi sensor
Kev Tau Txais Cov Ntaub Ntawv thiab Cov Ntaub Ntawv Pom Kev Pom Zoo rau MotoStudent Fais Fab Sib Tw Tsheb kauj vab: 23 Kauj Ruam
Kev Tshawb Nrhiav Cov Ntaub Ntawv thiab Cov Ntaub Ntawv Pom Zoo rau MotoStudent Hluav Taws Xob Sib Tw Tsheb: Cov ntaub ntawv khaws cov ntaub ntawv yog cov khoom siv khoos phis tawj thiab software ua haujlwm ua ke txhawm rau sau cov ntaub ntawv los ntawm cov ntsuas sab nraud, khaws thiab ua nws tom qab kom nws tuaj yeem pom cov duab thiab txheeb xyuas, tso cai rau cov kws tsim txuj ci los ua
RAWS LI COV NTAUB NTAWV NTSEEG NTAWV NTAWV MUAJ NTAWV TSHUAJ NTAWV TSO CAI RAU RASPBERRY PI: 6 Kauj Ruam (nrog Duab)
RAWS LI COV NTAUB NTAWV NTAWV MUAJ NTAWV TSHUAJ NTXIV RAU RASPBERRY PI: Hauv qhov haujlwm no, peb yuav txuas peb ntawm Atlas Scientific's EZO sensors (pH, yaj cov pa thiab kub) mus rau Raspberry Pi 3B+. Hloov chaw ntawm txuas cov kab hluav taws xob mus rau Raspberry Pi, peb yuav siv Whitebox Labs Tentacle T3 daim ntaub thaiv. T
Pom Qhov Pom Pom Pom Pom Lub Koob Yees Duab (TfCD): 15 Kauj Ruam (nrog Duab)
Pom Qhov Pom Pom Pom Pom Lub Koob Yees Duab (TfCD): Cov kev pabcuam paub uas tuaj yeem paub txog kev xav, ntsej muag ntawm tib neeg lossis cov khoom yooj yim tam sim no tseem nyob rau theem pib ntawm kev txhim kho, tab sis nrog kev kawm tshuab, thev naus laus zis no tau nce zuj zus. Peb tuaj yeem cia siab tias yuav pom ntau ntxiv ntawm cov khawv koob no hauv