How get weather data from location using OpenWeatherMap?

IoT Extension
About This Tutorial
In this tutorial, we will retrieve different weather parameters of a location using latitude and longitude.
Tutorial Info

Components Required

ImageComponentQuantityAvailable in Kit
evive1
USB A-B Cable1
ESP8266 Module (ESP-12)1

OpenWeatherMaps

In this tutorial, we will retrieve different weather parameters of a location using latitude and longitude.

For getting weather data, we will use OpenWeatherMap APIs. It provides current weather of more than 20000 cities across the world.

Follow the steps to get a free API of yours:

  1. Go to OpenWeatherMap website: https://openweathermap.org/ and create a free account.
    Create Account
  2. Choose the API tab to get the API Key.
    Weather API

Free plan has some limitations like only 60 calls per minutes, but it is sufficient for individuals.

Free Plan Features

Connecting evive to Internet

To connect evive with the internet we will use the ESP8266 module.

Connect ESP8266 Module to its header on evive:

WiFi ESP8266

PictoBlox Blocks for Weather

  1. connect to Wi-Fi () with password (): The block connects ESP8266 module connected to evive to the WiFi. The user has to specify the WiFi name and password in the block.
    connect to wifi
  2. get weather data for latitude () & longitude () with API (): The block gets the weather data of the specified location (using latitude and longitude) and stores in the internal variables.
    get weather data for location
  3. get (float) data: The block reports the weather data specified in the input:
    1. latitude,
    2. longitude,
    3. the temperature in C,
    4. the temperature in F,
    5. humidity,
    6. visibility,
    7. wind speed,
    8. wind direction, and
    9. clouds.
      get data 1
  4. get (string) data: The block reports the weather data specified in the input:
    1. weather,
    2. weather description,
    3. country code,
    4. city name,
    5. time of captured data,
    6. sunrise time and
    7. sunset time.
      get data 2

PictoBlox Program

Follow the instructions:

  1. Open PictoBlox.
  2. Select the board as evive:
    Selecting Board
  3. Connect the evive.
    Select Port
  4. Add Internet of Things extension in PictoBlox by clicking on the add extension button on the bottom left corner.
    Load Extensions
  5. Create the following script using when evive starts up block:
    IoT Weather
  6. Upload the code onto evive:
    Upload Code

You can download the PictoBlox program from here: IoT – Displaying Weather Data

When you start your evive, you will see two things happening:

  1. M1 LED glowing:
    1. Yellow: Connected to Wi-Fi.
    2. Red: Not connected to Wi-Fi. Check if your Wi-Fi name and password are correct.
  2. M2 LED glowing:
    1. Yellow: Connected to OpenWeatherMap.
    2. Red: Not connected to OpenWeatherMap.
This helped
This didn't help
Share this Tutorial
Share on facebook
Facebook
Share on twitter
Twitter
Share on google
Google+
Share on pinterest
Pinterest
Share on reddit
Reddit
Share on print
Print
Related Projects & Tutorials
All articles loaded
No more articles to load
Featured Projects
Robotic-Arm-Bartender
DIY Robotic Arm Bartender

This project will show you how to make your own robotic arm bartender that will make you a star host!

All articles loaded
No more articles to load
Close Menu
×

Cart

No mo #FOMO on the coolest project-making app out there!

Check it out RIGHT NOW on Product Hunt!
Launch-Pop-Up
Dabble is trending on Product Hunt!
Check it out and let us know what your favorite feature is. 😉
x