久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 42900|回復: 31
收起左側

自制基于arduino的GPS地圖導航系統

  [復制鏈接]
ID:113207 發表于 2016-4-11 01:33 | 顯示全部樓層 |閱讀模式
這是一篇關于動手制作基于arduino 和12864液晶模塊的圖形化顯示GPS導航系統的帖子,作品效果和成本可能無法和TB上的導航產品媲美,但是動手過程會帶給你樂趣和知識。

動手之前最好能具備一些背景知識:
1. arduino 相關基礎;
2. 能使用12864 液晶模塊;
3. 能夠用arduino 通過串口通信獲取GPS模塊定位信息;
4. 能夠用arduino 操作SD卡模塊;
搜索論壇即可找到相關內容。

制作所需主要硬件:
1. arduino UNO 1片;
2. 12864 液晶模塊 1片;
3. GPS模塊1片;
4. SD卡模塊及SD卡 1套;
101210kh8e8801hphm4sg4.jpg 212105s3qe9jinwvsbzvjd.jpg 115051ir121fwrzmr1riwu.jpg 1018301jpo1dz2um1mscwq.jpg 234337bta4qvlq0n0bt2v3.jpg

原理:
將地圖數據依據瓦片算法存儲在SD卡中,通過串口獲取GPS定位信息并從中解析出經緯度坐標,依據經緯度坐標讀取相應地圖數據顯示在12864液晶模塊上,同時顯示定位坐標點。
1. 地圖存儲算法——瓦片系統(Maps Tile System)
本制作采用的地圖數據和地圖存儲算法來源于微軟的bing maps并做了相應修改,具體可參考:
Bing Maps Tile System[1*]
Virtual Earth Tile Image URI 參數解析
Goolge and Microsoft Map Url Parameters
在瓦片系統中地圖采用金字塔式的分層存儲結構,不同層具有不同級別的地圖分辨率(地圖精細程度),每一層地圖被分割成等像素大小(256X256)的瓦片,算法要解決的問題就是給定經緯度坐標和縮放級別(層索引)得到具體相應的瓦片編號。
在連接[1*]的最后有算法實現的代碼可共參考。
2. 針對12864液晶模塊的設計
12864液晶模塊是128像素寬64像素高的單色液晶顯示模塊,本制作為了適應模塊顯示做出了兩個設計。
1). 將256X256像素的瓦片裁切成128X64像素大小的8份 子瓦片,如下圖所示:
221323u211s13ccbbkr3oe.png
每層每個瓦片均做相應處理。
2). 通過閾值方法將8位png索引圖像(bing maps 的道路數據)轉換成二進制地圖數據文件,為了能夠顯示原圖中的文字信息,采用多閾值提取求或方法提取原地圖中背景、地物和標注文字數據,由于標注文字和背景之間的擾動,提取效果有待改進。

顯示效果:
231937rwgiz6w8wnkgrrq6.jpg 231938yu7sygnk9kyvfnvs.jpg 231938xxmbmmst7suxdtff.jpg 231939v21fz3i52u82s282.jpg 231940qfdbhuzrra3jmabq.jpg 2319409y8200oloxrvszul.jpg 231941sui09ac0uyuqk0qa.jpg 231942eg5z5e51v13achrb.jpg 231942f5fa7tjdtmxllmdm.jpg 2319434qiw0wxwtheu8e9x.jpg 231944ojnk0znv2plndcqn.jpg 231944qdppcnnrc4ooaw6c.jpg 231945xr6qtwagr8brsj66.jpg 231946o7pzv3473ayag32a.jpg 231947xogrv7r8ra7i76at.jpg

