Cov txheej txheem:

Kev ntsuas ntawm DS18B20 Sensor Nrog Arduino UNO: 3 Cov Kauj Ruam (nrog Duab)
Kev ntsuas ntawm DS18B20 Sensor Nrog Arduino UNO: 3 Cov Kauj Ruam (nrog Duab)

Video: Kev ntsuas ntawm DS18B20 Sensor Nrog Arduino UNO: 3 Cov Kauj Ruam (nrog Duab)

Video: Kev ntsuas ntawm DS18B20 Sensor Nrog Arduino UNO: 3 Cov Kauj Ruam (nrog Duab)
Video: Suab kho siab heev hais lus ua si 2024, Kaum ib hlis
Anonim
Kev ntsuas ntawm DS18B20 Sensor Nrog Arduino UNO
Kev ntsuas ntawm DS18B20 Sensor Nrog Arduino UNO
Kev ntsuas ntawm DS18B20 Sensor Nrog Arduino UNO
Kev ntsuas ntawm DS18B20 Sensor Nrog Arduino UNO
Kev ntsuas ntawm DS18B20 Sensor Nrog Arduino UNO
Kev ntsuas ntawm DS18B20 Sensor Nrog Arduino UNO

Tsis lees paub:

Cov cuab yeej koj pom hauv cov duab tau siv hauv lwm qhov haujlwm ua Thermostat rau kev tsim cov yeeb yaj kiab. Koj tuaj yeem pom qhov haujlwm ntawd ntawm no. Txhawm rau ntsuas ntsuas lub ntsuas, lossis ntau dua ib qho, koj yuav xav tau qhov koj yuav pom hauv qhov haujlwm no, tsis muaj dab tsi ntxiv, thiab nws yooj yim heev, ib yam nkaus! Wb mus!

Kauj ruam 1: Npaj Koj Lub Ntaus Ntawv

Npaj Koj Lub Ntaus Ntawv
Npaj Koj Lub Ntaus Ntawv

Nov yog cov npe ntawm yam koj xav tau:

  1. Arduino UNO (lossis MEGA)
  2. DS18B20 sensor (tus)
  3. 4kOhm - 5kOhm tsis kam (Kuv siv 5k1Ohm)
  4. LCD npo los nyeem qhov tseem ceeb (koj tseem tuaj yeem siv lub khoos phis tawj thiab tsuas yog nyeem lawv ntawm lub ntsuas saib)
  5. Daim duab kos uas siv lub ntsuas thiab qhia qee qhov txiaj ntsig

Ua ntej tshaj plaws koj yuav tsum txuas koj lub modules thiab sensor rau koj tus tswj. Kuv yuav tso qhov nyuaj ntawm LCD rau koj tshawb hauv lub vev xaib, thiab kuv tsuas yog qhia koj yuav ua li cas txuas lub sensor.

Feem ntau cov ntsuas no tuaj nrog peb xim xaim: Dub, Liab, Daj. Thawj ob yog rau lub zog thiab qhov thib peb yog rau cov ntaub ntawv. Txuas cov xim dub rau GNN, liab rau Vcc (5V) thiab daj ntawm cov lus sib piv, cia peb hais A0.

Tam sim no txuas qhov tsis kam ntawm daj thiab liab kom ua tiav kev sib txuas.

Txuas rau hauv LCD (Kuv qhia kom yooj yim 16x2 LCD nrog i2c txuas kom siv tsuas yog 4 xov hlau tag nrho) thiab koj tau ua tiav nrog cov xov hlau thiab cov xov hlau.

Tam sim no daim duab uas yooj yim heev:

#suav nrog "OneWire.h"

#suav nrog "DallasTemperature.h" #define ONE_WIRE_BUS_1 A0 OneWire ourWire1 (ONE_WIRE_BUS_1); DallasTemperature sensor1 (& ourWire1); #suav nrog "LiquidCrystal_I2C.h"

LiquidCrystal_I2C lcd (0x27, 16, 2); ntab RawValue = 0;

teeb tsa tsis muaj dabtsis () {lcd.init (); lcd.backlight (); sensor1.begin (); sensor1.setResolution (11); } tsis muaj dab tsi voj () {sensor1.requestTemperatures (); ntab RawValue = sensor1.getTempCByIndex (0); lcd.setCursor (0, 0); lcd.print ("Sens. 1"); lcd.print (RawValue, 1); }

Raws li koj tuaj yeem pom peb siv Dallas Kub lub tsev qiv ntawv thiab lub vijtsam LCD nrog i2c txuas.

Hauv kev teeb tsa peb iniziate LCD thiab sensor thiab hauv lub voj peb tsuas thov qhov ntsuas kub thiab khaws tus nqi sab hauv qhov sib txawv RawValue los qhia nws ntawm LCD.

Yog tias koj xav kom nws yooj yim dua, tsuas yog siv lub ntsuas saib nrog cov duab hauv qab no

#include "Wire.h" #include "OneWire.h" #include "DallasTemperature.h" #define ONE_WIRE_BUS_1 A0 OneWire ourWire1 (ONE_WIRE_BUS_1); DallasTemperature sensor1 (& ourWire1);

ntab RawValue = 0;

void teeb tsa () {

ncua (1000); Serial.begin (9600); sensor1.begin (); sensor1.setResolution (11);

}

lub voj void () {sensor1.requestTemperatures (); ntab RawValue = sensor1.getTempCByIndex (0); Serial.print ("Sens. 1"); Serial.println (RawValue, 1); }

Tam sim no ua raws kuv hauv qhov tseem ceeb ntawm txoj haujlwm txhawm rau ntsuas lub ntsuas.

