Cov txheej txheem:

DIY GPS Tracker --- Daim ntawv thov nab nab: 5 Kauj Ruam (nrog Duab)
DIY GPS Tracker --- Daim ntawv thov nab nab: 5 Kauj Ruam (nrog Duab)
Anonim
DIY GPS Tracker --- Daim Ntawv Thov Python
DIY GPS Tracker --- Daim Ntawv Thov Python

Kuv tau koom nrog hauv kev sib tw ncaws pob ob lub lis piam dhau los. Tom qab ua tiav, Kuv xav txheeb xyuas txoj kev thiab qhov nrawm kuv caij thaum lub sijhawm ntawd. Hmoov tsis, nws tsis ua tiav. Tam sim no kuv siv ESP32 los ua GPS tracker, thiab kuv yuav coj nws mus sau kuv cov kev caij tsheb kauj vab lwm zaus. GPS tracker tuaj yeem txuag qhov chaw thiab sijhawm cov ntaub ntawv mus rau SD daim npav, thiab cov ntaub ntawv no tuaj yeem ua tiav thiab kos kab kos ntawm qhov nrug thiab nrawm nrog lub PC software.

Khoom siv:

Kho vajtse:

  • MakePython ESP32 (nrog Wrover)
  • MakePython A9G Cov

MakePython A9G pawg thawj coj yog GPS/GPRS nthuav dav lub rooj rau MakePython.

  • Roj teeb
  • Micro USB kab

Software:

  • Nab hab sej 3
  • uPyCraft_v1.1

Kauj ruam 1: Kev sib txuas

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

Txuas ob lub laug cam raws li tus pin. Tus qauv tuaj yeem siv los ntawm roj teeb lossis Micro USB cable.

Kauj ruam 2: Software hauv PC

Software hauv PC
Software hauv PC
Software hauv PC
Software hauv PC

Nab hab sej 3:

  • Koj tuaj yeem rub nws los ntawm no: Python3. Xaiv qhov 3.8.5 version, rub tawm thiab nruab nws.
  • "Ntxiv Python 3.8 rau PATH" xaiv yuav tsum raug tshuaj xyuas thaum lub sijhawm teeb tsa, raws li daim duab 1.
  • Yog tias lub tsev qiv ntawv siv los ntawm qhov program tsis raug teeb tsa, qhov program yuav qhia sai sai thaum nws tab tom ua haujlwm. Koj tuaj yeem khiav cov lus txib hauv qab no hauv cmd.exe rau nruab cov tsev qiv ntawv, raws li daim duab 2.

pip nruab xxx // xxx yog lub tsev qiv ntawv npe

pip tshem tawm xxx // xxx yog lub tsev qiv ntawv lub npe pip npe // luam tawm cov tsev qiv ntawv

Txoj Cai:

  • Koj tuaj yeem tau txais cov ntaub ntawv nab nab los ntawm no: Code. Cov ntaub ntawv nab nab yog "/Project_Gps-Trace-Analysis-master/Google_trace.py".
  • Kos ib txoj kev ntawm daim duab qhia chaw.

def tsim_html_map ():

gmap = gmplot. GoogleMapPlotter (lat_list [0], lon_list [0], 16) gmap.plot (lat_list, lon_list) gmap.marker (lat_list [0], lon_list [0], xim = 'xiav') gmap.marker (lat_list [dav - 1], lon_list [dav - 1], xim = 'liab') gmap.draw ("./ map -trace.html")

Kos cov duab nrawm nrawm lub sijhawm, nrug nrug lub sijhawm

plt.subplot (2, 1, 1)

plt.plot (time_list [0: -1], nrawm) plt.title ("Qhov nruab nrab Ceev:" + str (avg_speed)) # plt.xlabel ("Sijhawm") plt.ylabel ("Ceev (m/s)")) plt.subplot (2, 1, 2) plt.plot (time_list [0: -1], total_distance) plt.title ("Total Distance:" + str (round (total_distance [- 1], 2)))) plt.xlabel ("Sijhawm") plt.ylabel ("Nrug (m)") plt.draw () plt.pause (0) dhau

