Weather Station

Humidity and Temperature sensor

COMPONENTS AND SUPPLIES

InventrKits HERO

The HERO is a derivative of “Arduino UNO R3 Reference design” we just changed up a few things to make it our own. If you’re curious about what goes into our HERO board we published the open-source hardware files on our GitHub.

1

37 in 1 Sensor Kit

1

SSD1306 Oled Display 128*32 Monochrome Blue

1

APPS AND ONLINE SERVICES

ABOUT THIS PROJECT

I have found a way to include arduino into my science class without being a coding / robotics class.
In this case, I use the DHT11 sensor as a tool to measure climate conditions and help students track the weather for a given amount of time.

This code measures temperature, humidity and heat index.

SCHEMATICS

DHT11_Weather Station

Some DHT 11 sensors have 3 pins [S-5v-G] instead of 4 [S-5v-G1-G2]

COMMENTS

Leave a Reply

Your email address will not be published. Required fields are marked *

//Code by: SDR// #include <u8g2_fonts.h> #include <U8g2_for_Adafruit_GFX.h> #include <Adafruit_GFX.h> #include <Adafruit_Sensor.h> #include <SPI.h> #include <Wire.h> #include <Adafruit_SSD1306.h> #include “DHT.h” #define DHTPIN 2 #define DHTTYPE DHT11 DHT dht(DHTPIN, DHTTYPE); int photocellPin = 0; int photocellReading; #define SCREEN_WIDTH 128 // OLED display width, in pixels #define SCREEN_HEIGHT 32 // OLED display height, in pixels // Declaration for an SSD1306 display connected to I2C (SDA, SCL pins) #define OLED_RESET 4 // Reset pin # (or -1 if sharing Arduino reset pin) Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET); U8G2_FOR_ADAFRUIT_GFX u8g2_for_adafruit_gfx; #define LOGO_HEIGHT 31 #define LOGO_WIDTH 127 const unsigned char InventrBitmap [] PROGMEM = { // 'index, 127x31px 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xf0, 0x1f, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x80, 0x03, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x01, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x18, 0x06, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x38, 0xc7, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x70, 0xd3, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xe9, 0xdd, 0xe6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc1, 0xd1, 0xbe, 0xe6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0xa9, 0xad, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc7, 0x6b, 0xeb, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xce, 0xeb, 0x17, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xce, 0x77, 0x2e, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe7, 0xb6, 0x1c, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe3, 0xce, 0x38, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xcc, 0x30, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x01, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x80, 0x03, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xf0, 0x1f, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; void setup() { Serial.begin(9600); dht.begin(); display.begin(SSD1306_SWITCHCAPVCC, 0X3C); u8g2_for_adafruit_gfx.begin(display); display.clearDisplay(); delay(10); testdrawbitmap(); // Draw a small bitmap image delay(3000); // Invert and restore display, pausing in-between display.invertDisplay(true); delay(1000); display.invertDisplay(false); delay(1000); } void testdrawbitmap(void) { display.clearDisplay(); display.drawBitmap( (display.width() – LOGO_WIDTH ) / 2, (display.height() – LOGO_HEIGHT) / 2, InventrBitmap, LOGO_WIDTH, LOGO_HEIGHT, 1); display.display(); delay(1000); display.clearDisplay(); } void loop() { delay(2000); //DHT11 float h = dht.readHumidity(); float t = dht.readTemperature(); float hic = dht.computeHeatIndex(t, h); if (isnan(h) || isnan(t)) { Serial.println(“Failed to read from DHT sensor!”); } display.display(); u8g2_for_adafruit_gfx.setFont(u8g2_font_t0_11b_tf); u8g2_for_adafruit_gfx.setCursor(0,13); u8g2_for_adafruit_gfx.print(F(“T:”)); u8g2_for_adafruit_gfx.setCursor(12,13); u8g2_for_adafruit_gfx.print(t); u8g2_for_adafruit_gfx.setCursor(45,13); u8g2_for_adafruit_gfx.print(F(“°C”)); u8g2_for_adafruit_gfx.setCursor(0,22); u8g2_for_adafruit_gfx.print(F(“H:”)); u8g2_for_adafruit_gfx.setCursor(12,22); u8g2_for_adafruit_gfx.print(h); u8g2_for_adafruit_gfx.setCursor(45,22); u8g2_for_adafruit_gfx.print(F(“%”)); u8g2_for_adafruit_gfx.setCursor(0,32); u8g2_for_adafruit_gfx.print(F(“HI:”)); u8g2_for_adafruit_gfx.setCursor(18,32); u8g2_for_adafruit_gfx.print(hic); u8g2_for_adafruit_gfx.setCursor(50,32); u8g2_for_adafruit_gfx.print(F(“°C”)); display.display(); photocellReading = analogRead(photocellPin); Serial.print(“Analog reading = “); Serial.print(photocellReading); if (photocellReading < 400) { Serial.println(" - Dark"); u8g2_for_adafruit_gfx.setFont(u8g2_font_open_iconic_weather_4x_t); u8g2_for_adafruit_gfx.setCursor(80,32); u8g2_for_adafruit_gfx.print(F("B")); display.display(); } else if (photocellReading < 500) { Serial.println(" - Light"); u8g2_for_adafruit_gfx.setFont(u8g2_font_open_iconic_weather_4x_t); u8g2_for_adafruit_gfx.setCursor(80,32); u8g2_for_adafruit_gfx.print(F("A")); display.display(); } else if (photocellReading < 800) { Serial.println(" - Bright"); u8g2_for_adafruit_gfx.setFont(u8g2_font_open_iconic_weather_4x_t); u8g2_for_adafruit_gfx.setCursor(80,32); u8g2_for_adafruit_gfx.print(F("B")); display.display(); } else { Serial.println(" - Very bright"); u8g2_for_adafruit_gfx.setFont(u8g2_font_open_iconic_weather_4x_t); u8g2_for_adafruit_gfx.setCursor(80,32); u8g2_for_adafruit_gfx.print(F("E")); display.display(); delay(5000); } }
PROJECT AUTHOR
Leave a comment
TEAM MEMBERS
Stephanie Duverge

Stephanie Duverge

TABLE OF CONTENTS
Leave a comment
Share on whatsapp
Share on facebook
Share on twitter
Share on linkedin
Share on reddit
Share on pinterest
Share on email

SIMILAR PROJECTS YOU MIGHT LIKE

I cascaded four SN74HC595 shift registers to control 32 LEDs on 4 registers using 3 wires. I am adding a I2C 20×4 LCD screen to display the register and led values. I might add a standard 16×2 LCD screen to show up it is done.
A simple light meter. It’s not calibrated to any meaningful scale, but the digital readout shows a higher number the brighter is the light falling on the photoresistor.
I got the Inventr Mega kit and started work on a lock for a door by using a 4×4 keypad, Uno, 20×4 LCD, and some resistors.