arduino 代碼說明:
1. 在“LCD12864RSPI” 文件中加入畫點函數,減少重繪區域;
2. 使用占用內存小、具有只讀能力的SD模塊庫“petit_fatfs”;
3. 分配1K內存用于地圖數據緩存,由于SD卡庫只支持8.3文件名,地圖數據文件名采用十六進制不定長壓縮編碼方式命名。
代碼下載:
arduinoTile.rar (4.24 KB, 下載次數: 83) LCD12864RSPI.rar (1.86 KB, 下載次數: 61)
petit_fatfs.rar (16.88 KB, 下載次數: 64)
部分代碼預覽:
  1. //Demo LCD12864 spi


  2. #include "LCD12864RSPI.h"


  3. extern "C"
  4. {
  5. #include  
  6. #include
  7. #include   //not needed yet
  8. #include  //needed for strlen()
  9. #include
  10. }



  11. LCD12864RSPI::LCD12864RSPI()
  12. {
  13. this->DEFAULTTIME = 80; // 80 ms default time
  14. this->delaytime = DEFAULTTIME;
  15. }

  16. //*********************延時函數************************//
  17. void LCD12864RSPI::delayns(void)
  18. {   
  19. delayMicroseconds(delaytime);
  20. }


  21. void LCD12864RSPI::WriteByte(int dat)
  22. {
  23.     digitalWrite(latchPin, HIGH);
  24.     delayns();
  25.     shiftOut(dataPin, clockPin, MSBFIRST, dat);
  26.     digitalWrite(latchPin, LOW);
  27. }


  28. void LCD12864RSPI::WriteCommand(int CMD)
  29. {
  30.    int H_data,L_data;
  31.    H_data = CMD;
  32.    H_data &= 0xf0;           //屏蔽低4位的數據
  33.    L_data = CMD;             //xxxx0000格式
  34.    L_data &= 0x0f;           //屏蔽高4位的數據
  35.    L_data <<= 4;             //xxxx0000格式
  36.    WriteByte(0xf8);          //RS=0,寫入的是指令;
  37.    WriteByte(H_data);
  38.    WriteByte(L_data);
  39. }


  40. void LCD12864RSPI::WriteData(int CMD)
  41. {
  42.    int H_data,L_data;
  43.    H_data = CMD;
  44.    H_data &= 0xf0;           //屏蔽低4位的數據
  45.    L_data = CMD;             //xxxx0000格式
  46.    L_data &= 0x0f;           //屏蔽高4位的數據
  47.    L_data <<= 4;             //xxxx0000格式
  48.    WriteByte(0xfa);          //RS=1,寫入的是數據
  49.    WriteByte(H_data);
  50.    WriteByte(L_data);
  51. }



  52. void LCD12864RSPI::Initialise()
  53. {
  54.     pinMode(latchPin, OUTPUT);     
  55.     pinMode(clockPin, OUTPUT);   
  56.     pinMode(dataPin, OUTPUT);
  57.     digitalWrite(latchPin, LOW);
  58.     delayns();

  59.     WriteCommand(0x30);        //功能設定控制字
  60.     WriteCommand(0x0c);        //顯示開關控制字
  61.     WriteCommand(0x01);        //清除屏幕控制字
  62.     WriteCommand(0x06);        //進入設定點控制字
  63. }


  64. void LCD12864RSPI::CLEAR(void)
  65. {  
  66.     WriteCommand(0x30);//
  67.     WriteCommand(0x01);//清除顯示
  68. }


  69. void LCD12864RSPI::DisplayString(int X,int Y,uchar *ptr,int dat)
  70. {
  71.   int i;

  72.   switch(X)
  73.    {
  74.      case 0:  Y|=0x80;break;

  75.      case 1:  Y|=0x90;break;

  76.      case 2:  Y|=0x88;break;

  77.      case 3:  Y|=0x98;break;

  78.      default: break;
  79.    }
  80.   WriteCommand(Y); // 定位顯示起始地址

  81.   for(i=0;i<dat;i++)
  82.     {
  83.       WriteData(ptr[i]);//顯示漢字時注意碼值,連續兩個碼表示一個漢字
  84.     }
  85. }



  86. void LCD12864RSPI::DisplaySig(int M,int N,int sig)
  87. {
  88.   switch(M)
  89.    {
  90.      case 0:  N|=0x80;break;

  91.      case 1:  N|=0x90;break;

  92.      case 2:  N|=0x88;break;

  93.      case 3:  N|=0x98;break;

  94.      default: break;
  95.    }
  96.   WriteCommand(N); // 定位顯示起始地址
  97.   WriteData(sig); //輸出單個字符
  98. }

  99. void LCD12864RSPI::DrawPoint(int X,int Y,uchar *p)
  100. {
  101.         int x,y,i;
  102.         int tmp;
  103.       
  104.       if(Y<32)
  105.             {
  106.              x=  0x80;
  107.              y=Y+0x80;
  108.             }
  109.            else
  110.             {
  111.               x= 0x88;
  112.               y=Y-32+0x80;   
  113.             }         
  114.            WriteCommand(0x34);        //寫入擴充指令命令
  115.            WriteCommand(y);           //寫入y軸坐標
  116.            WriteCommand(x);           //寫入x軸坐標
  117.            WriteCommand(0x30);        //寫入基本指令命令
  118.            tmp=Y*16;
  119.                    for(i=0;i<round(x 8.0+0.5);i++)
  120.                  {
  121.                     WriteData(p[tmp++]);
  122.           }

  123.         WriteCommand(0x34);        //寫入擴充指令命令
  124.         WriteCommand(0x36);        //顯示圖象
  125. }


  126. void LCD12864RSPI::DrawFullScreen(uchar *p)
  127. {
  128.       int ygroup,x,y,i;
  129.       int temp;
  130.       int tmp;
  131.             
  132.       for(ygroup=0;ygroup<64;ygroup++)           //寫入液晶上半圖象部分
  133.         {                           //寫入坐標
  134.            if(ygroup<32)
  135.             {
  136.              x=0x80;
  137.              y=ygroup+0x80;
  138.             }
  139.            else
  140.             {
  141.               x=0x88;
  142.               y=ygroup-32+0x80;   
  143.             }         
  144.            WriteCommand(0x34);        //寫入擴充指令命令
  145.            WriteCommand(y);           //寫入y軸坐標
  146.            WriteCommand(x);           //寫入x軸坐標
  147.            WriteCommand(0x30);        //寫入基本指令命令
  148.            tmp=ygroup*16;
  149.            for(i=0;i<16;i++)
  150.                  {
  151.                     temp=p[tmp++];
  152.                     WriteData(temp);
  153.                }
  154.           }
  155.         WriteCommand(0x34);        //寫入擴充指令命令
  156.         WriteCommand(0x36);        //顯示圖象
  157. }


  158. LCD12864RSPI LCDA = LCD12864RSPI();