Kauj Ruam 3: Firmware Txog ESP32

Firmware Txog ESP32
Firmware Txog ESP32
Firmware Txog ESP32
Firmware Txog ESP32

uPyCraft_v1.1

  • Koj tuaj yeem rub nws los ntawm no: uPyCraft.
  • Txuas lub rooj tsavxwm mus rau PC los ntawm USB cable. Qhib uPyCraft_v1.1, xaiv cov cuab yeej: "Tool> board> esp32" thiab "Cuab Yeej> chaw nres nkoj> com*", nyem lub pob txuas ntawm sab xis.
  • Yog tias kev sib txuas tsis ua tiav, qhov kev hais kom sai yuav tshwm raws li "qhib qhov yuam kev, thov sim dua". Koj yuav tsum hloov kho lub firmware kom cog lus sib txuas ua tiav. Lub firmware rub tawm txuas yog LINK. Qhib "Cuab Yeej> BurnFirmware", teeb tsa qhov ntsuas, zoo li daim duab 3, thiab nyem OK.
  • Qhib Python cov ntaub ntawv, thiab nyem rau "DownloadAndRun" khawm ntawm sab xis. Qhov kev zov me nyuam tau rub tawm rau hauv pawg thawj coj, koj tuaj yeem pom nws hauv "ntaus ntawv" ntawv qhia zaub mov ntawm sab laug, zoo li daim duab 4.

Firmware thiab Download

Koj tuaj yeem tau txais cov firmware los ntawm no: Firmware.

Teeb kev sib txuas nrog SD daim npav module hauv cov ntawv: “/Project_Gps-Trace-Analysis-master/workspace/test.py”

# SD pib

spi = SPI (1, baudrate = 400000, polarity = 1, theem = 0, sck = Pin (14), mosi = Pin (13), miso = Pin (12)) spi.init () # Xyuas kom raug baudrate lcd. text ('SPI OK', 0, 8) sd = sdcard. SDCard (spi, Pin (32)) # Tau tshaj PCB vfs = os. VfsFat (sd) os.mount (vfs, "/SD") random.seed (len (os.listdir ("/SD"))) print ("SD OK") lcd.text ('SPI OK', 0, 16)

Teeb kev sib txuas nrog A9G tus qauv hauv cov ntawv: “/Project_Gps-Trace-Analysis-master/workspace/test.py”

# A9G qhib

A9G_RESET_PIN = Pin (33, Pin. OUT) A9G_RESET_PIN.value (0) # teeb tus pin rau lub sijhawm tsawg.sleep (1) A9G_PWR_KEY = Pin (27, Pin. OUT) A9G_PWR_KEY.value (0) time.sleep (1) A9G_PW.value (1) time.sleep (1) lcd.fill (0) lcd.text ('A9G qhib', 0, 0)

AT hais kom ua rau A9G module

AT+GPS = 1 # 1: Qhib GPS, 0: Tua lub GPS tawm

AT+LOCATION = 2 #Tau txais cov ntaub ntawv chaw nyob ntawm GPS, tsuav yog GPS tuaj yeem pom lub hnub qub ua ntej rov qab los, txwv tsis pub nws yuav rov qab GPS TSIS TXHOB TAM SIM NO AT+GPSRD = 0 #Nthuav qhia

Txuas lub rooj tsavxwm mus rau PC los ntawm USB cable, thiab siv uPyCraft txhawm rau rub tawm txhua cov ntaub ntawv hauv daim nplaub tshev "/Project_Gps-Trace-Analysis-master/workspace"

Kauj Ruam 4: Ua Cov Ntaub Ntawv

Ua Cov Ntaub Ntawv
Ua Cov Ntaub Ntawv
  • Luam cov ntawv TXT pib nrog "kab" hauv SD daim npav rau hauv daim nplaub tshev "/Project_Gps-Trace-Analysis-master".
  • Qhib Python cov ntaub ntawv nrog cov ntawv sau thiab hloov cov cai.

#Cov ntaub ntawv uas koj xav tau tshuaj xyuas

trace_file_name = "./trace4.txt"