Table of Contents

IoT Based Weather Station

IoT-Based-weather-Station
Project Description

Introduction

Now you can check the weather of any place in the world in real-time and plan your days and trips without depending on the weather agencies! In this project, we’re going to make a weather station based on the Internet of Things (IoT) using evive, ESP8266 WiFi module, and PictoBlox – a Scratch 3.0-based graphical programming software. With the weather station, you will be able to monitor the temperature, humidity, wind speed, and visibility of any location in real-time by providing its coordinates.

You can download PictoBlox from HERE.

So, are you ready? Let’s begin right away!

All about OpenWeatherMap API

What is the OpenWeatherMap API?

OpenWeatherMap is one of the leading digital weather information providers. Using OpenWeatherMap API you can get

  • Current weather data.
  • Access current weather data for any location including over 200,000 cities.
  • Current weather data is frequently updated based on global models and data from more than 40,000 weather stations.

The data is available in JSON, XML, or HTML format for Free and all other paid accounts.

Creating Account on OpenWeatherMaps

Go to OpenWeatherMap website: https://openweathermap.org and create a free account.Account Creation on Open Weather Api1

Connectign evive to the Internet

To connect evive with the internet we will use the ESP8266 module. Connect ESP8266 Module to the header on evive

Interfacing evive with PictoBlox

 We are going to write the script in PictoBlox.

  1. First, connect the evive to your computer using a USB Cable.select evive  as board
  2. Next, select evive as your board and choose the appropriate serial port.Select port
  3. Then, Switch to upload mode.
  4. Now, to create the script, we must add the Internet extension. Click on the Add Extension and select the Internet of Things from the list.Internet of THings extension

Understanding IoT Extension Blocks

Connect to Wi-Fi () with password ()

This block connects ESP8266 module connected to evive to the Wi-Fi. The user has to specify the Wi-Fi name and password in the block.Connect to WiFi with Password block

get weather data for latitude () & longitude () with API ()

This block gets the weather data of the specified location (using latitude and longitude) and stores in the internal variables.get weather data for location

get (float) data

The block reports the weather data specified in the input:

  • Latitude
  • Longitude
  • Temperature in C
  • Temperature in F
  • Humidity
  • Visibility
  • Wind Speed
  • Wind Direction
  • Clouds
get data 1get (string) data

The block reports the weather data specified in the input:

  • Weather
  • Weather Description
  • Country code
  • City name
  • Time of captured data
  • Sunrise time
  • Sunset timeget data 2

Let’s begin writing the script.

Writing the Script to Make Weather Reporting System

Let’s begin by writing the code to control evive to the Internet.

  1.  Place a connect to WiFi () with password () block and write the name of the WiFi and it’s password to connect evive to your WiFi.
  2. Place a forever block to run the code continuously.
  3. Drag and drop a get weather data for latitude () & longtitude () with API () block and fill in the necessary details.
  4. Finally, place a when evive starts up hat block to execute the script.Connecting evive to Internet

Writing the Complete Script

Now, let’s complete the above script:

  1.  Now, that we will receive the data from the API, let’s display it on evive’s display screen.
  2. Set the cursor to start writing on the display.
  3. Place a write () block and place a join block into the space given. Write City in the first space and place a get () data into the second space given and choose City Name  from the drop-down below.
  4. Similarly, write Temperature on the screen.weather report system script

Upload the code to evive.

Reading the Signals

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

  1. M1 LED glowing:
    1. Yellow: Wi-Fi is connected successfully.
    2. Red: When Wi-Fi fails to connect. Check if your Wi-Fi name and password are correct.
  2. M2 LED glowing:
    1. Yellow: When it is connected to Cloud.
    2. Red: If it is not connected to Cloud.

Once both the LEDs are Yellow, you will see the requested data on the evive Screen.weather report system using IoT

Conclusion

With this, your IoT based weather station is now ready!

BTW, did you check out our amazing campaign yet? If not, go HERE to have a look at why everybody is loving us so much and perhaps even show some love by backing us!

Project Downloads - Code and Files

Circuit Diagram

Circuit Diagram DescriptionCircuit Diagram Fritzing Diagram

Make the connection as shown in the given figure.

Explore Related Projects by STEMpedia

Explore Community Projects