Muhammad Rizky Ramdhani 36053
Published

Simple Weather Station With LoRa RFM95

Simple Weather Station With Lora, Arduino Sensor

BeginnerProtip231
Simple Weather Station With LoRa RFM95

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
DHT11 Temperature & Humidity Sensor (4 pins)
DHT11 Temperature & Humidity Sensor (4 pins)
×1
I2C 16x2 Arduino LCD Display Module
DFRobot I2C 16x2 Arduino LCD Display Module
×1
LED (generic)
LED (generic)
×1
Solderless Breadboard Half Size
Solderless Breadboard Half Size
×1
Lora Rfm95
×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

screenshot_(794)_yittc7lvkk_pV2NkBn68K.png

screenshot_(792)_yetk1w1cuu_ebXG69MTH2.png

Code

Code

Arduino
#include <SPI.h>
#include <LoRa.h>

#include "DHT.h"
#include <Adafruit_BMP280.h>

#define DHTPIN 7
#define DHTTYPE DHT11
Adafruit_BMP280 bmp; 

float Pressure;
float Altitude;
int ldr = 4;
int counter = 0;
int Dummyvalue;

DHT dht(DHTPIN, DHTTYPE);
long randNumber;

void setup() 
{
  Serial.begin(115200);
  
 randomSeed(analogRead(0));
 dht.begin();
 
if (!bmp.begin()) {
    Serial.println(F("Could not find a valid BMP280 sensor, check wiring!"));
    while (1);
  }

   pinMode(ldr, OUTPUT);
  while (!Serial);
  
  Serial.println(" Lora Weather Station By ZenoModiff ");

  if (!LoRa.begin(915E6)) {
    Serial.println("Starting LoRa failed!");
  }
  else
  {
   Serial.println("Starting LoRa Sucesses!");
  }
}
void loop()
{
 Serial.println();
 Serial.print("Sending packet: ");
 Serial.println(counter);
 randNumber = random(1000);

 
 int randNumber = random(100); Dummyvalue = randNumber;
 double ldrvalue = analogRead(ldr);
 float h = dht.readHumidity();
 float t = dht.readTemperature();
 float f = dht.readTemperature(true);
 float pressure = (bmp.readPressure()/100); Pressure = pressure;
 int altitude =  (bmp.readAltitude(1019.66)); Altitude = altitude; 
  

  if (isnan(h) || isnan(t) || isnan(f)) {
    Serial.println(F("Failed to read from DHT sensor!"));
    return;
  }

  String Datastring = String(Dummyvalue) + (";") + String(t) + (";") + String(h) + (";") + String(ldrvalue) + (";") + String (Pressure) + (";") + String (Altitude);
 
  Serial.println(Datastring);
  LoRa.beginPacket();      
  LoRa.print(Datastring);
  LoRa.print(counter);
  LoRa.endPacket();
  counter++;
  
  delay(3000);
  
}

Credits

Muhammad Rizky Ramdhani 36053

Muhammad Rizky Ramdhani 36053

1 project • 1 follower

Comments