復制代碼




生成地圖程序(需要連接互聯網):
234950exxtfe3hhktf0333.png
通過設置地圖范圍經緯度信息獲取要使用定位的區域,可通過google earth 等能顯示經緯度的軟件或網頁獲取經緯度的最大最小值(上大下小,右大左小),
23562326f6fffvllvsl6v1.png
縮放級別建議設置范圍1~15,較大地圖范圍和較高縮放級別會增加地圖下載、顯示加載的時間。


maptile.rar (8.73 KB, 下載次數: 60) 需要 .net2.0以上庫支持。
回復

使用道具 舉報

ID:113207 發表于 2016-4-11 01:35 | 顯示全部樓層
自制基于arduino的GPS地圖導航系統2.0
主要算法類似。

113820u2ib67bqg2mny7ab.jpg 113822fr2z25fjd8n8r82f.jpg 113824q6s6h6hh5k66z09h.jpg 113825v9dpioim3f0nz3qn.jpg 113827j11i3jriou2iirmz.jpg

屏幕采用oled RGB 96*64 ,使用三軸磁阻獲取羅盤信息(受周圍磁場干擾較大),使用SD卡存儲地圖數據,使用TinyGPS處理GPS數據。

oled RGB 96*64 使用的是lm095cg-096064

接線方法和代碼如下:
  1.     //OLED LM095CG-096064 - UNO
  2.     //E/RD#(12) - VCC
  3.     //R/W#(13) - GND
  4.     //D/C#(14) - A0
  5.     //RES#(15) - A1
  6.     //CS#(16) - A2
  7.     //D7(4) - 7
  8.     //D6(5) - 6
  9.     //D5(6) - 5
  10.     //D4(7) - 4
  11.     //D3(8) - 3
  12.     //D2(9) - 2
  13.     //D1(10) - 9
  14.     //D0(11) - 8

  15.     /***********************************************************/
  16.     //oled pin define
  17.     /***********************************************************/
  18.     #define CS A2
  19.     #define DC A0
  20.     #define RES A1
  21.     /***********************************************************/
  22.     // special defines for the dataport
  23.     /***********************************************************/
  24.     #define DATAPORT1 PORTD
  25.     #define DATAPIN1 PIND
  26.     #define DATADDR1 DDRD

  27.     #define DATAPORT2 PORTB
  28.     #define DATAPIN2 PINB
  29.     #define DATADDR2 DDRB

  30.     #define DATA1_MASK 0xFC  // top 6 bits
  31.     #define DATA2_MASK 0x03  // bottom 2 bits
復制代碼
  1. /* write by davidce
  2. davidce@163.com
  3. 2013.6.10
  4. v1.0
  5. */

  6. //********************************************
  7. //low level function
  8. //********************************************
  9. /**********************************************
  10. * // Write Command
  11. **********************************************/
  12. static void write_command(unsigned char Command_value)
  13. {
  14.   digitalWrite(CS, LOW);
  15.   digitalWrite(DC, LOW);
  16.   DATAPORT2 = (DATAPORT2 & DATA1_MASK) |
  17.     (Command_value & DATA2_MASK);
  18.   DATAPORT1 = (DATAPORT1 & DATA2_MASK) |
  19.     (Command_value & DATA1_MASK); // top 6 bits
  20.   digitalWrite(CS, HIGH);
  21. }
  22. /**********************************************
  23. * // Write Data
  24. **********************************************/
  25. static void write_Data(unsigned char Data_value)
  26. {
  27.   digitalWrite(CS, LOW);
  28.   digitalWrite(DC, HIGH);
  29.   DATAPORT2 = (DATAPORT2 & DATA1_MASK) |
  30.     (Data_value & DATA2_MASK);
  31.   DATAPORT1 = (DATAPORT1 & DATA2_MASK) |
  32.     (Data_value & DATA1_MASK); // top 6 bits
  33.   digitalWrite(CS, HIGH);
  34. }
  35. /********************************************
  36. * // Draw Picture
  37. ********************************************/
  38. static void drawPicFromFlash(uint8_t x0,uint8_t y0,uint8_t w,uint8_t h,const PROGMEM char *c)                                               
  39. {
  40.   digitalWrite(DC, LOW);  //solve a bug of write_command defore write_data
  41.   write_command(0x15); //set column address
  42.   write_command(x0); //column address start 00
  43.   write_command(x0+w-1); //column address end 95
  44.   write_command(0x75); //set row address
  45.   write_command(y0); //row address start 00
  46.   write_command(y0+h-1); //row address end 63

  47.   unsigned char k,i;
  48.   for(k=0;k<h;k++)
  49.   {
  50.     for(i=0;i<w;i++)
  51.     {      
  52.       write_Data(pgm_read_byte(c++));
  53.       write_Data(pgm_read_byte(c++));
  54.     }
  55.   }
  56. }
  57. /********************************************
  58. * // Fill color
  59. ********************************************/
  60. static void fill_color (uint8_t startx,uint8_t endx,uint8_t starty,uint8_t endy,unsigned char dat1,unsigned char dat2)                                               
  61. {
  62.   digitalWrite(DC, LOW);  //solve a bug of write_command defore write_data
  63.   write_command(0x15); //set column address
  64.   write_command(startx); //column address start 00
  65.   write_command(endx-1); //column address end 95
  66.   write_command(0x75); //set row address
  67.   write_command(starty); //row address start 00
  68.   write_command(endy-1); //row address end 63
  69.   unsigned char k,i;
  70.   for(k=starty;k<endy;k++)
  71.   {
  72.     for(i=startx;i<endx;i++)
  73.     {      
  74.       write_Data(dat1);
  75.       write_Data(dat2);
  76.     }
  77.   }
  78. }
  79. /********************************************
  80. * // DrawRectangle
  81. ********************************************/
  82. static void drawRectangle(unsigned char startx,unsigned char starty,
  83. unsigned char endx,unsigned char endy,
  84. unsigned char BcolorR,unsigned char BcolorB,unsigned char BcolorG,
  85. unsigned char FcolorR,unsigned char FcolorB,unsigned char FcolorG,
  86. boolean isFill)
  87. {
  88.   digitalWrite(DC, LOW);  //solve a bug of write_command defore write_data
  89.   write_command(0x26);
  90.   if(isFill)
  91.   {
  92.     write_command(0x01);
  93.   }
  94.   else
  95.   {
  96.     write_command(0x00);
  97.   }
  98.   write_command(0x22);
  99.   write_command(startx);
  100.   write_command(starty);
  101.   write_command(endx);
  102.   write_command(endy);
  103.   write_command(BcolorR);
  104.   write_command(BcolorB);
  105.   write_command(BcolorG);
  106.   write_command(FcolorR);
  107.   write_command(FcolorB);
  108.   write_command(FcolorG);
  109. }
  110. /********************************************
  111. * // cover color format from 888 to 565
  112. ********************************************/
  113. static uint16_t Color565(uint8_t r, uint8_t g, uint8_t b) {
  114.   uint16_t c;
  115.   c = r >> 3;
  116.   c <<= 6;
  117.   c |= g >> 2;
  118.   c <<= 5;
  119.   c |= b >> 3;
  120.   return c;
  121. }
  122. /********************************************
  123. * // DrawLine
  124. ********************************************/
  125. static void drawLine(unsigned char startx,unsigned char starty,
  126. unsigned char endx,unsigned char endy,
  127. unsigned char colorR,unsigned char colorB,unsigned char colorG)
  128. {
  129.   digitalWrite(DC, LOW);  //solve a bug of write_command
  130.   write_command(0x21);
  131.   write_command(startx);
  132.   write_command(starty);
  133.   write_command(endx);
  134.   write_command(endy);
  135.   write_command(colorR);
  136.   write_command(colorB);
  137.   write_command(colorG);
  138. }
  139. /***************************************************/
  140. //oled Initial
  141. /***************************************************/
  142. static void Initial_SSD1330ZB()
  143. {
  144.   write_command(0xfd); // command lock
  145.   write_command(0x12);
  146.   write_command(0xae); // display off
  147.   write_command(0xa4); // Normal Display mode
  148.   write_command(0x15); //set column address
  149.   write_command(0x00); //column address start 00
  150.   write_command(0x5f); //column address end 95
  151.   write_command(0x75); //set row address
  152.   write_command(0x00); //row address start 00
  153.   write_command(0x3f); //row address end 63
  154.   write_command(0x87); //master current control
  155.   write_command(0x0A);
  156.   write_command(0x81); //Set Contrast for Color A
  157.   write_command(0x85); //91
  158.   write_command(0x82); //Set Contrast for Color B
  159.   write_command(0x56); //50
  160.   write_command(0x83); //Set Contrast for Color C
  161.   write_command(0x7f); //7d
  162.   write_command(0x8a);  // set scond pre-change speed of Color A
  163.   write_command(0x64);
  164.   write_command(0x8b);  // set scond pre-change speed of Color B
  165.   write_command(0x78);
  166.   write_command(0x8c);  // set scond pre-change speed of Color C
  167.   write_command(0x64);
  168.   write_command(0xa0); //set re-map & data format
  169.   write_command(0x72); //Horizontal address increment
  170.   write_command(0xa1); //set display start line
  171.   write_command(0x00); //start 00 line
  172.   write_command(0xa2); //set display offset
  173.   write_command(0x00);
  174.   write_command(0xa8); //set multiplex ratio
  175.   write_command(0x3f); //64MUX
  176.   write_command(0xb0); //set power save
  177.   write_command(0x1a);
  178.   write_command(0xb1);
  179.   write_command(0xf1); // Phase 2 period Phase 1 period
  180.   write_command(0xb3); // Set Display Clock Divide Ratio/ Oscillator Frequency
  181.   write_command(0xd0);
  182.   write_command(0xbb); // set pre-charge
  183.   write_command(0x3e);
  184.   write_command(0xbe); //set Vcomh
  185.   write_command(0x3e);
  186.   write_command(0xad); //Select external VCC supply at Display ON
  187.   write_command(0x8e); //Select External VP voltage supply
  188.   write_command(0xaf); //display on
  189. }
  190. //********************************************
  191. //high level function
  192. //********************************************
  193. /********************************************
  194. * // DrawPixel
  195. ********************************************/
  196. static void drawPixel(unsigned char px,unsigned char py,
  197. unsigned char colorR,unsigned char colorB,unsigned char colorG)
  198. {
  199.   drawLine(px,py,px,py,colorR,colorB,colorG);
  200. }
  201. /********************************************
  202. * // draw a character
  203. ********************************************/
  204. static void drawChar(uint8_t x, uint8_t y, char c,uint8_t colorR,uint8_t colorB,uint8_t colorG,uint8_t size) {
  205.   uint8_t tempx,tempy;
  206.   uint8_t i,j;
  207.   for (i =0; i<5; i++ ) {
  208.     uint8_t line = pgm_read_byte(font+(c*5)+i);
  209.     for (j = 0; j<8; j++) {
  210.       if (line & 0x1) {
  211.         if (size == 1) // default size
  212.           drawPixel(x+i, y+j, colorR,colorB,colorG);
  213.         else {  // big size
  214.           tempx= x+i*size;
  215.           tempy= y+j*size;
  216.           drawRectangle(tempx,tempy,tempx + size,tempy + size, colorR,colorB,colorG,colorR,colorB,colorG,true);
  217.         }
  218.       }
  219.       line >>= 1;
  220.     }
  221.   }
  222. }
  223. /********************************************
  224. * // DrawString
  225. ********************************************/
  226. static void drawString(uint8_t x, uint8_t y, char *c,uint8_t colorR,uint8_t colorB,uint8_t colorG,uint8_t size) {
  227.   if(size>0)
  228.   {
  229.     while (c[0] != 0) {
  230.       drawChar(x, y, c[0], colorR,colorB,colorG, size);
  231.       x += size*6;
  232.       c++;
  233.     }
  234.   }
  235. }
  236. /********************************************
  237. * // DrawCircleHelper
  238. ********************************************/
  239. static void drawCircleHelper(uint8_t x0, uint8_t y0,
  240. uint8_t r, uint8_t cornername,
  241. uint8_t colorR,uint8_t colorB,uint8_t colorG) {
  242.   int16_t f = 1 - r;
  243.   int16_t ddF_x = 1;
  244.   int16_t ddF_y = -2 * r;
  245.   int16_t x = 0;
  246.   int16_t y = r;
  247.   while (x<y) {
  248.     if (f >= 0) {
  249.       y--;
  250.       ddF_y += 2;
  251.       f += ddF_y;
  252.     }
  253.     x++;
  254.     ddF_x += 2;
  255.     f += ddF_x;
  256.     if (cornername & 0x4) {
  257.       drawPixel(x0 + x, y0 + y,  colorR,colorB,colorG);
  258.       drawPixel(x0 + y, y0 + x,  colorR,colorB,colorG);
  259.     }
  260.     if (cornername & 0x2) {
  261.       drawPixel(x0 + x, y0 - y,  colorR,colorB,colorG);
  262.       drawPixel(x0 + y, y0 - x,  colorR,colorB,colorG);
  263.     }
  264.     if (cornername & 0x8) {
  265.       drawPixel(x0 - y, y0 + x,  colorR,colorB,colorG);
  266.       drawPixel(x0 - x, y0 + y,  colorR,colorB,colorG);
  267.     }
  268.     if (cornername & 0x1) {
  269.       drawPixel(x0 - y, y0 - x,  colorR,colorB,colorG);
  270.       drawPixel(x0 - x, y0 - y,  colorR,colorB,colorG);
  271.     }
  272.   }
  273. }
  274. /********************************************
  275. * // DrawCircle
  276. ********************************************/
  277. static void drawCircle(uint8_t x0, uint8_t y0,
  278. uint8_t r,
  279. uint8_t colorR,uint8_t colorB,uint8_t colorG)
  280. {
  281.   drawCircleHelper(x0, y0, r, 0xF, colorR,colorB,colorG);
  282.   drawPixel(x0, y0+r, colorR,colorB,colorG);
  283.   drawPixel(x0, y0-r, colorR,colorB,colorG);
  284.   drawPixel(x0+r, y0, colorR,colorB,colorG);
  285.   drawPixel(x0-r, y0, colorR,colorB,colorG);
  286. }
  287. /********************************************
  288. * // drawTriangle
  289. ********************************************/
  290. static void drawTriangle(uint8_t x0, uint8_t y0,
  291. uint8_t x1, uint8_t y1,
  292. uint8_t x2, uint8_t y2,
  293. unsigned char colorR,unsigned char colorB,unsigned char colorG)
  294. {
  295.   drawLine(x0, y0, x1, y1, colorR,colorB,colorG);
  296.   drawLine(x1, y1, x2, y2, colorR,colorB,colorG);
  297.   drawLine(x2, y2, x0, y0, colorR,colorB,colorG);
  298. }
  299. /********************************************
  300. * // init color OLED
  301. ********************************************/
  302. static void initOLED()
  303. {
  304.   pinMode(CS, OUTPUT);
  305.   pinMode(DC, OUTPUT);
  306.   pinMode(RES, OUTPUT);
  307.   //set pin output mode
  308.   DATADDR2 |= DATA2_MASK;
  309.   DATADDR1 |= DATA1_MASK;
  310.   //reset oled model
  311.   digitalWrite(RES, LOW);
  312.   delay(50);
  313.   digitalWrite(RES, HIGH);
  314.   delay(50);
  315.   Initial_SSD1330ZB();

  316.   fill_color(0,96,0,64,0x00,0x00);
  317. }
