Cov txheej txheem:

Particle Photon - ADT75 Kub Sensor Qhia: 4 Kauj Ruam
Particle Photon - ADT75 Kub Sensor Qhia: 4 Kauj Ruam

Video: Particle Photon - ADT75 Kub Sensor Qhia: 4 Kauj Ruam

Video: Particle Photon - ADT75 Kub Sensor Qhia: 4 Kauj Ruam
Video: Particle Photon - ADT75 Temperature Sensor Tutorial 2024, Kaum ib hlis
Anonim
Image
Image

ADT75 yog qhov tseeb, ntsuas kub digital. Nws suav nrog qhov sib txawv ntawm qhov ntsuas kub thiab 12-ntsis analog rau digital hloov pauv rau kev saib xyuas thiab digitizing qhov kub thiab txias. Nws qhov kev nkag siab zoo ua rau nws muaj peev xwm txaus los ntsuas qhov ntsuas kub ib puag ncig kom raug.

Kauj Ruam 1: Yam Koj Xav Tau..

Yam Koj Xav Tau.. !!
Yam Koj Xav Tau.. !!

1. Particle Photon

2. ADT75

3. I²C Cable

4. I²C Shield rau Particle Photon

Kauj Ruam 2: Kev Sib Txuas:

Kev sib txuas
Kev sib txuas
Kev sib txuas
Kev sib txuas
Kev sib txuas
Kev sib txuas
Kev sib txuas
Kev sib txuas

Nqa daim I2C daim ntaub thaiv rau cov photon me me thiab maj mam thawb nws hla cov pins ntawm cov khoom sib nqus.

Tom qab ntawd txuas ib qho kawg ntawm I2C cable rau ADT75 sensor thiab lwm qhov kawg rau I2C daim ntaub thaiv.

Kev sib txuas tau qhia hauv daim duab saum toj no.

Kauj ruam 3: Code:

Txoj Cai
Txoj Cai

Cov lej me me rau ADT75 tuaj yeem rub tawm los ntawm peb qhov chaw khaws khoom github-DCUBE Store.

Nov yog qhov txuas rau tib yam:

github.com/DcubeTechVentures/ADT75/blob/master/Particle/ADT75.ino.

Peb tau siv ob lub tsev qiv ntawv rau cov lej me me, uas yog application.h thiab spark_wiring_i2c.h. Spark_wiring_i2c lub tsev qiv ntawv xav tau los pab txhawb I2C kev sib txuas lus nrog lub sensor.

Koj tseem tuaj yeem luam cov cai los ntawm no, nws tau muab raws li hauv qab no:

// Faib nrog daim ntawv tso cai yuav dawb.

// Siv nws txhua txoj hauv kev uas koj xav tau, muaj txiaj ntsig lossis pub dawb, muab nws haum rau hauv daim ntawv tso cai ntawm nws cov haujlwm ua haujlwm.

// ADT75

// Cov cai no tau tsim los ua haujlwm nrog ADT75_I2CS I2C Mini Module

#suav nrog

#suav nrog

// ADT75 I2C chaw nyob yog 0x48 (72)

#define Ntxiv 0x48

ntab cTemp = 0.0, fTemp = 0.0;

int cov = 0;

void teeb tsa ()

{

// Teem sib txawv

Particle.variable ("i2cdevice", "ADT75");

Particle.variable ("cTemp", cTemp);

// Pib I2C kev sib txuas lus raws li tus Xib Hwb

Hlau.begin ();

// Initialise serial communication, teeb baud tus nqi = 9600

Serial.begin (9600);

ncua (300);

}

void lub voj ()

{

unsigned int cov ntaub ntawv [2];

// Pib I2C kis tau tus mob

Wire.beginTransmission (Addr);

// Xaiv cov ntaub ntawv sau npe

Hlau.write (0x00);

// Nres I2C kev xa mus

Wire.endTransmission ();

// Thov 2 byte ntawm cov ntaub ntawv

Wire.requestFrom (Addr, 2);

// Nyeem 2 bytes ntawm cov ntaub ntawv

// temp msb, kub lsb

yog (Wire.available () == 2)

{

cov ntaub ntawv [0] = Wire.read ();

cov ntaub ntawv [1] = Wire.read ();

}

// Hloov cov ntaub ntawv mus rau 12 khoom

temp = ((cov ntaub ntawv [0] * 256) + cov ntaub ntawv [1]) / 16;

yog (temp> 2047)

{

temp -= 4096;

}

cTemp = temp * 0.0625;

fTemp = (cTemp * 1.8) + 32;

// Tso tawm cov ntaub ntawv rau dashboard

Particle.publish ("Kub hauv Celsius:", String (cTemp));

Particle.publish ("Kub hauv Fahrenheit:", String (fTemp));

ncua (1000);

}

Kauj Ruam 4: Cov ntawv thov:

ADT75 yog qhov tseeb, ntsuas kub digital. Nws tuaj yeem ua haujlwm nyob rau ntau qhov system suav nrog kev tswj hwm ib puag ncig, khoos phis tawj ntsuas cua sov thiab lwm yam.

Pom zoo: