Smiley face
Wetterstation WS2000  OpenMQTT Gateway

25.04.2024 14:11:18 Uhr
 11.5& °C   0 mm
 991 hPa    27900 Lux
 14.5 km/h  210° +/-45 °

Smiley face
ELV Wetterstation 

25.April 14:08 Uhr
 11,9 °C& °C   2,5  mm
 14,6 km/h km/h S-SW ±45° 

Smiley face
DIY Wetterstation!

  April 25 2024 14:11:45 Uhr
10.03 °C
99.99 %
29360.09 lux

Smiley face
3D Drucker

Wenn du nicht mehr weißt was du machen sollst fange damit an....

Smiley face
Smart Home

Das ist ein Bild meiner Zentrale, dies ist seit 2020 mit einem Raspberry am Start. 

Smiley face
Node RED

Damit erstelle ich meine Visualisierung meines SmartHomes ein Spielzeug für alle Schiebekinder.

Klimakiste
Zum kurzen messen von Temperatur und Feuchtigkeit entstand nun meine Klimakiste.
Kern ist ein Arduino Nano mit einem AHT10 Feuchte / Temperatur Sensor und einem 0,91 Zoll SD1306 OLED Display, somit ganz Simpler Aufbau warum auch mehr wie nötig. Zur besseren Lesbarkeit ist noch ein Taster dazu gekommen der das Display auf großes Darstellung umschaltet.

Der Quelltest ist hier im Fenster zu finden!


// Stefius Klimakiste
// Version 1.0 09.12.22

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

// AHT10/20
#include <Adafruit_AHTX0.h>
Adafruit_AHTX0 aht;
#define SCREEN_WIDTH 128     // OLED display width, in pixels
#define SCREEN_HEIGHT 32     // OLED display height, in pixels
#define OLED_RESET -1        // Reset pin # (or -1 if sharing Arduino reset pin)
#define SCREEN_ADDRESS 0x3C  ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

// Trendvariablen
int trent_x = 0;
int trent_n = 30;
float temp_trent;
float hydr_trent;
float temp_t;
float hydr_t;
float temp_t2;
float hydr_t2;
char temp_txt[8];
char hydr_txt[8];
int balken = 0;
// INput
int Taster = 2;
int Taster_status = 0;

void setup() {
  Wire.begin();        // i2c bus
  Serial.begin(9600);  // serial

  if (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
    Serial.println(F("SSD1306 allocation failed"));
    for (;;)
      ;
  }
  display.display();
  // Lösche Anzeige
  display.clearDisplay();

  if (!aht.begin()) {
    Serial.println("Kein Geber AHT? Check");
    delay(10);
  }
  Serial.println("AHT10 oder AHT20 nicht da");
  // Interupt aufrufen
  attachInterrupt(digitalPinToInterrupt(Taster), tasters, RISING);
}

void tasters() {
  Taster_status = 1;
}

void loop() {
  // Sensor AHT 10/20
  sensors_event_t humidity, temp;
  aht.getEvent(&humidity, &temp);

  temp_trent = temp_trent + temp.temperature;
  hydr_trent = hydr_trent + humidity.relative_humidity;
  trent_x++;

  if (trent_x == trent_n) {
    // Durchschnitt
    temp_t2 = round(temp_trent / trent_n);
    hydr_t2 = round(hydr_trent / trent_n);

    strcpy(temp_txt, "=");
    strcpy(hydr_txt, "=");

    if (temp_t > temp_t2) {
      strcpy(temp_txt, "\x1F");
    }
    if (temp_t < temp_t2) {
      strcpy(temp_txt, "\x1E");
    }

    if (hydr_t > hydr_t2) {
      strcpy(hydr_txt, "\x1F");
    }
    if (hydr_t < hydr_t2) {
      strcpy(hydr_txt, "\x1E");
    }

    trent_x = 0;
    temp_trent = temp_t = temp_t2;
    hydr_trent = hydr_t = hydr_t2;
    display.cp437(true);
    display.fillRect(0, 22, 128, 17, BLACK);
    display.setTextSize(2);
    display.setTextColor(SSD1306_WHITE);
    display.setCursor(0, 22);
    display.print(String(temp_txt));
    display.setCursor(116, 22);
    display.print(String(hydr_txt));
    display.setCursor(30, 22);
    display.setTextSize(1);
    display.print("Trent");
    display.display();
  }

  balken = round(128 / trent_n * trent_x);
  display.fillRect(0, 17, 128, 2, BLACK);
  display.fillRect(0, 17, balken, 2, WHITE);
  display.display();

  if (trent_x % 2 == 0) {
    display.fillRect(30, 22, 85, 10, BLACK);
    display.setCursor(30, 24);
    display.setTextSize(1);
    display.print("Trent");
  } else {
    display.fillRect(30, 22, 85, 10, BLACK);
    display.setCursor(30, 24);
    display.setTextSize(1);
    display.print("Klimakiste");
  }


  if (Taster_status == 1) {
    display.cp437(true);
    display.fillRect(0, 0, 128, 32, BLACK);
    display.setTextSize(3);
    display.setTextColor(SSD1306_WHITE);
    display.setCursor(0, 0);
    display.print(" " + String(temp.temperature, 1) + "\xF8" + "C ");
    display.display();
    delay(800);
    display.fillRect(0, 0, 128, 32, BLACK);
    display.setTextSize(3);
    display.setTextColor(SSD1306_WHITE);
    display.setCursor(0, 0);
    display.print(" " + String(humidity.relative_humidity, 1) + "%");
    display.display();
    delay(1200);
    display.fillRect(0, 0, 128, 32, BLACK);
    display.display();
    Taster_status = 0;
  } else {
    display.cp437(true);
    display.fillRect(0, 0, 128, 17, BLACK);
    display.setTextSize(2);
    display.setTextColor(SSD1306_WHITE);
    display.setCursor(0, 0);
    display.print(String(temp.temperature, 1) + "\xF8" + "C ");
    display.setCursor(90, 0);
    display.print(String(humidity.relative_humidity, 0) + "% ");
    display.display();

    delay(2000);
  }
}
Klimakiste Klimakiste Klimakiste Klimakiste
Stefius
Seitenbetreiber:
Stefan Zilt
Osnabrück
WsWin
Wuf-Meinung:
Klimakiste
Donnerstag 25.April 2024