Cov txheej txheem:

Kub thiab Vaum Cov Ntaub Ntawv Logger Los Ntawm Arduino rau Android Xov Tooj Nrog SD Card Module Ntawm Bluetooth: 5 Kauj Ruam
Kub thiab Vaum Cov Ntaub Ntawv Logger Los Ntawm Arduino rau Android Xov Tooj Nrog SD Card Module Ntawm Bluetooth: 5 Kauj Ruam

Video: Kub thiab Vaum Cov Ntaub Ntawv Logger Los Ntawm Arduino rau Android Xov Tooj Nrog SD Card Module Ntawm Bluetooth: 5 Kauj Ruam

Video: Kub thiab Vaum Cov Ntaub Ntawv Logger Los Ntawm Arduino rau Android Xov Tooj Nrog SD Card Module Ntawm Bluetooth: 5 Kauj Ruam
Video: Xov Xwm 11/1/20: UN Tsab Ntawv Xa Rau Nom Tswv Los Tsuas Txog Hmoob Caub Fab 2024, Hlis ntuj nqeg
Anonim
Kub thiab Vaum Cov Ntaub Ntawv Logger Los Ntawm Arduino rau Android Xov Tooj Nrog SD Card Module Ntawm Bluetooth
Kub thiab Vaum Cov Ntaub Ntawv Logger Los Ntawm Arduino rau Android Xov Tooj Nrog SD Card Module Ntawm Bluetooth

Nyob Zoo Txhua Tus, Qhov no yog kuv thawj Phau Ntawv Qhia, Kuv vam tias kuv pab cov neeg tsim khoom raws li kuv tau txais txiaj ntsig nrog nws.

Feem ntau peb siv cov ntsuas ntsuas hauv peb cov phiaj xwm tab sis nrhiav txoj hauv kev los khaws cov ntaub ntawv, khaws nws thiab hloov nws Cov Xov Tooj lossis lwm yam khoom siv tam sim ntawd thiab wireless tsis yog cov txheej txheem npaj tau. Phau ntawv qhia no yuav coj koj mus dhau

  • Tau Txais Cov Ntaub Ntawv los ntawm Sensor (DHT 11) - ntsuas kub thiab av noo.
  • Khaws cov ntaub ntawv tau txais hauv SD daim npav nrog daim npav SD.
  • Hloov cov ntaub ntawv wireless siv Bluetooth mus rau kev cai tsim hauv Android App.
  • Khaws qhov tau txais qhov ntsuas qhov tseem ceeb raws li cov ntawv sau (.txt file).

Kauj Ruam 1: Daim Ntawv Teev Npe

Daim Ntawv Teev Npe
Daim Ntawv Teev Npe
Daim Ntawv Teev Npe
Daim Ntawv Teev Npe
Daim Ntawv Teev Npe
Daim Ntawv Teev Npe

Cia peb nqes los sau cov tub rog los ua txoj haujlwm txaus no.

  • Arduino Uno (lwm yam arduino kuj yuav haum)
  • micro SD daim npav module.
  • Daim npav SD daim npav (qhov kuv siv yog 8 GB, nws tau qhia kom siv> = 32 GB)
  • HC05 - Bluetooth module
  • DHT11 (Kub thiab Vaum Sensor)
  • Ib pawg ntawm jumpers.
  • Xov tooj Hauv

Kauj Ruam 2: Kev Sib Txuas:

Kev Sib Txuas
Kev Sib Txuas

Muab tso ua ke thiab txuas cov khoom siv yog ib nrab ua tiav rau txoj haujlwm. Cov khoom lag luam hais tau yooj yim muaj nyob hauv khw muag khoom hluav taws xob feem ntau thiab hauv online xws li Amazon.

Arduino - HC05 kev sib txuas (Bluetooth):

  • +5V - Vcc
  • Gnd - Yog
  • Pin 0 - Tx
  • Pin 1 - Rx

Arduino - SDcard module txuas:

  • +5V - Vcc
  • Gnd - Yog
  • Tus Pin 11 - MOSI (Tswv Qhia Tawm Qhev Hauv)
  • Tus Pin 12 - MISO (Tus Xib Hwb Hauv Qhua Tawm)
  • Tus Pin 13 - SCk (Moos synchronous)
  • Tus Pin 4 - CS (Chip Xaiv)

Arduino - HC05 kev sib txuas (Bluetooth):

  • +5V - Vcc
  • Gnd - Yog
  • Pin A0 - Teeb liab

Kauj ruam 3: Txheej txheem

Txheej txheem
Txheej txheem

Txuas txhua ntu raws li tau hais hauv cov kauj ruam dhau los, Nrog rau qhov no peb tuaj yeem sau cov cai hauv Arduino Lub Tswv Yim kom mus txog peb lub hom phiaj.

Qhov thib ob ntawm peb txoj haujlwm yog kom muaj Android app kom tau txais lub ntsuas qhov ntsuas, tso saib qhov tseem ceeb thiab khaws nws hauv cov ntawv hauv lub xov tooj ntawm tes. Kuv tau siv Thunkable los ua Android Application thiab tseem tau muab apk thiab aia rau nws.

