Project Description

This posting shows how to use API of OpenWeatherMap site

that provides weather information using WizArduino MEGA WiFi.

 

wizaduino-wifi

1. OpenWeatherMap API Key 획득

In order to use API, we need to acquire authority for use. We can usually access the Host system and use the resource using key issued by the Host system. We have to sign up on OpenWeatherMap website to get an API key.

OpenWeathermap_main

Once we sign up, we can get an API key as shown below.

API_KEY

 

2. Installing Library

WizArduino MEGA WiFi requires WizFi310 Library to use WiFi function.

WizFi310 Library can be installed after searching ‘Sketch -> Include Library -> Manage Libraries..’.

arduino_lib_management

 

 

3. Code 수정

Source code: http://wiznetian.com/article/wizarduino-wifi%EB%A1%9C-openweathermap-%EC%82%AC%EC%9D%B4%ED%8A%B8%EC%97%90%EC%84%9C-%EB%82%A0%EC%94%A8%EB%8D%B0%EC%9D%B4%ED%84%B0-%EA%B0%80%EC%A0%B8%EC%98%A4%EA%B8%B0/

(based on Arduino 1.8.1 version.)

 

wifi_code1

The code needs some modification.

First, enter the API key from openweathermap site.

Configure the network by entering accessible wifi name and password. If the region isn’t Seoul in Korea, we can change variable value such as city and country to change the region.

 

Use the link below to find the city you want ^^

Find your city

 

You can get the following results by turning on the serial monitor after uploading.

wifi_result1

 

 

4. Application

4. Application

http://api.openweathermap.org/data/2.5/weather?q=Seoul,kr&appid=’API Key’

If you modify the API Key and access the above site with a web browser, you can check the weather information as text data as shown below. Among them, “temp” : 273.66,, “description” : “broken clouds” part has been extracted. If you want other data, you can modify the code to extract.

webpage

 

To extract other data, please change the part as shown below.

 

code2