GPS_OLED(SSD1306)
Dependencies: Adafruit_GFX mbed-src
Fork of GPS_HelloWorld by
알아두기
- GPS 시간정보(수신데이터분석) : https://socatelier.wordpress.com/2015/07/27/received-data-of-gps/
- Adafruit GPS : https://socatelier.wordpress.com/2015/07/27/adafruit-gps/
사용제품 및 프로그램
- WIZwiki-W7500 : http://shop.wiznet.co.kr/front/contents/main/main.asp
- Adafruit GPS : https://learn.adafruit.com/adafruit-ultimate-gps
- SSD1306 `0.98 : https://learn.adafruit.com/ssd1306-oled-displays-with-raspberry-pi-and-beaglebone-black
- Jumper line
- mbed Web compile :http://mbed.org/
하드웨어 구성
아래의 그림과 같이 연결하면 된다.
WIZwiki-W7500 | GPS | OLED |
3.3V | Vin | Vcc or Vin |
GND | GND | GND |
SCL | SCL | |
SDA | SDA | |
D0 | TX | |
D1 | RX |
소프트웨어 구성
Link : https://developer.mbed.org/users/eunkyoungkim/code/GPS_OLED_HelloWorld/
아래는 mbed Web compiler에서 사용한 Source Code이다. 위의 링크로 가면 GPS/OLED의 Library도 같이 볼수 있다.
include the mbed library with this snippet
/* Example showing how to hook up to different GPS modules (GlobalSat EM406a and Adafruit Ultimate GPSv3) * to emulated serial ports at different speeds */ #include "mbed.h" #include "GPS.h" #include "Adafruit_SSD1306.h" class I2CPreInit : public I2C { public: I2CPreInit(PinName sda, PinName scl) : I2C(sda, scl) { frequency(100000); start(); }; }; #ifdef TARGET_WIZwiki_W7500 GPS gpsAda(D1, D0, 9600); I2CPreInit gI2C(PA_10,PA_9); #else GPS gpsAda(P0_12, P0_15, 9600); GPS gpsSpark(P0_4, P0_0, 4800); #endif // an SPI sub-class that provides a constructed default Adafruit_SSD1306_I2c gOled(gI2C,NC,0x78,64,128); Serial pc(USBTX, USBRX); int main() { char ch[] = {"Adafruit"}; char ch1[] = {"Sparkfun Breakout"}; gOled.begin(); gOled.clearDisplay(); while (1) { #ifndef TARGET_WIZwiki_W7500 if(gpsSpark.sample()) { pc.printf("set %c\t%f\t%f\t%f\t%f\t%f\n\r", 'Sparkfun Breakout', gpsSpark.longitude, gpsSpark.latitude, gpsSpark.alt, gpsSpark.geoid, gpsSpark.time); } #endif if(gpsAda.sample()) { pc.printf("set %s\t%f\t%f\t%f\t%f\t%f\n\r", ch, gpsAda.longitude, gpsAda.latitude, gpsAda.alt, gpsAda.geoid, gpsAda.time); //Time gOled.printf("T : %Lf\n", gpsAda.time); //longitude(경도) gOled.printf("LO : %f\n", gpsAda.longitude); //latitude(위도) gOled.printf("LA : %f\n", gpsAda.latitude); gOled.printf("AL : %f\n", gpsAda.alt); gOled.printf("G : %f\n", gpsAda.geoid); gOled.display(); gOled.setTextCursor(0,0); } } }
결과
현재 내가 있는 위치의 GPS정보이다. 아래의 그림은 구글 지도에서의 GPS정보이다.
표로 정리하면 아래와 같다.
OLED | google map | |
latitude(위도) | 37.377090 | 37.378633 |
longitude(경도) | 127.113701 | 127.113032 |
History
Added GPS and OLED
2015-07-27, by eunkyoungkim [Mon, 27 Jul 2015 02:00:05 +0000] rev 5
Added GPS and OLED
Added GPS and OLED;
2015-07-27, by eunkyoungkim [Mon, 27 Jul 2015 01:58:49 +0000] rev 4
Added GPS and OLED;
Added GPS and SSD1306(OLED);
2015-07-27, by eunkyoungkim [Mon, 27 Jul 2015 01:45:17 +0000] rev 3
Added GPS and SSD1306(OLED);
Added GPS and OLED
2015-07-27, by eunkyoungkim [Mon, 27 Jul 2015 01:43:21 +0000] rev 2
Added GPS and OLED
Example to go with GPS library
2013-11-02, by 8fromPi [Sat, 02 Nov 2013 16:27:23 +0000] rev 1
Example to go with GPS library