Kauj Ruam 2: Ob Qhov Ntsuas Ntsuas

Ob Point Calibration
Ob Point Calibration
Ob Point Calibration
Ob Point Calibration
Ob Point Calibration
Ob Point Calibration

Ib yam yuav tsum paub ua ntej

Txhawm rau ntsuas lub ntsuas cua sov, koj yuav tsum ntsuas qee yam uas koj paub qhov kub thiab txias. Txoj hauv kev yooj yim los ua nws hauv tsev yog siv cov dej npau thiab da dej ntawm cov dej khov yaj, tseem hu ua chav da dej "triple-point". Hauv cov xwm txheej no peb paub tias dej npau ntawm 100 ° C ntawm qib hiav txwv. Nco ntsoov tias txhawm rau ntsuas kom raug koj yuav tsum paub koj qhov siab thiab xam qhov kub kom tsim nyog nyob ntawd.

Koj tuaj yeem tshawb xyuas nws ntawm no!

Yuav kom ncaj ncees koj yuav tsum txheeb xyuas qhov ntsuas huab cua thiab tsis yog qhov siab. Tab sis txoj kev ntawd yog qhov tseeb txaus.

Qhov peb-taw tes da dej, lossis da dej khov, yog qhov kub uas muaj dej nyob hauv peb lub xeev khov, kua thiab roj, qhov kub ntawd yog 0, 01 ° C. Peb yuav siv, txhawm rau ua kom yooj yim, 0 ° C.

Paub txog tus nqi uas lub sensor nyeem thiab tus nqi uas yuav tsum yog, peb tuaj yeem hloov kho tus nqi nyoos ntawm DS18B20 rau qee yam uas raug dua.

NCO TSEG: koj kuj tseem tuaj yeem siv qhov ntsuas kub ntau ntxiv kom ntsuas lub ntsuas ntsuas tsuas yog muab tso rau hauv qee yam khoom uas koj paub qhov kub npau npau zoo li Ether (35 ° C), Pentane (36, 1 ° C), Acetone (56 ° C) lossis Ethanol (78, 37 ° C), tab sis cov dej kub npau npau ua rau muaj cov pa kub heev! Yog li tsis txhob ua!

Dej Kub:

Muab qee cov dej tso rau hauv lub lauj kaub thiab ua kom sov kom txog thaum nws rhaub (cov pa roj tau tsim thiab dej tab tom ua rau nws tus kheej). Ua kom koj lub sensor nyob qhov twg nws tsis kov dab tsi tab sis dej. Tos ob peb feeb thiab nyeem cov lcd lossis cov saib txuas

Qhov kub yuav tsum zoo ib yam li ib feeb. Yog tias yog, sau tus nqi ntawd. Qhov ntawd yog koj li: RawHigh tus nqi.

Triple-point da dej:

Tam sim no nqa lub khob loj (koj tsis xav tau dab tsi loj lossis lub lauj kaub) thiab sau nws mus rau ciam teb nrog cov dej khov. Sim siv cov dej khov nab kuab me me. Tam sim no sau 80% ntawm iav nrog dej txias. Muab cov dej khov rov los yog tus pas ntsuas kom nqes mus.

Tam sim no tso koj lub sensor rau hauv dej/dej khov thiab tos ib thiab ib nrab feeb. Nyeem qhov ntsuas kub uas yuav tsum zoo ib yam li 30 vib nas this tsawg kawg. Yog tias yog, sau nws, tias nws yog koj li RawLow tus nqi.

Kauj Ruam 3: Siv Tus Nqi Uas Koj Tau Txais Txoj Cai Zoo

Yog li, tam sim no koj tau txais qee qhov tseem ceeb:

  • RawHigh
  • RawLow
  • Siv siab
  • Siv qis

Tus nqi ua pov thawj pom tseeb yog 99.9 ° C rau cov dej npau (ntawm kuv qhov siab ntawm 22m), thiab 0 ° C rau cov dej khov yaj. Tam sim no xam cov kab ntawv rau cov txiaj ntsig no:

  • RawRange = RawHigh - RawLow
  • ReferenceRange = ReferenceHigh - ReferenceLow

Tam sim no koj tau teeb tsa los siv lub ntsuas pa hauv lwm qhov haujlwm kom ntseeg tau tias nws yuav muab ntsuas kom raug rau koj. Yuav ua li cas? Siv tus nqi uas koj tau txais ntawm no hauv txoj haujlwm koj yuav tsim nrog lub sensor ntawd.

Hauv koj txoj haujlwm yav tom ntej koj yuav tau siv qhov txiaj ntsig koj nyeem hauv qhov no thiab kuv hais kom ua nws siv tib lub npe uas kuv siv ntawm no.

Tshaj tawm cov kev hloov pauv ua ntej qhov tsis muaj teeb tsa teeb tsa () ntu zoo li no:

ntab RawHigh = 99.6; ntab RawLow = 0.5; ntab ReferenceHigh = 99.9; ntab ReferenceLow = 0; ntab RawRange = RawHigh - RawLow; ntab ReferenceRange = ReferenceHigh - ReferenceLow;

Tshaj li, txhua zaus koj yuav siv lub ntsuas, koj tuaj yeem siv cov qauv hauv qab no los laij Tus Kho Kom raug Tus nqi:

ntab CorrectedValue = (((RawValue - RawLow) * ReferenceRange) / RawRange) + ReferenceLow;

RawValue yog qhov pom tseeb ntawm kev nyeem ntawv.

Qhov ntawd yog nws!

Tam sim no koj paub yuav ntsuas koj li DS18B20 sensor lossis lwm yam khoom siv uas koj yuav siv! Muaj kev lom zem!

Pom zoo: