Cov txheej txheem:

Arduino Project: Kev Ntsuas Ntau LoRa Module RF1276 rau GPS Nrhiav Tshuaj: 9 Cov Kauj Ruam (nrog Duab)
Arduino Project: Kev Ntsuas Ntau LoRa Module RF1276 rau GPS Nrhiav Tshuaj: 9 Cov Kauj Ruam (nrog Duab)

Video: Arduino Project: Kev Ntsuas Ntau LoRa Module RF1276 rau GPS Nrhiav Tshuaj: 9 Cov Kauj Ruam (nrog Duab)

Video: Arduino Project: Kev Ntsuas Ntau LoRa Module RF1276 rau GPS Nrhiav Tshuaj: 9 Cov Kauj Ruam (nrog Duab)
Video: Bluetooth Nerf turret (3D printed - Arduino) 2024, Hlis ntuj nqeg
Anonim
Arduino Project: Kev Ntsuas Ntau Yam LoRa Module RF1276 rau GPS Kev Nrhiav Tshuaj
Arduino Project: Kev Ntsuas Ntau Yam LoRa Module RF1276 rau GPS Kev Nrhiav Tshuaj

Kev sib txuas: USB - Serial

Xav tau: Chrome Browser

Xav tau: 1 X Arduino Mega

Xav tau: 1 X GPS

Xav tau: 1 X SD daim npav

Xav tau: 2 X LoRa Modem RF1276

Muaj nuj nqi: Arduino Xa GPS tus nqi mus rau lub hauv paus loj-Lub hauv paus tseem ceeb khaws cov ntaub ntawv hauv Dataino Server Lora Module: Ultra ntev ntau RF1276 los ntawm APPCONWIRELESS LoRa yog qhov tshiab, ntiag tug thiab nthuav dav-spectrum tes taws los piav txheej txheem uas tso cai xa cov ntaub ntawv ntawm cov ntaub ntawv qis heev-tus nqi mus rau qhov kawg ntev ntau yam. Cov ntaub ntawv qis-tus nqi (nqes mus rau ob peb bytes ib pliag) thiab LoRa kev hloov pauv ua rau tus neeg txais kev nkag siab tsawg heev, txhais tau tias hauv qhov kev ntsuas no txhais tau ntau dua 10km.

Kauj Ruam 1: Tsim Chaw Nres Tsheb

Tsev Tsim Chaw Nres Nkoj
Tsev Tsim Chaw Nres Nkoj
Tsev Tsim Chaw Nres Nkoj
Tsev Tsim Chaw Nres Nkoj

Khoos phis tawj dav siv internet txuas thiab LoRa modem txuas rau hauv USB chaw nres nkoj.

Arduino Tsheb Khoom ·

Lub thawv ntsuas

Anduino Mega txuas nrog ntu 2 rau GPS tus txais, thiab Serial 1 rau LoRa modem. Ib daim npav SD siv rau khaws cov ntaub ntawv.

Kauj Ruam 2: Thawj Xeem

Thawj Xeem
Thawj Xeem

· 10.6 Km ntawm txoj hauv kev hla cov nroog hauv nroog, chav tso duab thiab raws ntug dej hiav txwv ua nrog lub voj

Qhov sib piv ntawm kev txais tos /kis tau ntawm 321 /500TX taw tes

RX point ua

Kauj Ruam 3: Tsim Kev Sib Tham

Tsim qhov Interface
Tsim qhov Interface
Tsim qhov Interface
Tsim qhov Interface

1 - Teeb tsa txoj haujlwm tshiab LoRa

Nias lub cim cog los qhib qhov project teeb tsa

Kauj ruam 4: Ntxiv Ntsuas

Ntxiv Qhov Ntsuas
Ntxiv Qhov Ntsuas

2) Qhib lub ntsuas qhov ntsuas.

· 3) Scroll rau GPS.

· 4) Ntxiv ib qho rau ntawm lub rooj.

Kauj Ruam 5: Luag Gauge GPS thiab Ntxiv OpenStreetMap

