Cov txheej txheem:
- Kauj Ruam 1: BME280 Kev Tshawb Fawb
- Kauj Ruam 2: Daim Ntawv Yuav Tsum Tau Kho Vajtse
- Kauj Ruam 3: Sib cuam tshuam
- Kauj Ruam 4: Kev Ntsuas Kub, Siab thiab Vaum
- Kauj Ruam 5: Cov ntawv thov:
- Kauj Ruam 6: Tutorial Video
Video: Vaum, Siab thiab Kev Ntsuas Kub Siv BME280 thiab Photon cuam tshuam: 6 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:25
Peb hla hla ntau txoj haujlwm uas xav tau qhov ntsuas kub, siab thiab ntsuas cua. Yog li peb paub tias cov kev ntsuas no tau ua lub luag haujlwm tseem ceeb hauv kev kwv yees ntawm kev ua haujlwm tau zoo ntawm cov txheej txheem ntawm cov xwm txheej sib txawv ntawm huab cua. Ob qho tib si ntawm qib kev lag luam thiab cov txheej txheem tus kheej qhov ntsuas kub zoo tshaj, cov av noo thiab qhov ntsuas siab barometric yog qhov tsim nyog rau qhov ua tau zoo ntawm lub kaw lus.
Qhov no yog vim li cas peb muab cov lus qhia ua tiav ntawm lub ntsuas cua no, hauv qhov kev qhia no peb yuav piav qhia kev ua haujlwm ntawm BME280 cov av noo, ntsuas siab thiab ntsuas kub nrog cov khoom siv photon.
Kauj Ruam 1: BME280 Kev Tshawb Fawb
Kev lag luam hluav taws xob tau nce qib lawv cov kev ua si nrog BME280 lub ntsuas pa, ib puag ncig lub ntsuas cua nrog qhov ntsuas kub, ntsuas ntsuas siab thiab av noo! Qhov ntsuas no zoo rau txhua yam huab cua/ib puag ncig zoo thiab tuaj yeem siv tau hauv I2C.
Qhov ntsuas qhov ntsuas qhov ntsuas BME280 yog qhov ntsuas pom zoo tshaj plaws rau ntsuas cov av noo nrog accuracy 3% qhov tseeb, ntsuas qhov ntsuas nrog ± 1 hPa tsis raug, thiab ntsuas kub nrog ± 1.0 ° C raug. Vim tias kev hloov pauv siab nrog qhov siab, thiab ntsuas qhov ntsuas tau zoo heev, koj tseem tuaj yeem siv nws ua qhov ntsuas siab nrog ± 1 meter lossis qhov raug zoo dua qub! lub siab ntsuas thiab tseem tuaj yeem siv rau kwv yees ntsuas kub ib puag ncig. Kev ntsuas nrog BME280 tuaj yeem ua tiav los ntawm tus neeg siv lossis ua ntu ntu.
Cov Ntaub Ntawv: Nyem rau saib ua ntej lossis rub tawm cov ntaub ntawv ntawm BME280 sensor.
Kauj Ruam 2: Daim Ntawv Yuav Tsum Tau Kho Vajtse
Peb siv Dcube Store Parts nkaus xwb vim tias lawv siv tau yooj yim, thiab qee yam txog txhua yam haum tau zoo ntawm kab sib chaws centimeter yeej ua rau peb mus. Koj tuaj yeem siv txhua yam koj xav tau, tab sis daim duab thaiv kab yuav xav tias koj siv cov khoom no.
- BME280 Sensor I²C Mini Module
- I²C Shield rau Particle Photon
- Particle Photon
- I²C Kab
- Hwj chim adapter
Kauj Ruam 3: Sib cuam tshuam
Qhov kev cuam tshuam feem ntau piav qhia cov kev sib txuas xov uas xav tau ntawm lub sensor thiab cov duab photon. Ua kom muaj kev sib txuas raug yog qhov tseem ceeb xav tau thaum ua haujlwm ntawm ib qho system rau qhov xav tau cov zis. Yog li, qhov xav tau kev sib txuas yog raws li hauv qab no:
BME280 yuav ua haujlwm dhau I2C. Nov yog qhov piv txwv kab hluav taws xob daim duab, qhia txog yuav ua li cas xaim txhua lub interface ntawm lub sensor. Tawm-ntawm-lub thawv, lub rooj tsavxwm tau teeb tsa rau I2C interface, zoo li peb pom zoo kom siv qhov cuam tshuam no yog tias koj tsis ntseeg lwm yam. Txhua yam koj xav tau yog plaub lub xov hlau! Tsuas yog plaub qhov kev sib txuas xav tau Vcc, Gnd, SCL thiab SDA tus pin thiab cov no txuas nrog kev pab ntawm I2C cable. Cov kev sib txuas no tau qhia hauv cov duab saum toj no.
Kauj Ruam 4: Kev Ntsuas Kub, Siab thiab Vaum
Qhov huv ntawm cov cai uas peb yuav siv los khiav qhov no muaj nyob ntawm no.
Thaum siv lub ntsuas ntsuas nrog Arduino, peb suav nrog application.h thiab lub tsev qiv ntawv spark_wiring_i2c.h. "application.h" thiab lub tsev qiv ntawv spark_wiring_i2c.h muaj cov haujlwm uas pab txhawb kev sib txuas lus i2c ntawm lub sensor thiab cov khoom me me.
Nyem qhov no qhib lub vev xaib rau kev tshuaj xyuas lub cuab yeej
Tshaj tawm cov cai rau koj lub rooj tsavxwm thiab nws yuav tsum pib ua haujlwm! Txhua cov ntaub ntawv tuaj yeem tau txais ntawm lub vev xaib raws li qhia hauv daim duab.
Code yog muab hauv qab no:
// Tshaj tawm nrog daim ntawv tso cai pub dawb.// Siv nws txhua txoj hauv kev koj xav tau, muaj txiaj ntsig lossis pub dawb, muab nws haum rau hauv daim ntawv tso cai ntawm nws cov haujlwm ua haujlwm. // BME280 // Txoj cai no yog tsim los ua haujlwm nrog BME280_I2CS I2C Mini Module muaj los ntawm ControlEverything.com. #include #include // BME280 I2C chaw nyob yog 0x76 (108) #define Addr 0x76 ob npaug cTemp = 0, fTemp = 0, siab = 0, av noo = 0; teeb tsa tsis muaj dab tsi () {// Teeb tsa qhov sib txawv Particle.variable ("i2cdevice", "BME280"); tsab ntawv.variable ("cTemp", cTemp); Particle.variable ("fTemp", fTemp); Particle.variable ("siab", siab); Particle.variable ("av noo", av noo); // Initialise I2C kev sib txuas lus li MASTER Wire.begin (); // Initialise Serial kev sib txuas lus, teeb baud tus nqi = 9600 Serial.begin (9600); ncua (300); } tsis muaj dab tsi voj () {unsigned int b1 [24]; unsigned int cov ntaub ntawv [8]; int dig_H1 = 0; rau (int i = 0; i <24; i ++) {// Pib I2C Kev Xa Cov Hlau.beginTransmission (Addr); // Xaiv cov ntaub ntawv sau npe Wire.write ((136+i)); // Nres I2C Kis Kab Hlau.endTransmission (); // Thov 1 byte ntawm cov ntaub ntawv Wire.requestFrom (Addr, 1); // Nyeem 24 bytes ntawm cov ntaub ntawv yog (Wire.available () == 1) {b1 = Wire.read (); }} // Hloov cov ntaub ntawv // temp coefficents int dig_T1 = (b1 [0] & 0xff) + ((b1 [1] & 0xff) * 256); int dig_T2 = b1 [2] + (b1 [3] * 256); int dig_T3 = b1 [4] + (b1 [5] * 256); // siab coefficents int dig_P1 = (b1 [6] & 0xff) + ((b1 [7] & 0xff) * 256); int dig_P2 = b1 [8] + (b1 [9] * 256); int dig_P3 = b1 [10] + (b1 [11] * 256); int dig_P4 = b1 [12] + (b1 [13] * 256); int dig_P5 = b1 [14] + (b1 [15] * 256); int dig_P6 = b1 [16] + (b1 [17] * 256); int dig_P7 = b1 [18] + (b1 [19] * 256); int dig_P8 = b1 [20] + (b1 [21] * 256); int dig_P9 = b1 [22] + (b1 [23] * 256); rau (int i = 0; i <7; i ++) {// Pib I2C Kev Xa Cov Hlau.beginTransmission (Addr); // Xaiv cov ntaub ntawv sau npe Wire.write ((225+i)); // Nres I2C Kis Kab Hlau.endTransmission (); // Thov 1 byte ntawm cov ntaub ntawv Wire.requestFrom (Addr, 1); // Nyeem 7 bytes ntawm cov ntaub ntawv yog (Wire.available () == 1) {b1 = Wire.read (); }} // Hloov cov ntaub ntawv // vaum coefficents int dig_H2 = b1 [0] + (b1 [1] * 256); int dig_H3 = b1 [2] & 0xFF; int dig_H4 = (b1 [3] * 16) + (b1 [4] & 0xF); int dig_H5 = (b1 [4] / 16) + (b1 [5] * 16); int dig_H6 = b1 [6]; // Pib I2C Kev Xa Xov Hlau.beginTransmission (Addr); // Xaiv cov ntaub ntawv sau npe Wire.write (161); // Nres I2C Kis Kab Hlau.endTransmission (); // Thov 1 byte ntawm cov ntaub ntawv Wire.requestFrom (Addr, 1); // Nyeem 1 byte ntawm cov ntaub ntawv yog (Wire.available () == 1) {dig_H1 = Wire.read (); } // Pib I2C Kev Xa Xov Hlau.beginTransmission (Addr); // Xaiv tswj cov av noo sau npe Wire.write (0xF2); // Vaum tshaj qhov piv txwv = 1 Wire.write (0x01); // Nres I2C Kis Kab Hlau.endTransmission (); // Pib I2C Kev Xa Xov Hlau.beginTransmission (Addr); // Xaiv tswj kev ntsuas sau npe Wire.write (0xF4); // Hom ib txwm muaj, ntsuas kub thiab siab dhau piv txwv piv txwv = 1 Wire.write (0x27); // Nres I2C Kis Kab Hlau.endTransmission (); // Pib I2C Kev Xa Xov Hlau.beginTransmission (Addr); // Xaiv teeb tsa sau npe Wire.write (0xF5); // Stand_by sijhawm = 1000ms Wire.write (0xA0); // Nres I2C Kis Kab Hlau.endTransmission (); rau (int i = 0; i <8; i ++) {// Pib I2C Kev Xa Cov Hlau.beginTransmission (Addr); // Xaiv cov ntaub ntawv sau npe Wire.write ((247+i)); // Nres I2C Kis Kab Hlau.endTransmission (); // Thov 1 byte ntawm cov ntaub ntawv Wire.requestFrom (Addr, 1); // Nyeem 8 bytes ntawm cov ntaub ntawv yog (Wire.available () == 1) {data = Wire.read (); }} // Hloov cov ntaub ntawv ntsuas thiab ntsuas kub mus rau 19-ntsis ntev adc_p = (((ntev) (cov ntaub ntawv [0] & 0xFF) * 65536) + ((ntev) (cov ntaub ntawv [1] & 0xFF) * 256) + (ntev) (cov ntaub ntawv [2] & 0xF0)) / 16; ntev adc_t = (((ntev) (cov ntaub ntawv [3] & 0xFF) * 65536) + ((ntev) (cov ntaub ntawv [4] & 0xFF) * 256) + (ntev) (cov ntaub ntawv [5] & 0xF0)) / 16; // Hloov cov ntaub ntawv av noo ntev adc_h = ((ntev) (cov ntaub ntawv [6] & 0xFF) * 256 + (ntev) (cov ntaub ntawv [7] & 0xFF)); // Kev ntsuas qhov ntsuas kub ntsuas ob npaug var1 = (((ob npaug) adc_t) / 16384.0 - ((ob npaug) dig_T1) / 1024.0) * ((ob npaug) dig_T2); ob var2 = (((ob npaug) adc_t) / 131072.0 - ((ob npaug) dig_T1) / 8192.0) * (((ob npaug) adc_t) /131072.0 - ((ob npaug) dig_T1) /8192.0)) * ((ob npaug) dig_T3); ob t_fine = (ntev) (var1 + var2); ob cTemp = (var1 + var2) / 5120.0; ob fTemp = cTemp * 1.8 + 32; // Kev ntsuas qhov ntsuas siab ntsuas var1 = ((ob npaug) t_fine / 2.0) - 64000.0; var2 = var1 * var1 * ((ob npaug) dig_P6) / 32768.0; var2 = var2 + var1 * ((ob npaug) dig_P5) * 2.0; var2 = (var2 / 4.0) + (((ob npaug) dig_P4) * 65536.0); var1 = (((ob npaug) dig_P3) * var1 * var1 / 524288.0 + ((ob npaug) dig_P2) * var1) / 524288.0; var1 = (1.0 + var1 / 32768.0) * ((ob npaug) dig_P1); ob p = 1048576.0 - (ob npaug) adc_p; p = (p - (var2 / 4096.0)) * 6250.0 / var1; var1 = ((ob npaug) dig_P9) * p * p / 2147483648.0; var2 = p * ((ob npaug) dig_P8) / 32768.0; ob npaug siab = (p + (var1 + var2 + ((ob npaug) dig_P7))) / 16.0) / 100; // Humidity offset calculations ob var_H = (((ob) t_fine) - 76800.0); var_H = (adc_h - (dig_H4 * 64.0 + dig_H5 / 16384.0 * var_H)) * (dig_H2 / 65536.0 * (1.0 + dig_H6 / 67108864.0 * var_H * (1.0 + dig_H3 / 67108864.0 * var_H)))); ob npaug av noo = var_H * (1.0 - dig_H1 * var_H / 524288.0); yog (av noo> 100.0) {av noo = 100.0; } lwm qhov yog (av noo <0.0) {av noo = 0.0; } // Cov ntaub ntawv tso tawm rau dashboard Particle.publish ("Kub hauv Celsius:", Txoj hlua (cTemp)); Particle.publish ("Kub hauv Fahrenheit:", String (fTemp)); Particle.publish ("Siab:", Txoj hlua (siab)); Particle.publish ("Tus txheeb ze Vaum:", Txoj hlua (av noo)); ncua (1000); }
Kauj Ruam 5: Cov ntawv thov:
BME280 qhov ntsuas kub, siab thiab txheeb ze cov av noo muaj ntau yam kev siv xws li ntsuas kub, khoos phis tawj ib puag ncig tiv thaiv cua sov, ntsuas kev ntsuas hauv kev lag luam. Peb kuj tseem tau ua haujlwm ntsuas qhov ntsuas no rau hauv daim ntawv thov huab cua nrog rau kev tshuaj xyuas tsev cog khoom.
Lwm cov ntawv thov tuaj yeem ua rau:
- Cov ntsiab lus paub, xws li nrhiav kom pom ntawm daim tawv nqaij, hloov chaw hloov chaw.
- Kev saib xyuas lub cev / noj qab nyob zoo - Ceeb toom txog kev qhuav dej lossis kub kub.
- Ntsuas qhov ntim thiab huab cua ntws.
- Tsev tswj kev siv tshuab hauv tsev.
- Tswj cua sov, qhov cua, cua txias (HVAC).
- Internet ntawm yam.
- Kev txhim kho GPS (piv txwv li lub sijhawm-rau-thawj-kev txhim kho, kev suav tuag, kev tshawb nrhiav nqes hav).
- Kev taw qhia sab hauv tsev (hloov pauv ntawm kev txheeb xyuas hauv pem teb, nrhiav kom of elevator).
- Kev tawm sab nraum zoov, kev lom zem thiab kev ua kis las.
- Huab cua huab cua.
- Vertical velocity indication (nce/dab dej ceev)..
Kauj Ruam 6: Tutorial Video
Saib peb cov vis dis aus kom dhau los ntawm txhua qib hauv kev cuam tshuam thiab ua tiav txoj haujlwm.
Nyob twj ywm rau lwm tus sensor cuam tshuam thiab ua haujlwm blog's.
Pom zoo:
Siv Smartphone Raws Li Tsis Siv Tus Kheej Ntsuas Kub / Tus Ntsuas Ntsuas Kub: 8 Kauj Ruam (nrog Duab)
Siv Smartphone Raws Li Tsis Siv Tus Kws Ntsuas Kub / Tus Ntsuas Kub Portable: Ntsuas lub cev kub nrog qhov tsis sib cuag / tsis sib cuag zoo li rab phom thermo. Kuv tsim txoj haujlwm no vim tias Thermo Gun tam sim no kim heev, yog li kuv yuav tsum tau txais lwm txoj hauv kev los ua DIY. Thiab lub hom phiaj yog ua nrog cov peev txheej qis .SuppliesMLX90614Ardu
Kev Ntsuas Kub thiab Vaum Siv SHT25 thiab Particle Photon: 5 Kauj Ruam
Kev Ntsuas Kub thiab Vaum Siv SHT25 thiab Particle Photon: Tsis ntev los no peb tau ua haujlwm ntau yam haujlwm uas xav tau kev ntsuas kub thiab av noo thiab tom qab ntawd peb tau pom tias ob qhov kev ntsuas no tau ua lub luag haujlwm tseem ceeb hauv kev kwv yees ntawm kev ua haujlwm tau zoo ntawm lub system. Ob leeg ntawm indus
Kev Ntsuas thiab Kev Ntsuas Kub Siv HIH6130 thiab Particle Photon: 4 Cov Kauj Ruam
Kev ntsuas cov av noo thiab ntsuas kub siv HIH6130 thiab Particle Photon: HIH6130 yog qhov ntsuas cua thiab ntsuas kub nrog cov zis digital. Cov ntsuas no muab qib raug ntawm ± 4% RH. Nrog kev lag luam-ua kom muaj kev ruaj ntseg mus sij hawm ntev, qhov tseeb kub-them nyiaj digital I2C, Kev lag luam ua rau muaj kev ntseeg siab, Kev siv hluav taws xob
Kev Ntsuas thiab Kev Ntsuas Kub Siv HTS221 thiab Particle Photon: 4 Cov Kauj Ruam
Kev Ntsuas Cov Ntsuas thiab Kub Siv HTS221 thiab Particle Photon: HTS221 yog lub ntsuas hluav taws xob me me uas muaj peev xwm ntsuas tau qhov txheeb ze thiab qhov kub thiab txias. Nws suav nrog lub hauv paus ntsiab lus thiab cov teeb liab sib xyaw daim ntawv thov tshwj xeeb kev sib txuas (ASIC) los muab cov ntaub ntawv ntsuas los ntawm cov lej
Tus Cuam Tshuam Cuam Tshuam (ntsuas phoo Cam Cuam Tshuam Cuam Tshuam): 4 Cov Kauj Ruam
Solder Saver (txhav tas Cam Cuam Tshuam Cuam Tshuam): "Yuav ua li cas kuv thiaj yuav tsum qhia ua ntej Cov Lus Qhia no?" Kuv nug kuv tus kheej. Zoo li, txij li thaum pib ntawm lub sijhawm, tus txiv neej muaj qhov xav kom lo lo rau hauv tus cwj mem thiab tshaj tawm cov duab online. Zoo, Kuv tau txiav txim siab luv luv delving rau hauv keeb kwm loj dua ntawm tus cwj mem yaj, b