serafim11
Published © LGPL

SG-2.0 Wireless Weather Station

In this paper we have presented how to implement a Weather Station to monitor different parameters.

IntermediateFull instructions provided459
SG-2.0 Wireless Weather Station

Things used in this project

Hardware components

Bosch BMP180
×1
Arduino Nano R3
Arduino Nano R3
×2
RGB LCD Shield Kit, 16x2 Character Display
RGB LCD Shield Kit, 16x2 Character Display
×1
SparkFun Transceiver Breakout - nRF24L01+
SparkFun Transceiver Breakout - nRF24L01+
×2
DHT11 Temperature & Humidity Sensor (3 pins)
DHT11 Temperature & Humidity Sensor (3 pins)
×1
DHT22 Temperature Sensor
DHT22 Temperature Sensor
×1
Rotary potentiometer (generic)
Rotary potentiometer (generic)
×1
DS3231M - ±5ppm, I2C Real-Time Clock
Maxim Integrated DS3231M - ±5ppm, I2C Real-Time Clock
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

Indoor Unity

This is the scheme of the Indoor Unity

Outdoor Unity

This is the scheme for Outdoor Unity

Code

Indoor Unity

Arduino
This is the code for Indoor Unity
#include <DS3231.h>
#include <LiquidCrystal.h>
#include <DHT.h>
#include <DHT_U.h>
#include <RF24_config.h>
#include <Adafruit_Sensor.h>
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <printf.h>
#include <Wire.h>

#define DHTPIN 8
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);   //initializare senzor DHT11

DS3231 rtc(SDA, SCL);   //initializare modul DS3231

RF24 myRadio(8, 9);    // initializare modul NRF24L01
byte addresses[][6] = {"0"};

const int rs = 7, en = 6, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);    //initializare LCD

int chk;   //variabila pentru citirea datelor de la DHT!1
int InTemp, InHum, OutTemp, OutHum, OutPress, OutAlt, bmptemp; //variabile

struct package  //packetul de date pe care il primeste
{
  float temperature ;
  float humidity ;
  float pressure;
  float altitude;
  float bmptemperature;
  float pressureseelevel;
};

typedef struct package Package;
Package data;




 void setup()
 { 
  lcd.begin(16, 2);
  dht.begin();
  Serial.begin(9600);

  rtc.begin();
  rtc.setDOW(FRIDAY);
  rtc.setTime(12, 0, 0);
  rtc.setDate(8, 3, 2022);

  myRadio.begin();
  myRadio.setChannel(115);
  myRadio.setPALevel(RF24_PA_MAX);
  myRadio.setDataRate( RF24_250KBPS );
  myRadio.openReadingPipe(1, addresses[0]);
  myRadio.startListening();
  delay(100);

  lcd.setCursor(0, 0);
  lcd.print("Arduino Weather");
  lcd.setCursor(4, 1);
  lcd.print("Station");
  delay(5000);
  lcd.clear();
  lcd.setCursor(2, 0);
  lcd.print("Developed By");
  lcd.setCursor(2, 1);
  lcd.print("  Serafim");
  delay(3000);
  lcd.clear();
  lcd.print("  Pornire....");
  delay(3000);
  lcd.clear(); 
 }



 void loop()
 {

  checkForWirelessData();

  lcd.setCursor(0,0);
  lcd.print("Date:");
  lcd.setCursor(6, 0);
  lcd.print(rtc.getDateStr());
  
  

  lcd.setCursor(0, 1);
  lcd.print("Time:");
  lcd.setCursor(6, 1);
  lcd.print(rtc.getTimeStr());
  delay(1000);

  lcd.setCursor(6, 1);
  lcd.print(rtc.getTimeStr());
  delay(1000);

  lcd.setCursor(6, 1);
  lcd.print(rtc.getTimeStr());
  delay(1000);

  lcd.setCursor(6, 1);
  lcd.print(rtc.getTimeStr());
  delay(1000);

  lcd.setCursor(6, 1);
  lcd.print(rtc.getTimeStr());
  delay(1000);
  lcd.clear();

  dht.read();
  InTemp = dht.readTemperature();
  InHum = dht.readHumidity();
  Serial.print("temp");
  Serial.print(InTemp);
  Serial.print("hum");
  Serial.print(InHum);


  lcd.setCursor(0, 0);
  lcd.print("InTemp:");
  lcd.setCursor(9, 0);
  lcd.print(InTemp);
  lcd.print("*C");

  lcd.setCursor(0, 1);
  lcd.print("InHum:");
  lcd.setCursor(9, 1);
  lcd.print(InHum);
  lcd.print("%");

  delay(5000);
  lcd.clear();

  

  lcd.setCursor(0, 0);
  lcd.print("OutTemp:");
  lcd.setCursor(9, 0);
  lcd.print(OutTemp);
  lcd.print("*C");

  lcd.setCursor(0, 1);
  lcd.print("OutHum:");
  lcd.setCursor(9, 1);
  lcd.print(OutHum);
  lcd.print("%");
  delay(5000);
  lcd.clear();


  lcd.setCursor(2, 0);
  lcd.print("  Presiune");
  lcd.setCursor(4, 1);
  lcd.print(OutPress);
  Serial.print(OutPress);
  lcd.print(" hPa");
  delay(5000);
  lcd.clear();


  lcd.setCursor(1, 0);
  lcd.print("  Altitudine");
  lcd.setCursor(3, 1);
  lcd.print(OutAlt, 1);
  Serial.print(OutAlt, 1);
  lcd.print(" metri");
  delay(5000);
  lcd.clear();


  lcd.setCursor(0, 0);
  lcd.print("Bmp Temperature");
  lcd.setCursor(5, 1);
  lcd.print(bmptemp);
  lcd.print("*C");
  delay(5000);
  lcd.clear();
 
 }



