Kune akasiyana humidity uye tembiricha sensors inowanikwa, senge iyo LM35. Mamwe akavakirwa mumamojuru ekushandisa chaiko neArduino. Asi kazhinji, ivo vanofanirwa kuyera tembiricha yakaoma, ndokuti tembiricha yemhepo. Asi pane yemhando yekongiri inoshanda kune pima tembiricha mune zvinwiwa uye inonzi DS18B20. Chinhu chinoshamisa chinogona kuuya chinobatsira kune mamwe mapurojekiti ako ekunze eIye kwaunotambawo neimwe mhando yemvura yaunoda kuziva iyi paramende.
Chaizvoizvo DS18B20 haingoyeri tembiricha mukati memvura, asi inogona kubatsira zvikuru kuyera tembiricha mu nharaunda dzakanyorova uye zvakare pasi peimwe mvura. Saka iwe unogona zvakare kuishandisa kuyera tembiricha yemhepo kana nharaunda yakatakurwa zvakanyanya nehunyoro. Uye sekutaura kwandaita, chimiro chekukwanisa kuchinyudza mumvura kuyera tembiricha yayo ndechimwe chezvinhu zvinoita kuti chishande zvakanyanya.
Chii chinonzi DS18B20?
Zvakanaka, ini ndinofunga zvatova pachena, inzwa yemagetsi inokwanisa kuyera tembiricha yegasi kana yemvura midhiya. Mukuwedzera, kune mapakeji akasiyana kana mapakeji eDS18B20, senge iyo yekutanga iwe yaunoona mumufananidzo mukuru, kana inogona zvakare kuverengerwa mune mamwe maPCB, maputi ekunyudza, nezvimwe. Kune yako projekiti iwe unofanirwa kusarudza iyo yakakodzera kwazvo fomati zvinoenderana nezvaunoda.
Semuenzaniso, kunze kweiyo yakajairwa TO-92, kune zvakare iyo microSOP. Zvichida kubatanidza neArduino inonyanya kukosha ndeye TO-92, nekuti nemapini ayo matatu zviri nyore kwazvo kupinza mubhodhi rechingwa chekubatanidza.
Pinout
El DS18B20 pini zviri nyore kuziva. Semuenzaniso, kutora sereferensi iyo Dallas TO-92 package, inova ndiyo inozivikanwa, unogona kuona kuti ine mapini matatu. Kana iwe ukaiisa kubva kumberi, ndiko kuti, nechikamu chakatenderedzwa kumashure uye uchitarisa kumeso kwakapetana panowanikwa zvakanyorwa, pini kuruboshwe kwako ndi1 uye iri kurudyi kwako 3. Naizvozvo, 1 ichave yeGND kana pasi, 2 ndeye data uye 3 yekupa magetsi.
Pano isu tinofanirwa kutaura izvozvo, tsika dzaunofanira kuziva:
- Pini 1: unofanirwa kuibatanidza kune iyo GND pini yeArduino, ndiko kuti, ku0v.
- Pini 2: pini iyi ndeyeDQ kana data, iyo ichatumira tembiricha yakayerwa neiyo sensor kuArduino kuburikidza neimwe protocol inozivikanwa se1-Wire uye iyo inoda raibhurari yakakosha uye mabasa eArduino IDE. Izvo zvinobvumidza kushandisa imwechete Arduino pini yekubatanidza akawanda maseru neiyi protocol ...
- Pini 3: Inogona kupihwa simba kubva pa3 kusvika ku5,5v, kuti ugone kuisanganisa neiyo 5v kuburitsa kweArduino.
DS18B20 technical technical uye dhatasheet
Semazuva ese, zviripo zvinonakidza kuziva hunhu hunhu yeiyo sensor kuti izive mashandiro ayo, kuti irege kuikuvadza, uye pamusoro pezvose kuitira kuti tizive paine kuyerwa kwayo, nekuti kana tsika dzatinoda kuyera dzisiri pakati pavo, hazvizotibatsire uye iwe unofanirwa kutsvaga imwe nzira.
Kuti uite izvi, zvakanaka kurodha pasi gadzira datasheet, senge iri muDallas iyo iwe unogona kuona pano. Ikoko iwe unowana zvese zvakakosha ruzivo. Uye yeuka kuti kunyangwe ese DS18B20 angave akafanana, zvinoenderana nemugadziri kana pasuru iwe unogona kuwana dzimwe shanduko ...
Asi zvisinei nemakwenzi, heano mashoma basic technical data:
- Temperature dungwerungwe: -55 kusvika 125ºC, nekudaro, inogona kuyera mugesi kana mvura pane yakadzika kwazvo uye zvakare kwakanyanya tembiricha.
- Zvikanganiso: iyo DS18B20 inonzwisisa kune ruzha rwekunze kana kukanganiswa kunogona kupa zvisirizvo zviyero muzviyero. Marita yekukanganisa iri kuwedzera kubvisa 2ºC, kunyangwe pa tembiricha iri pakati pe -10ºC uye 85ºC, ndiko kuti, kana tisiri padyo nemuganhu, inogona kungove hafu yedhigirii.
- Kugadzirisa: Unogona kushanda nezvisarudzo zvakati wandei kana musiyano mushoma waunogona kuona neArduino analog pini. Inotsigira 9-bit, 10-bit, 11-bit, uye 12-bit (default). Ndokunge, inogona kuyera kubva pahafu kusvika pahafu yedhigirii, kubva kukota kusvika kuchina chechidimbu, kubva pa0,125 kusvika 0,125 toC, kana kubva pa0,0625ºC zvichiteerana. Unogona kushandura chirongwa ichi kuburikidza nekodhi yechirongwa.
- Supply voltage: 3 kusvika 5,5v
- Mutengo: 1 kusvika ku3 €
Kubatanidzwa naArduino
Kunyange zviripo nzira dzakasiyana dzekuubatanidza, inonyanya kukodzera ndiyo yaunoona mumufananidzo uyu. Izvo zviri nyore, iine iyo GND pini mune inoenderana kubatana kweiyo Arduino bhodhi, magetsi anopa zvakafanana uyezve data kune Arduino analog yawakasarudza mune yako programming kodhi muArduino IDE. Asi zvakare zvakanaka kuseta 4,7k yekudhonza-kumusoro resistor (kana chinhambwe chekanzuru yekuongorora tambo chiri chikuru, kuramba kwacho kunofanira kuve kwakaderera, semuenzaniso, kwe5m ye3,3k, yegumi ye10, 2,2k,…) yeiyo pini yedata uye nekudaro chengetedza nguva dzose yakakwira.
For the kuronga muArduino IDE uye kusangana kwayo kwakanaka neDS18B20 uye iyo chaiyo protocol, zvinokurudzirwa kuti utore mumaraibhurari Dallas Kupisa y OneWire kubva munharaunda. Uye iyo base kodhi, inogona kuve chimwe chinhu senge uyu muenzaniso wandinoratidza:
#include <OneWire.h> #include <DallasTemperature.h> // Pin donde se conecta el bus 1-Wire (DQ) const int pinDatosDQ = 9; // Instancia a las clases OneWire y DallasTemperature OneWire oneWireObjeto(pinDatosDQ); DallasTemperature sensorDS18B20(&oneWireObjeto); void setup() { // Iniciamos la comunicación serie a 9600 baudios Serial.begin(9600); // Iniciamos el bus 1-Wire del sensor sensorDS18B20.begin(); } void loop() { // Indicamos que tome la temperatura Serial.println("Midiendo temperatura"); sensorDS18B20.requestTemperatures(); // Lee y muestra la temperatura (recuerda que puedes conectar más de uno con 1-wire) Serial.print("La temperatura del sensor 0 es de: "); Serial.print(sensorDS18B20.getTempCByIndex(0)); Serial.println(" C"); Serial.print("La temperatura del sensor x es de: "); Serial.print(sensorDS18B20.getTempCByIndex(1)); Serial.println(" ºC"); delay(1000); }
Mamwe mashoko - Arduino Chirongwa Chinyorwa (Yemahara PDF)