Tragbare Wetterstation - Ein Schülerprojekt von Klassenzimmer unter Segeln - AZ-Delivery

Already in September 2021 we were contacted by the project "Klassenzimmer unter Segeln" (KUS) and asked if we want to support with our products. KUS is an educational project of the Friedrich-Alexander-University Erlangen-Nuremberg, which enables students to spend several months on a sailing ship. on a sailing ship. The school lessons are continued on board and at the same time the students have the opportunity to develop their personalities and get to know foreign cultures.

We were happy to donate products for the technical and scientific lessons and to give the students the opportunity to build a weather station on the high seas.

We kindly received the following project description from KUS for publication. We apologize for any possible errors in the project description for this guest post.

We hope you enjoy building your own weather station!


This portable weather station is able to record the most important weather information (temperature, air pressure, and humidity) and present it promptly via the display.


The station retrieves the weather information from its sensors (a temperature/pressure sensor and a humidity sensor). The microcontroller board then processes the information and sends the graphically processed data to the display, which shows it.

Required components


0.96 inch OLED SSD1306 display I2C 128 x 64 pixels


DHT22 AM2302 temperature sensor and humidity sensor


BMP180 Barometric pressure and temperature sensor


BMP280 Barometric sensor for air pressure measurement


Microcontroller Board ATmega328


Microcontroller Board with ATmega328P, ATmega16U2



Circuit diagram

Required libraries


Library management

DHT22 Humidity sensor


Integrated in Arduino IDE

BUS system


Integrated in Arduino IDE

BUS system


Library management

Adafruit Base Library


Library management

OLED display


Library management

BMP180 Air pressure/temperature sensor

Source code

Sketch download

//Retrieve libraries
#include "DHT.h"
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_BMP085.h>

//Set sensor pin of the humidity sensor
#define DHTPIN 6

//Set sensor type of the humidity sensor
#define DHTTYPE DHT22

//Set display size: Width of 128 pixels / Height of 64 pixels
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64

//Set (must be set, but is not used in our project)
#define OLED_RESET 4

//Display initialize

//Initialize air pressure/temperature sensor
Adafruit_BMP085 bmp;

//The humidity/temperature sensor is initialized

//The program is prepared
void setup() {
  //The serial communication is started
  //The BUS system is initialized
  Wire.begin ();
  //The humidity/temperature sensor is started
  //Check the operation of the pressure sensor
  if (!bmp.begin()) {
    Serial.println("Could not find a valid BMP085 sensor, check wiring!");
    while (1) {}
  //Check the functionality of the humidity/temperature sensor.
  Serial.println(F("DHTxx test!"));
  //Function test of the display
  if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
    Serial.println(F("SSD1306 allocation failed"));
  //Display reset

  //Set text color of the display

//Start program loop
void loop() {
  //Delay to unload the Arduino board

  //Measure humidity and temperature and set variables for them.
  float h = dht.readHumidity();
  float t = dht.readTemperature();

  //error message in case of incorrect reading
  if (isnan(h) || isnan(t)) {
    Serial.println(F("Failed to read from DHT sensor!"));
  display.clearDisplay(); //reset display
  display.setCursor(0,0); //Set cursor position
  //Fill display with text and values
  display.setTextSize(1); //Set text size
  display.println(F("Humidity: "));
  display.print(F("Temperature: "));
  display.println(("C "));
  display.print(F("Pressure = "));
  display.print(bmp.readPressure()/100-4); // Get air pressure and apply correction factor to it
  display.println(" mbar");
  display.display(); //Execute on the display


We found out that it is important to conscientiously check the plug-in diagram several times for correctness and functioning. Furthermore, it is recommended to calibrate the pressure sensor using an independent station with a correction factor to ensure the most accurate measurement results. Despite the numerous libraries used, the interoperability of these proved to be outstanding.

We, as the Classroom Under Sail Class of 2021/2022, had a lot of fun creating this program and hope you enjoy using our weather station.

For mobile use, a power supply with accumulators or batteries is usually needed. How to implement such a thing, we show among other things in the blog series The talking color detector with DFPlayer and TCS3200.

DisplaysFür arduinoProjekte für anfängerSensoren

Leave a comment

All comments are moderated before being published

Recommended blog posts

  1. ESP32 jetzt über den Boardverwalter installieren - AZ-Delivery
  2. Internet-Radio mit dem ESP32 - UPDATE - AZ-Delivery
  3. Arduino IDE - Programmieren für Einsteiger - Teil 1 - AZ-Delivery
  4. ESP32 - das Multitalent - AZ-Delivery