Luag Gauge GPS thiab Ntxiv OpenStreetMap
Luag Gauge GPS thiab Ntxiv OpenStreetMap
Luag Gauge GPS thiab Ntxiv OpenStreetMap
Luag Gauge GPS thiab Ntxiv OpenStreetMap

· 5) Ntxiv OpenStreetMap daim ntawv qhia rau lub rooj

Rub tus tivthaiv GPS ntawm daim duab qhia chaw, OpenStreet daim ntawv qhia tau tsim.

Tsim qhov Interface

· 6) Hloov daim ntawv qhia tshiab

Hloov daim ntawv qhia sijhawm tshiab los ntawm 5000 txog 10000

Kauj Ruam 6: Luag GPS Gauge thiab Ntxiv Cov Lus Teev Npe

Luag GPS Gauge thiab Ntxiv Cov Lus Teev
Luag GPS Gauge thiab Ntxiv Cov Lus Teev

· 7) Ntxiv rau Table Log gauge.

Los ntawm kev rub lub ntsuas cua saum lub GPS icon lub rooj yog tsim cov lus ntsuas lub rooj

· 8) Hloov cov lus teev rooj tshiab. Hloov daim ntawv qhia sijhawm tshiab los ntawm 5000 txog 10000

Kho qhov chaw ntawm cov ntsuas

· 9) Luag cov ntsuas ntsuas kho qhov chaw ntawm cov ntsuas los ntawm kev rub lawv hla lub vijtsam.

· 10) Txuag qhov project

Kauj ruam 7: Tau txais Code

Tau Code
Tau Code

10) Qhib cov cai ntim

Khawm nyob rau sab saum toj txoj cai khawm, xaiv tag nrho thiab luam cov cai hauv paus.

Kauj Ruam 8: Arduino IDE

Arduino IDE Cov
Arduino IDE Cov

· 11) Muab tshuaj txhuam tus lej ntawm Arduino IDE

· 12) Kho qhov chaws Ntxiv kab no hauv cov lus txhais

Kauj ruam 9: Coding Paub meej

Ntxiv kab no hauv lub ntsiab lus

//*************************************************************************

// ** LIBRARY ** // ***************************************** ****************************************

#suav nrog // ++ lub tsev qiv ntawv GPS

#suav nrog // ++ SPI tsev qiv ntawv #suav nrog

// ++ SD tsev qiv ntawv //

*************************************************************************

// ** SD ** // ***************************************** ****************************************

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

// ** UNO: MOSI - tus pin 11, MISO - tus pin 12, CLK - tus pin 13, CS - tus pin 4

// (CS tus pin tuaj yeem hloov pauv) thiab tus pin #10 (SS) yuav tsum yog qhov tso tawm

// ** Mega: MOSI - tus pin 51, MISO - tus pin 50, CLK - tus pin 52, CS - tus pin 53

// (CS tus pin tuaj yeem hloov pauv) thiab tus pin #52 (SS) yuav tsum yog qhov tso tawm

// ** Leonardo: Txuas rau kho vajtse SPI ntawm ICSP header

// Pin 4 siv ntawm no kom sib xws nrog lwm cov piv txwv Arduino ua rau hauv chipSelect = 53;

// ++ SD tus pin xaiv

//*************************************************************************

// ** GPS ** // ****************************************** ****************************************

TinyGPS gps; // ++ GPS ntawm Serial2

tsis muaj dab tsi gpsdump (TinyGPS & gps); // ++ ib

bool newdataGPS = tsis tseeb; // ++ ib

Ntxiv kab no hauv kev teeb tsa ()

//***********************************************************************

// ** GPS teeb tsa tus lej ** // *************************************** ****************************************

Serial2.begin (9600); // ++ ib

ncua (1000); // ++ ib

//***********************************************************************

// ** SD Initializing ** // **************************************** **********************************

// nco ntsoov tias lub neej ntawd nti xaiv tus pin tau teeb tsa rau // ++

// tso tawm, txawm tias koj tsis siv nws: // ++

tus pinMode (SS, OUTPUT); // ++ ib

Serial.println (F ("Initializing SD card …")); // ++ ib

// pom tias daim npav muaj nyob thiab tuaj yeem pib ua ntej: // ++

