Table of Contents

BME280-Based Weather Prediction System Using Quarky

Example Description
Discover how to predict weather conditions by creating a Quarky Weather Predictor using PictoBlox Block Coding. In this project, students will explore how weather data can be used to identify and predict different weather conditions. By combining Quarky with programming concepts, they will learn how technology helps monitor weather information and make predictions. This interactive hands-on project introduces students to weather forecasting, smart technology, and block-based programming in a fun and engaging way.

Introduction

Weather conditions can be estimated by observing changes in environmental parameters such as temperature and atmospheric pressure. Sensors such as the BME280 allow electronic systems to collect this environmental information and use it in interactive applications.

In this project, we connect a BME280 environmental sensor to Quarky and use PictoBlox to read the sensor data. The project initializes the BME280 sensor and continuously predicts a weather condition using the Predict Weather block.

Based on the predicted condition, the program displays a suitable message and changes the stage backdrop.

For example:

  • Sunny: “It’s bright sunny day!”
  • Stormy: “Looks Stormy today stay inside!”
  • Cold and Overcast: “It’s cold today”

The project demonstrates how an external environmental sensor can be integrated with Quarky to create a simple smart-weather application.

The BME280 sensor can provide temperature and atmospheric pressure measurements, while altitude can be estimated from atmospheric pressure. The PictoBlox weather-prediction block provides a descriptive weather estimate based on sensor readings and should be treated as an educational estimate rather than a professional weather forecast.

What is the BME280 Sensor?

The BME280 is an environmental sensor that can be used to measure:

  • Temperature
  • Atmospheric pressure
  • Humidity
  • Estimated altitude

The sensor communicates with Quarky using I2C communication.

In this project, the BME280 is used as an external environmental sensor to collect atmospheric information that can be processed by PictoBlox.

The BME280 initialization block performs the required sensor initialization and internal calibration. It should be placed at the beginning of the program before using the BME280 sensor blocks.

Prerequisites 

Before starting the project, you will need:

  • Quarky
  • BME280 environmental sensor
  • Compatible jumper wires
  • Computer or laptop
  • PictoBlox installed
  • USB cable for connecting Quarky to the computer
  • Quarky Advance Sensors Extension

Hardware Setup

Connect the BME280 sensor to Quarky using the I2C interface.

The BME280 communicates with Quarky through the SDA and SCL lines.

Before running the program:

  1. Connect the BME280 sensor to Quarky.
  2. Make sure the sensor is powered correctly.
  3. Connect Quarky to the computer using a USB cable.
  4. Open PictoBlox.
  5. Select Quarky as the board.
  6. Connect Quarky to PictoBlox.
  7. Add the Quarky Advance Sensors extension.

Step-by-step Block Coding 

 

Step 1: Open Pictoblox and select block coding.
Select Block Coding in Pictoblox
Step 2: Select Quarky from the board.
Select-Quarky-Board-PictoBlox

Step 3: Go to the extension and add the “Advance Sensors” extension.
Quarky Advance Sensors Extension

Step 4: Go to event palette and select when green flag block
Block Image_Green Flag

Step 5: Initialize the BME280 Sensor

From the extension, add initialize BME280 sensor

Step 6: From the Control palette, add a: forever loop


In forever loop, add BME280 initialize block

Step 7:  Create different Variables for Sensor Data

 

  • Temperature
  • Pressure
  • Altitude
  • Weather

These variables can be used to store and work with the environmental information and predicted weather conditions.

 

Step 8:  Reset the Sensor Data Variables



Inside the forever loop, set the following variables to zero:




Step 9:  Predict the Weather


From the Quarky Advance Sensors extensions, use: predict weather

Step 10: Add a Delay



Add: wait 1 seconds block

Step 11: Check for Sunny Weather



From the Control palette, add an: if-then block.

Set the condition to: Weather = Sunny
Inside the condition, add: say “It’s bright sunny day!”

Then add: switch backdrop to Desert


Step 12: Check for Stormy Weather


Add an else branch to the previous condition.

Inside the else branch, add another if-then block.

Set the condition to: Weather = Stormy
Inside this condition, add: say “Looks Stormy today stay inside!”

Then change the backdrop to: Blue Sky

Step 13: Check for Cold and Overcast Weather



Inside the second else branch, add another if-then block. 

Set the condition to: Weather = Cold and Overcast
Inside the condition, add: say “It’s cold today!”
Then change the backdrop to: Winter

Complete Code

Output

Conclusion


The BME280 Weather Prediction System using Quarky and PictoBlox is an engaging STEM project that demonstrates how external environmental sensors can be used to build a smart weather monitoring application. By combining the BME280 sensor, Quarky, and the Quarky Advance Sensors Extension, learners can explore real-world parameters such as temperature, atmospheric pressure, and altitude while using block-based programming in PictoBlox.