void checkForWirelessData()
{
  if ( myRadio.available())
  {
    while (myRadio.available())
    {
      myRadio.read( &data, sizeof(data) );
      OutTemp = data.temperature;
      OutHum = data.humidity;
      OutPress = data.pressure;
      OutAlt = data.altitude;
      bmptemp = data.bmptemperature;
    }
    Serial.print(data.temperature);
      Serial.print(data.humidity);
  }
}

Outdoor Unity

Arduino
This is the code for Outdoor Unity
#include <Adafruit_BMP085.h>
#include <DHT.h>
#include <DHT_U.h>
#include <Adafruit_Sensor.h>
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <printf.h>
#include <RF24_config.h>
#include <Wire.h>

#define DHTPIN 8  
#define DHTTYPE DHT22

Adafruit_BMP085 bmp;

RF24 myRadio (8, 9);
byte addresses[][6] = {"0"};
const int led_pin = 7;

struct package
{
  float temperature;
  float humidity;
  float pressure;
  float altitude;
  float bmptemperature;
  float pressureseelevel;
};

typedef struct package Package;
Package data;

DHT dht(DHTPIN, DHTTYPE);


void setup()
{
  Serial.begin(9600);
  dht.begin();
  bmp.begin();
  pinMode(led_pin, OUTPUT);

  myRadio.begin();
  myRadio.setChannel(115);
  myRadio.setPALevel(RF24_PA_MAX);
  myRadio.setDataRate(RF24_250KBPS);
  myRadio.openWritingPipe(addresses[0]);
  delay(1000);
}



void loop()
{
  digitalWrite(led_pin, HIGH);
  readSensor();
  bmpSensor();
  Serial.print("hum");
  Serial.print(data.humidity);
  Serial.print("temp");
  Serial.print(data.temperature);
  myRadio.write(&data, sizeof(data));
  digitalWrite(led_pin, LOW);
  delay(5000);
}



void readSensor()
{
  data.humidity = dht.readHumidity();
  data.temperature = dht.readTemperature();
}

void bmpSensor()
{

  data.altitude = bmp.readAltitude();
  data.pressure = (bmp.readPressure()/100);
  data.bmptemperature = bmp.readTemperature();
  data.pressureseelevel = (bmp.readSealevelPressure()/100);

  Serial.print(data.altitude, 1);
  Serial.print(data.pressure,1);
  
  Serial.print("Temperature = ");
  Serial.print(bmp.readTemperature());
  Serial.print(" *C");

  Serial.print("Pressure = ");
  Serial.print(bmp.readPressure());
  Serial.print(" Pa");

  Serial.print("Altitude = ");
  Serial.print(bmp.readAltitude(), 1);
  Serial.print(" metri");

  Serial.print("Alt at Sea Level = ");
  Serial.print(bmp.readSealevelPressure(), 1);
  Serial.print(" metri");

 Serial.println();
 delay(1000);
}

Credits

serafim11

serafim11

0 projects • 1 follower

Comments