yog (! SD.begin (chipSelect)) {// ++

Serial.println (F ("Daim npav ua tsis tiav, lossis tsis nyob tam sim no")); // ++ ib

// tsis txhob ua dab tsi ntxiv: // ++

rov qab; // ++ ib

} lwm { / ++

Serial.println (F ("SD daim npav OK")); // ++ ib

} // ++

Ntxiv cov kab no hauv voj () tsis muaj dab tsi

serialEvent2 (); // ++ hu rau GPS cov xwm txheej tshwm sim

Ntxiv SeriaEvent2 code

//*************************************************************************

// ** GPS serialEvent ** // **************************************** ******************************************

tsis muaj dab tsi serialEvent2 () {// ++

thaum (Serial2.available ()) {// ++

char c = Serial2.read (); // ++ ib

//Serial.print(c); // tsis pom zoo kom pom cov ntaub ntawv GPS nyoos // ++

yog (gps.encode (c)) {// ++

newdataGPS = muaj tseeb; // ++ ib

tawg; // tsis pom zoo los luam cov ntaub ntawv tshiab tam sim! // ++ ib

} // ++

} // ++

} // ++

Ntxiv GPS pov tseg voud

//*************************************************************************

// ** gps dump ** // **************************************** ******************************************

// ** Qhov siv tau ntawm latitude hauv qib yog -90 thiab +90. **

// ** Ntev ntev nyob hauv thaj tsam -180 thiab +180 **

// ** qhia meej txog txoj haujlwm sab hnub tuaj-hnub poob **

//** "123456789 1234567890" **

//** "000.00000;0000.00000" ** //*************************************************************************

void gpsdump (TinyGPS & gps) // ++

{ // ++

int xyoo; // ++ ib

byte hli, hnub, teev, feeb, thib ob, pua; // ++ ib

tsis tau kos npe hnub nyoog ntev; // ++ ib

gps.f_get_position (& LATGP00, & LONGP00, & hnub nyoog); // ++ ib

gps.crack_datetime (& xyoo, & hli, & hnub, & teev, // ++

& feeb, & thib ob, & thib pua, & hnub nyoog); // ++ ib

ntev lat, lon; // ++ ib

gps.get_position (& lat, & lon, & muaj hnub nyoog); // ++ ib

// *********************************************************************

// ** ua ib txoj hlua rau sib sau cov ntaub ntawv rau cav: **

// *********************************************************************

Txoj hlua dataString = ""; // ++ ib

dataString += (lat / 100000); // ++ ib

dataString += "."; cov. // ++ ib

dataString += lat - (lat / 100000) * 100000; // ++ ib

dataString += ";" cov; // ++ ib

dataString += (lon / 100000); // ++ ib

dataString += "."; cov. // ++ ib

dataString += lon - (lon / 100000) * 100000; // ++ ib

dataString += ";" cov; // ++ ib

dataString += Txoj hlua (static_cast (hnub))); // ++ ib

dataString += "/"; // ++ ib

dataString += String (static_cast (hli)); // ++ ib

dataString += "/"; // ++ ib

dataString += Txoj hlua (xyoo); // ++ ib

dataString += ";" cov; // ++ ib

dataString += Txoj hlua (static_cast (teev))); // ++ ib

dataString += ":"; cov. // ++ ib

dataString += Txoj hlua (static_cast (feeb))); // ++ ib

dataString += ":"; cov. // ++ ib

dataString += String (zoo li qub_cast (thib ob)); // ++ // ****************************************************** ******************************

// ** Txuag rau SD ** // *************************************** ********************************** ******

// 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. ** // ****************************************************** ***************************

Cov ntaub ntawv dataFile = SD.open ("gps00.txt", FILE_WRITE); // ++ ib

// ***********************************************************************

// ** yog tias muaj cov ntawv, sau rau nws: **

// ***********************************************************************

yog (dataFile) {// ++

dataFile.println (dataString); // ++ ib

dataFile.close (); cov // ++ ib

} lwm { / ++

Serial.println (F ("ERROR SD Write")); // ++ ib

} // ++

}

Yog tias koj xav rub tawm cov cai, thov mus saib nplooj ntawv no.

Pom zoo: