Simple Weather Station With Lora, Arduino Sensor
Things used in this project
Hardware components
HARDWARE LIST
1 Arduino Nano R3
1 DHT11 Temperature & Humidity Sensor (4 pins)
1 DFRobot I2C 16x2 Arduino LCD Display Module
1 LED (generic)
1 Solderless Breadboard Half Size
1 MyOctopus i2c Barometric Air Pressure Sensor BMP280
1 Lora Rgm95
1 ldr sensor
Hand tools and fabrication machines
Soldering iron (generic)
Solder Wire, Lead Free
Schematics
screenshot_(794)_yittc7lvkk_pV2NkBn68K.png
screenshot_(792)_yetk1w1cuu_ebXG69MTH2.png
Code
CODE
#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);
}
The article was first published in hackster, December 24, 2022
cr: https://www.hackster.io/rizkyramdhani/simple-weather-station-with-lora-rfm95-65da17
author: Muhammad Rizky Ramdhani 36053
License
All Rights
Reserved
0