Step-by-Step Guide to Building a Low-Cost Arduino Weather Station for Classroom STEM Projects

Weather is something every kid talks about, but turning that chatter into real data can be a game changer in a science class. When students see temperature, humidity, and pressure numbers appear on a screen they helped build, curiosity turns into confidence. Let’s walk through a simple, cheap Arduino weather station that you can assemble in a single lab period and then let run for weeks of experiments.

Why a Weather Station Belongs in Your Classroom

A weather station does more than teach a few sensor basics. It ties together physics (heat, pressure), math (averages, trends), coding (reading data, sending to a spreadsheet), and engineering (building a sturdy enclosure). Plus, it gives a daily reason to ask “What’s the forecast?” and then answer it with numbers you collected yourself. In my first year of teaching, I watched a shy student light up when his graph showed a sudden drop in pressure before a rainstorm. That moment of connecting theory to real life is why I keep coming back to projects like this.

What You’ll Need – All Under $30

ItemTypical CostWhy It’s Needed
Arduino Uno (or compatible clone)$10The brain that reads sensors
DHT22 temperature‑humidity sensor$5Gives accurate temperature and humidity
BMP280 barometric pressure sensor$5Measures atmospheric pressure
Breadboard and jumper wires$3Easy, solder‑free connections
Small 5 V USB power bank$5Powers the board for days
Cardboard or 3‑D printed case (optional)$0‑$2Protects the electronics
USB cable for programming$0 (you probably have one)Connects Arduino to your computer

All of these parts are available from online hobby stores or local electronics shops. If you have a school budget, you can often get a bulk discount for the sensors.

Step 1 – Set Up the Arduino IDE

  1. Download the Arduino IDE from arduino.cc and install it on your lab computer.
  2. Open the IDE, go to Tools → Board and select “Arduino Uno.”
  3. Choose the correct Port (usually something like COM3 or /dev/ttyUSB0).

If you’ve never used the IDE before, don’t worry – the first time feels like learning a new language, but the interface is straightforward. I still keep a sticky note on my monitor with the most common menu paths; it saves me a few seconds each class.

Step 2 – Wire the Sensors

DHT22 Connections

  • VCC → 5 V pin on Arduino
  • GND → GND pin
  • Data → Digital pin 2

Add a 10 kΩ pull‑up resistor between VCC and Data (the DHT22 works best with it).

BMP280 Connections (I2C bus)

  • VIN → 5 V pin
  • GND → GND pin
  • SCL → A5 (Arduino’s I2C clock)
  • SDA → A4 (Arduino’s I2C data)

The I2C bus lets multiple sensors share the same two wires, which keeps the breadboard tidy. Double‑check that the wires are snug; loose connections are the most common cause of “no data” errors.

Step 3 – Install Sensor Libraries

In the IDE, go to Sketch → Include Library → Manage Libraries…

Search for “DHT sensor library” by Adafruit and click Install.
Then search for “BMP280” and install the “Adafruit BMP280 Library.”

These libraries translate the raw electrical signals into readable temperature, humidity, and pressure values, so you don’t have to write low‑level code.

Step 4 – Write the Sketch

Below is a minimal sketch that reads the three values and prints them to the Serial Monitor every 10 seconds.

#include <Adafruit_Sensor.h>
#include <DHT.h>
#include <Adafruit_BMP280.h>

#define DHTPIN 2          // Digital pin for DHT22
#define DHTTYPE DHT22     // Sensor type

DHT dht(DHTPIN, DHTTYPE);
Adafruit_BMP280 bmp;     // I2C address 0x76 or 0x77

void setup() {
  Serial.begin(9600);
  dht.begin();
  if (!bmp.begin()) {
    Serial.println(F("BMP280 not detected"));
    while (1);
  }
}

void loop() {
  float temperature = dht.readTemperature();   // Celsius
  float humidity    = dht.readHumidity();
  float pressure    = bmp.readPressure() / 100.0F; // hPa

  // Simple sanity check
  if (isnan(temperature) || isnan(humidity) || isnan(pressure)) {
    Serial.println(F("Failed to read from sensors"));
  } else {
    Serial.print(F("Temp: "));
    Serial.print(temperature);
    Serial.print(F(" C, Hum: "));
    Serial.print(humidity);
    Serial.print(F(" %, Press: "));
    Serial.print(pressure);
    Serial.println(F(" hPa"));
  }

  delay(10000); // wait 10 seconds
}

Upload the sketch using the Upload button (right‑arrow icon). Open the Serial Monitor (Ctrl+Shift+M) and you should see a line of data appear every ten seconds. If you see “Failed to read from sensors,” double‑check the wiring and the pull‑up resistor on the DHT22.

Step 5 – Log Data to a Spreadsheet (Optional but Powerful)

If you want students to analyze trends over days, you can pipe the serial output to a CSV file. On Windows, open a command prompt and run:

type COM3 > weather.csv

Replace COM3 with the actual port. On macOS or Linux, use:

cat /dev/ttyUSB0 > weather.csv

Leave the command running while the Arduino is printing data. When you stop it (Ctrl+C), you’ll have a tidy CSV file that can be opened in Excel or Google Sheets. Students can then plot temperature vs. time, calculate daily averages, or even predict rain based on pressure drops.

Step 6 – Build a Simple Enclosure

A cardboard box works fine for a short‑term demo. Cut a small hole for the DHT22’s sensor head so it can “breathe.” Tape the BMP280 on the inside where it’s not blocked by the box walls. If you have access to a 3‑D printer, print a small case with a vented lid – it looks more professional and protects the board from accidental bumps.

Step 7 – Turn It Into a Classroom Routine

  1. Morning Check‑In – Have a student read the latest values from the Serial Monitor and write them on the board.
  2. Data Log Day – Export the CSV and let the class calculate weekly averages.
  3. Science Fair Project – Students can add a light sensor to study cloud cover, or a rain gauge to compare measured precipitation with the pressure data.

By repeating these steps each week, the weather station becomes a living lab rather than a one‑off activity.

Common Pitfalls and How to Fix Them

ProblemLikely CauseQuick Fix
No numbers appear in Serial MonitorSensor not powered or wrong pinVerify 5 V and GND connections; check pin numbers in code
Values are always “nan”Pull‑up resistor missing on DHT22Add 10 kΩ resistor between VCC and Data
Pressure reads 0 or 1013 constantlyBMP280 address mismatchTry bmp.begin(0x76) or bmp.begin(0x77) in setup
Board resets after a few minutesPower bank not supplying enough currentUse a power bank rated for at least 1 A output

Keeping a small troubleshooting checklist on the lab wall saves a lot of time. I still remember the first time I forgot the pull‑up resistor – the whole class spent ten minutes staring at “nan” and I could feel the collective sigh. A quick reminder on the board prevented the repeat.

Extending the Project

Once the basic station is stable, you can add Bluetooth or Wi‑Fi modules (like an ESP8266) to send data to a cloud dashboard. That step adds a layer of networking, but it also introduces new concepts like APIs and data security – perfect for an advanced elective. For most middle‑school classes, however, the serial‑to‑CSV workflow is more than enough to spark curiosity.


Building a low‑cost Arduino weather station is a perfect blend of hands‑on making and data‑driven inquiry. It fits into a single lesson, leaves room for deeper exploration, and gives students a tangible link between the world outside the window and the numbers on their screen. I hope you try it out in your own lab and watch the “aha!” moments roll in like a gentle rain.

#weather #arduino #stem

Reactions
Do you have any feedback or ideas on how we can improve this page?