復制代碼



代碼僅供參考。
感謝 czad 贈送的atmge328p的貼片板和好人做到底的geek精神!

</endx;i++)
</endy;k++)
</w;i++)
</h;k++)
回復

使用道具 舉報

ID:113207 發表于 2016-4-11 01:39 | 顯示全部樓層
自制基于arduino的GPS地圖導航系統3.0
最后一個版本,主要用來在跑步的時候定位和記錄路徑。
使用1.8寸TFT屏,128*160分辨率,SPI接口。采用Atmega 328為主控芯片。

212954n4bpbww2ujj2r2fs.png
5V輸入鋰電池充電板,系統電壓3.3V。
212955xmykjv6mnzkvetcn.png
211208zs99xx5ar9s5r39x.jpg
左側黑色按鈕放大,右側紅色按鈕縮小,長按紅色按鈕(>=2秒)錄制軌跡,再次長按停止錄制。
211232bf0udjsv98zvyfv8.jpg 211233pjxxr380cr3izmic.jpg 211234xnp4e70poen27reu.jpg
演示如下:




210246ry6t7t9906bxg7xh.jpg
藍色的點代表歷史路徑,刷屏后消失不保存,右下角REC字樣表示儀器正在錄制軌跡,存在SD卡中。
下部綠色顯示經緯度信息,紅色顯示時間和日期,藍色顯示海拔高度、速度和朝向。從圖中歷史軌跡點可看出數據漂移較多,原因可能是1.GPS模塊精度不高;2.GPS模塊應該設置在儀器的上方;3.需要采用濾波算法過濾。

地圖數據存在SD卡中,目錄結構如下:
213827x1l7j00t0ku304n0.png
TRACK文件為軌跡文件

這是地圖下載程序,需要.net Framework 4 支持
Release.rar (1.03 MB, 下載次數: 65)
這是Arduino 程序
appMaster.rar (5.5 KB, 下載次數: 43)
支持的庫文件
lib.rar (161.98 KB, 下載次數: 41)

串口速率與GPS模塊要設置一致,接線方式如下:
//TFT SDA -> UNO 11
//TFT SCK -> UNO 13
#define TFT_CS  10  // Chip select line for TFT display
#define TFT_A0   9  // Data/command line for TFT
#define TFT_RST  8  // Reset line for TFT (or connect to +5V)
#define TFT_LED  A0
#define SD_CS    4  // Chip select line for SD card
//SD MISO -> UNO 12
//SD SCK -> UNO 13
//SD MOSI -> UNO 11

//GPS tx - UNO rx
//GPS rx - UNO tx

#define BTNZOOMIN 2
#define BTNZOOMOUT 3

撥動開關控制電池充電和儀器開關,電池接中間引腳,充電板和儀器電源各接兩邊。

224855t2io7t6ipm8dre86.png
點擊“顯示地圖”出現地圖窗口,地圖可能加載較慢,通過鼠標左鍵拖拽進行平移,鼠標滾輪進行放大縮小,瀏覽到感興趣的區域,點擊“選擇區域”并在地圖中點擊確定多邊形的頂點,雙擊左鍵繪制結束,通過繪制多邊形確定下載區域,關閉地圖窗口,其它參數默認,點擊確定并設置下載路徑進行下載。將下載路徑下的MAP文件夾替換SD卡相應目錄下的MAP文件夾即可。

