Cov txheej txheem:

Kev Saib Xyuas Tam Sim No Ntawm Arduino Nano (I2C): 5 Kauj Ruam
Kev Saib Xyuas Tam Sim No Ntawm Arduino Nano (I2C): 5 Kauj Ruam

Video: Kev Saib Xyuas Tam Sim No Ntawm Arduino Nano (I2C): 5 Kauj Ruam

Video: Kev Saib Xyuas Tam Sim No Ntawm Arduino Nano (I2C): 5 Kauj Ruam
Video: Computer Vision with Python! Resizing Images 2024, Kaum ib hlis
Anonim
Kev Saib Xyuas Tam Sim No Ntawm Arduino Nano (I2C)
Kev Saib Xyuas Tam Sim No Ntawm Arduino Nano (I2C)

Nyob zoo, Nyob zoo os.. !!

Ntawm no kuv (Somanshu Choudhary) sawv cev ntawm Dcube thev naus laus zis kev mus rau saib xyuas tam sim no siv Arduino nano, nws yog ib qho ntawm daim ntawv thov I2C raws tu qauv los nyeem cov ntaub ntawv analog ntawm Tam sim no Sensor TA12-200.

Kauj ruam 1: Txheej txheem cej luam

Txheej txheem cej luam
Txheej txheem cej luam
  1. TA12-200 yog AC lub ntsuas hluav taws xob tam sim no
  2. DATASHEET Txuas:
  3. Txoj haujlwm no ntsuas AC tus nqi tam sim no

Kauj ruam 2: Yam Koj Xav Tau / Txuas

Yam Koj Xav Tau / Txuas
Yam Koj Xav Tau / Txuas
  1. Arduino Nano Cov
  2. I²C Shield rau Arduino Nano
  3. USB Cable Hom A rau Micro Hom B 6 Taw Ntev
  4. I²C Kab
  5. I²C AC tam sim no Sensor ntawm ADC121C 12-Bit ADC I²C Mini Module
  6. CFL lossis Lub Teeb.
  7. PCV cov kab.

Kauj Ruam 3: Daim duab Circuit Court

Daim duab Circuit Court
Daim duab Circuit Court
Daim duab Circuit Court
Daim duab Circuit Court

Kauj ruam 4: Programming / Code

Programming / Txoj Cai
Programming / Txoj Cai

#suav nrog

void teeb tsa ()

{

// I2C chaw nyob ntawm ADC121C021, 0x50 cuam tshuam nrog TA12-200

#txhais ADC_ADDR 0x50

// Koom nrog I2c Bus li tus tswv

Hlau.begin ();

// Pib kev sib txuas lus sib txuas rau cov khoom siv hluav taws xob tso tawm

Serial.begin (9600);

}

void lub voj ()

{

// Pib kis nrog cov khoom siv ntawm I2C npav

Wire.beginTransmission (ADC_ADDR);

// Hu rau kev hloov pauv hloov npe, 0x00 (0)

Hlau.write (0x00);

// ncua (500);

// Thov 2 bytes

Wire.requestFrom (ADC_ADDR, 2);

// Nyeem cov bytes yog tias lawv muaj

yog (Wire.available () == 2)

{

int msb = Hlau.read ();

int lsb = Wire.read ();

// Xaus kev kis thiab tso I2C npav

Wire.endTransmission ();

// Xam tus nqi

int rawADC = msb * 256 + lsb;

rawADC = rawADC & 0x0fff;

// Tso tawm rau lub vijtsam

Serial.print ("ADC Tus Nqi:");

Serial.println (rawADC);

}

lwm tus

{

Serial.println ("Tsis txaus bytes muaj nyob ntawm xaim.");

}

ncua (100);

}

////////////////////////////////////////////////////////// ///////////////////////// NOTE ///////////////////////// //////////////////////////////////////////////////////////// /////////////////////////////

// Cov txiaj ntsig no nyob hauv mili amps

// Koj tseem tuaj yeem pom rms tus nqi tam sim no los ntawm kev nrhiav maxinmum nyeem ntawv thiab faib nws los ntawm 1.414

Kauj ruam 5:

Yog xav paub ntxiv thov mus saib peb lub xaib:

www.dcubetechnologies.com

Pom zoo: