Mirko Pavleski
Published © GPL3+

DIY Simple BME280 Arduino Weather Station

Super simple Weather station containing only two components.

BeginnerFull instructions provided7,406
DIY Simple BME280 Arduino Weather Station

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
SparkFun Atmospheric Sensor Breakout - BME280
SparkFun Atmospheric Sensor Breakout - BME280
×1
Resistor 10k ohm
Resistor 10k ohm
×3
MAX7219 Led matrix 8x32
×1
Pushbutton Switch, Momentary
Pushbutton Switch, Momentary
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Solder Wire, Lead Free
Solder Wire, Lead Free

Story

Read more

Schematics

Schematic diagram

Code

Code

C/C++
//==========================================
//MAX72xx Dot Matrix Display & BME280 Sensor
//==========================================
#include <Wire.h>
#include <MD_MAX72xx.h>
#include <MD_Parola.h>
#include <SPI.h>
#include <Adafruit_BME280.h>
//------------------------------------------------------------
MD_Parola disp = MD_Parola(MD_MAX72XX::FC16_HW, 10, 4);
Adafruit_BME280 bme;
//------------------------------------------------------------
int temp, hum, pres; String tempString, humString, presString;
//==================================================================================
void setup()
{
  pinMode(2,INPUT); pinMode(3,INPUT); pinMode(4,INPUT);
  disp.begin(); bme.begin(0x76, &Wire);

  disp.displayText("BME280 Sensor", PA_LEFT, 40, 40, PA_SCROLL_LEFT,PA_SCROLL_LEFT);
}
//==================================================================================
void loop()
{
//  while(!disp.displayAnimate());
//  disp.displayText("T * H * P", PA_LEFT, 20, 20, PA_SCROLL_LEFT,PA_SCROLL_LEFT);
  while(!disp.displayAnimate());
  
  if(digitalRead(2) == HIGH) dispTemp();
  if(digitalRead(3) == HIGH) dispHum();
  if(digitalRead(4) == HIGH) dispPres();
  
  disp.displayClear();
}
//==================================================================================
void dispTemp()
{
  disp.displayClear();
  disp.displayText("Temperature", PA_LEFT, 30, 30, PA_SCROLL_LEFT,PA_SCROLL_LEFT);
  while(!disp.displayAnimate());
  delay(500);
  for(int i=1; i<=7; i++)
  {
    temp  = bme.readTemperature();
    tempString  = "  " + String(temp) + " C";
    disp.print(tempString);
    delay(1000);
  }
}
//==================================================================================
void dispHum()
{
  disp.displayClear();
  disp.displayText("Humidity", PA_LEFT, 30, 30, PA_SCROLL_LEFT,PA_SCROLL_LEFT);
  while(!disp.displayAnimate());
  delay(500);
  for(int i=1; i<=7; i++)
  {
    hum  = bme.readHumidity();
    humString  = "  " + String(hum) + " %";
    disp.print(humString);
    delay(1000);
  }
}
//==================================================================================
void dispPres()
{
  disp.displayClear();
  disp.displayText("Pressure", PA_LEFT, 30, 30, PA_SCROLL_LEFT,PA_SCROLL_LEFT);
  while(!disp.displayAnimate());
  delay(500);
  for(int i=1; i<=7; i++)
  {
    pres  = bme.seaLevelForAltitude(705, bme.readPressure())/100;
    presString  = "" + String(pres) + " H";
    disp.print(presString);
    delay(1000);
  }
}

Credits

Mirko Pavleski

Mirko Pavleski

37 projects • 735 followers

Comments

Add projectSign up / Login