下一步功能,將軌跡上傳到網上并可以共享;添加歷史軌跡回放功能;實現平滑卷屏效果,不過328的計算能力可能無法滿足。

回復

使用道具 舉報

ID:149758 發表于 2016-11-23 16:55 | 顯示全部樓層
很好。
回復

使用道具 舉報

ID:232117 發表于 2017-9-9 18:33 | 顯示全部樓層
樓主求全部資料發一份郵箱2272599707@qq.com
回復

使用道具 舉報

ID:255408 發表于 2017-11-29 21:19 | 顯示全部樓層
果然牛人
回復

使用道具 舉報

ID:255408 發表于 2017-11-29 21:28 | 顯示全部樓層
樓主 我下載了下載地圖的軟件release,使用時下載不成功 顯示 “下載 1失敗”
請問下這是什么原因呢
回復

使用道具 舉報

ID:253733 發表于 2017-12-10 09:50 | 顯示全部樓層
很感 興趣,求接線圖、全部資料QQ: 1360667@qq.com
回復

使用道具 舉報

ID:255869 發表于 2017-12-16 11:15 | 顯示全部樓層
厲害!請問能否發一下接線圖和資料~  yht1592754117@126.com
回復

使用道具 舉報

ID:278630 發表于 2018-1-29 00:16 | 顯示全部樓層
想問一下樓主,下載地圖時,顯示下載1失敗,下載3失敗是什么原因呢,影響嗎
回復

使用道具 舉報

ID:136110 發表于 2018-2-12 15:29 | 顯示全部樓層
跪求用oled 12c 12864的版本,買不起lcd啊
回復

使用道具 舉報

ID:289840 發表于 2018-3-9 21:37 | 顯示全部樓層
樓主能發下接線圖和相關資料嗎
回復

使用道具 舉報

ID:308602 發表于 2018-5-26 22:28 | 顯示全部樓層
請問那個v1版本總顯示“Card Error”怎么回事???
回復

使用道具 舉報

ID:276685 發表于 2018-8-17 19:21 | 顯示全部樓層
樓主我那個v3.0程序和地圖都沒問題就是一直提示gps bad。我那個定位模塊是sim868,就是不知道程序兼容的是什么gps協議,電腦測試gps定位模塊沒有問題
回復

使用道具 舉報

ID:236106 發表于 2018-9-14 17:04 | 顯示全部樓層
樓主 用UNO下載V3程序  報錯 <Adafruit_ST7735.h> 庫有問題,幫忙提示一下  是我的打開姿勢不對嗎
回復