Kauj Ruam 4: Arduino Code:

Arduino Code tau muab thiab piav qhia hauv qab no.

Tus lej arduino feem ntau piav qhia tus kheej nrog SD daim ntawv qiv ntawv thiab DHT11 lub tsev qiv ntawv. Lub bluetooth siv cov ntawv kho vajtse uas yog tus pin0 thiab tus pin1 ntawm arduino li no bluetooth hloov pauv tshwm sim nrog Serial print () cov haujlwm uas siv I2C raws tu qauv thiab daim npav SD daim npav siv SPI raws tu qauv rau kev sib txuas lus nrog nws.

/*

* SD daim npav txuas rau SPI npav raws li hauv qab no:

** MOSI - tus pin 11 ** MISO - tus pin 12 ** CLK - tus pin 13 ** CS - tus pin 4 (rau MKRZero SD: SDCARD_SS_PIN) * * HC 05 module txuas: ** TX - pin 0 (default) [tuaj yeem yog hloov yog tias siv Softwareserial] ** RX - tus pin 1 (lub neej ntawd) [tuaj yeem hloov pauv yog siv Softwareserial]

*/

#suav nrog

#ncig #ncig

Ua ntaub ntawv myFile;

dht DHT; #define DHT11_PIN A0

void teeb tsa () {

// Qhib kev sib txuas lus txuas thiab tos rau qhov chaw nres nkoj qhib: Serial.begin (9600); Serial.println ("Hom, / tStatus, / tHumidity (%), / tTemperature (C)"); thaum (! Serial) {; // tos rau qhov chaw nres nkoj txuas mus txuas. Xav tau rau ib txwm USB chaw nres nkoj nkaus xwb} DHTAcq (); sdCardWrite ("test3.txt"); sdCardRead ("test3.txt");

}

tsis muaj dab tsi DHTAcq ()

{Serial.println ("DHT11, / t"); int chk = DHT.read11 (DHT11_PIN); Serial.print (DHT.humidity, 1); Serial.print (", / t"); Serial.print (DHT.temperature, 1); ncua (2000); }

tsis muaj dabtsis sdCardWrite (String fileNameStr)

{Serial.println ("Initializing SD card"); yog (! SD.begin (4)) {Serial.println ("Kev pib ua tsis tiav."); rov qab; } Serial.println ("Kev pib ua tiav!"); // qhib cov ntawv. nco ntsoov tias tsuas yog ib daim ntawv tuaj yeem qhib ib zaug, // yog li koj yuav tsum kaw qhov no ua ntej qhib lwm qhov. myFile = SD.open (fileNameStr, FILE_WRITE); // yog tias cov ntawv qhib tau zoo, sau rau nws: yog (myFile) {myFile.println ("DHT11, / t"); int chk = DHT.read11 (DHT11_PIN); myFile.print (DHT.humidity, 1); myFile.print (", / t"); myFile.print (DHT.temperature, 1); myFile.close (); Serial.println ("ua tiav!"); ncua (200); /*Serial.print("Sau rau test.txt …"); myFile.println ("xeem 1, 2, 3."); // kaw cov ntaub ntawv: myFile.close (); Serial.println ("ua tiav."); */} lwm qhov {// yog tias cov ntaub ntawv tsis qhib, luam tawm qhov yuam kev: Serial.println ("yuam kev qhib test.txt"); }}

void sdCardRead (String fileName)

{// rov qhib cov ntawv rau nyeem: myFile = SD.open (fileName); yog (myFile) {Serial.println ("test.txt:"); // nyeem los ntawm cov ntawv kom txog thaum tsis muaj dab tsi ntxiv hauv nws: thaum (myFile.available ()) {Serial.write (myFile.read ()); } // kaw cov ntawv: myFile.close (); } lwm { / yog tias cov ntaub ntawv tsis qhib, luam qhov yuam kev: Serial.println ("yuam kev qhib test.txt"); }}

void voj () {

// tsis muaj dab tsi tshwm sim tom qab teeb tsa //Serial.println("test 1.. 2.. 3 "); // ncua (1000); }

Kauj ruam 5: Android App:

Hauv app
Hauv app
Hauv app
Hauv app

Android app tau ua nrog Thunkable daim ntawv thov nrog luag thiab poob qhov program. Nws yuav sau cov ntaub ntawv rau ntawm daim ntawv lo ntawm lub vijtsam thiab ib zaug Khw Cov Ntaub Ntawv khawm tau nyem rau ntawm qhov chaw AppInventor/Cov ntaub ntawv nrog lub npe ntaub ntawv uas tau muab tus lej.

Txoj haujlwm tuaj yeem txuas ntxiv kom muaj kev khaws cia offline ntawm txhua yam ntawm cov ntaub ntawv sensor uas peb xav tau los ntawm kev hloov pauv nrog cov yam ntxwv xav tau thiab lub app tuaj yeem txuas ntxiv kom rov qab tau cov ntaub ntawv los ntawm kev cia thiab tswj kom haum rau daim ntawv thov.

Pom zoo: