Cov txheej txheem:

Kev Ntsuas Kub Siv AD7416ARZ thiab Particle Photon: 4 Kauj Ruam
Kev Ntsuas Kub Siv AD7416ARZ thiab Particle Photon: 4 Kauj Ruam

Video: Kev Ntsuas Kub Siv AD7416ARZ thiab Particle Photon: 4 Kauj Ruam

Video: Kev Ntsuas Kub Siv AD7416ARZ thiab Particle Photon: 4 Kauj Ruam
Video: Zoo Li No ~ GK ft. SIAx (Official HMONG Lyrics) 2024, Kaum ib hlis
Anonim
Image
Image

AD7416ARZ yog 10-Ntsuas qhov ntsuas kub nrog plaub txoj hauv kev sib piv rau cov hloov pauv digital thiab ib qho ntawm lub ntsuas kub ntsuas tau suav nrog hauv nws. Qhov ntsuas kub ntawm qhov chaw tuaj yeem nkag mus tau los ntawm ntau txoj hauv kev. Qhov ntsuas qhov ntsuas qhov ntsuas qhov ntsuas tau zoo tau dhau los ua tus qauv kev lag luam raws li daim ntawv, qhov tseem ceeb thiab kev txawj ntse, muab kev ntsuas ntsuas, ntsuas qhov ntsuas qhov ntsuas hauv digital, hom I2C.

Hauv qhov kev qhia no kev cuam tshuam ntawm AD7416ARZ sensor module nrog cov duab photon tau piav qhia. Txhawm rau nyeem qhov ntsuas kub, peb tau siv arduino nrog I2c adapter. Qhov I2C adapter ua rau kev txuas mus rau lub ntsuas qhov ntsuas tau yooj yim thiab ntseeg tau ntau dua.

Kauj Ruam 1: Yuav Tsum Kho Vajtse:

Yuav tsum tau kho vajtse
Yuav tsum tau kho vajtse
Yuav tsum tau kho vajtse
Yuav tsum tau kho vajtse
Yuav tsum tau kho vajtse
Yuav tsum tau kho vajtse

Cov ntaub ntawv uas peb xav tau kom ua tiav peb lub hom phiaj suav nrog cov khoom siv hauv qab no:

1. AD7416ARZ

2. Particle Photon

3. I2C Cable

4. I2C Shield rau particle photon

Kauj ruam 2: Khoos phis tawj sib txuas:

Kho vajtse Hookup
Kho vajtse Hookup
Kho vajtse Hookup
Kho vajtse Hookup

Tshooj khoos phis tawj sib txuas ntu piav qhia qhov txuas txuas txuas 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:

AD7416ARZ 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 siv qhov kev sib txuas 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 3: Txoj Cai Rau Kev Ntsuas Kub:

Txoj Cai Rau Kev Ntsuas Kub
Txoj Cai Rau Kev Ntsuas Kub

Cia peb pib nrog cov lej me me tam sim no.

Thaum siv lub ntsuas qhov ntsuas nrog qhov me me, 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.

Tag nrho cov cai hauv qab no tau muab rau hauv qab no kom yooj yim ntawm tus neeg siv:

#suav nrog

#suav nrog

// AD7416ARZ 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", "AD7416ARZ");

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

// Hloov cov ntaub ntawv mus rau 10 khoom

temp = ((cov ntaub ntawv [0] * 256) + (data [1] & 0xC0)) / 64;

yog (temp> 511)

{

temp -= 1024;

}

cTemp = ntsuas * 0.25;

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);

}

Particle.variable () muaj nuj nqi tsim cov kev hloov pauv kom khaws cov zis tawm ntawm lub sensor thiab Particle.publish () muaj nuj nqi qhia cov zis ntawm lub dashboard ntawm lub xaib.

Cov zis sensor tau pom hauv daim duab saum toj no rau koj siv.

Kauj Ruam 4: Cov ntawv thov:

Cov ntawv thov
Cov ntawv thov

AD7416ARZ yog 10-Ntsuas Kub ntsuas nrog plaub txoj hauv kev sib piv rau digital hloov pauv tuaj yeem ua haujlwm ntawm Kev Tshawb Nrhiav Cov Ntaub Ntawv nrog ntsuas kub ib puag ncig. Nws kuj tseem tuaj yeem ua haujlwm hauv Cov txheej txheem tswj kev lag luam, Automotive Roj teeb-them daim ntawv thov thiab Cov khoos phis tawj ntiag tug.

Pom zoo: