WizFi310 Geolocation_NTP library 2.0 version

Dependencies:   Adafruit_GFX HTTPClient NTPClient WizFi310Interface_Legacy mbed

Prerequisite

This example shows that Wizwiki-W7500 and WizFi310 gets current geolocation/time information.

To implement this function, you need a Platform board and Wi-Fi board. Below are what we used.

  • WIZwiki-W7500 from WIZnet (Platform board)
  • WizFi310 from WIZnet (Wi-Fi board)

WIZwiki-W7500 Pin map

pin map

  • D0 is for RXD, D1 is for TXD
  • D6 is for CTS, D7 is for RTS
  • D9 is for RESET

WizFi310 Pin map

pin map

  • J1 is for RXD, J3 is for TXD
  • SW6-1 is connected to D6 for RTS, SW6-2 is connected to D7 for CTS
  • SW5-3 is connected to D9 for RESET

Software

Connect to Wi-Fi

returnCode = wizfi310.connect(SECURE, SSID, PASS);

Get and Parse a geolocation information

HTTPResult r = httpClient.get("http://ip-api.com/csv",httpGetData,128); //GET GEOLOCATION DATA (CSV)

if (r==HTTP_OK) { //IF THE DATA WAS RECIEVED
      j=0;
      //parse and display each of the API's location information strings on the LCD
      parse(httpGetData, &j, success); 
      parse(httpGetData,&j,countryFull);
      parse(httpGetData,&j,countryAbrv);
      parse(httpGetData,&j,stateAbrv);
      parse(httpGetData,&j,stateFull);
      parse(httpGetData,&j,city);
      parse(httpGetData,&j,zip);
      parse(httpGetData,&j,latitude);
      parse(httpGetData,&j,longitude);
      parse(httpGetData,&j,timeZone);
      printf("HTTP Data Received\r\n");
  } 

Set time

ntpClient.setTime(domainName,123,0x00005000);

Revision graph

The revision graph only works with JavaScript-enabled browsers.