使用道具 舉報

ID:445463 發表于 2018-12-20 11:35 | 顯示全部樓層
感謝樓主分享
回復

使用道具 舉報

ID:445463 發表于 2018-12-20 11:36 | 顯示全部樓層
很感 興趣,求接線圖、全部資料 383985046@qq.com
回復

使用道具 舉報

ID:465223 發表于 2019-1-11 15:15 | 顯示全部樓層
求全套資料741176472@qq.com
回復

使用道具 舉報

ID:452731 發表于 2019-1-20 22:43 | 顯示全部樓層
這個很牛啊
回復

使用道具 舉報

ID:79544 發表于 2019-3-3 11:23 | 顯示全部樓層
太好的資料啦,感謝樓主分享!!!!!!
回復

使用道具 舉報

ID:316761 發表于 2019-5-12 21:33 | 顯示全部樓層
希望樓主也發一份完整資料哇,3102845014@qq.com
回復

使用道具 舉報

ID:316761 發表于 2019-5-17 00:27 | 顯示全部樓層
sf5a1 發表于 2018-9-14 17:04
樓主 用UNO下載V3程序  報錯  庫有問題,幫忙提示一下  是我的打開姿勢不對嗎

一樣的問題。。。。
回復

使用道具 舉報

ID:300101 發表于 2019-11-9 21:41 | 顯示全部樓層
很感興趣,求接線圖、全部資料 20171979@qq.com
回復

使用道具 舉報

ID:463062 發表于 2020-2-22 22:06 | 顯示全部樓層
太厲害了吧,樓主能共享一下資料學習一下嗎嗚嗚嗚,我還是個小菜鳥
郵箱435042110@qq.com
回復

使用道具 舉報

ID:716703 發表于 2020-3-31 08:12 | 顯示全部樓層
提供一個Atmega 328的引腳圖

Atmega 328的引腳圖

Atmega 328的引腳圖
回復

使用道具 舉報

ID:433598 發表于 2021-3-16 10:03 | 顯示全部樓層
求全套資料
回復

使用道具 舉報

ID:903164 發表于 2021-4-19 22:03 | 顯示全部樓層
TFT屏顯示GPS BAD 如何解決啊?
回復

使用道具 舉報

ID:475156 發表于 2021-11-3 13:56 | 顯示全部樓層
這個真是牛。
回復

使用道具 舉報

ID:796712 發表于 2022-2-21 21:04 | 顯示全部樓層
TFT屏顯示GPS
回復

使用道具 舉報

ID:1111540 發表于 2024-3-22 22:13 | 顯示全部樓層
1052092761 發表于 2018-5-26 22:28
請問那個v1版本總顯示“Card Error”怎么回事???

你好,請問基于arduino的GPS導航V1版本顯示cardError問題你解決了嗎
回復

使用道具 舉報

ID:1111540 發表于 2024-3-25 17:53 | 顯示全部樓層
1052092761 發表于 2018-5-26 22:28
請問那個v1版本總顯示“Card Error”怎么回事???

你好,請問你找到原因了嗎
回復

使用道具 舉報

ID:321898 發表于 2024-7-23 12:07 | 顯示全部樓層
不錯的設計,留個標記。
回復

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規則

手機版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術交流QQ群281945664

Powered by 單片機教程網

快速回復 返回頂部 返回列表
主站蜘蛛池模板: 黄色在线观看网站 | 成人精品久久 | 欧洲国产精品视频 | 色偷偷噜噜噜亚洲男人 | 日日干夜夜操天天操 | 色狠狠一区 | 欧美性大战xxxxx久久久 | 国产精品美女久久久久久免费 | 视频一区二区三区在线观看 | 亚洲精品中文字幕在线观看 | 欧美一极视频 | 一级毛片色一级 | 亚洲国产精品一区在线观看 | 亚洲精品一二三区 | 国产免费一区二区三区 | 国产精品美女久久久久久久久久久 | 日韩乱码av| 9久9久| www.日本在线 | 欧美二区在线 | 午夜久久久 | 亚洲综合在线一区 | 久久99精品久久久久蜜桃tv | 波多野结衣电影一区 | 欧美精品在线一区 | 一区中文字幕 | 国产综合久久久 | 岛国在线免费观看 | 天天综合网7799精品 | 欧美一区二区久久 | 91高清在线| 99久久精品免费视频 | 草久久久 | 国产一级片 | 国产精品日韩在线观看一区二区 | www成人免费 | 成年视频在线观看 | 欧美国产一区二区三区 | 动漫www.被爆羞羞av44 | 91视频免费黄 | 在线一区二区三区 |