Notifications
Clear all

Complete weather station

5 Posts
5 Users
0 Reactions
107 Views
(@rapido)
Member
Joined: 5 years ago
Posts: 11
Topic starter  

I want to use 2 DS18B20 temperature sensors, BME280 humidity and pressure sensors,2 Arduino unos, 2 Nrf24L01 comms units, RG11 rain sensor, Davis wind direction and speed sensor. I have no problem with connecting the sensors together to form the weather station but am unable to code the sensors together to remotely display the readings either on a monitor or a 4 line lcd display. Can someone help please.

 



   
Quote
(@davee)
Member
Joined: 5 years ago
Posts: 2011
 

Hi @rapido,

   Sorry, but I think providing a tested solution for multiple sensors like this is beyond the scope of a reasonable forum request. However, if you break the problem down into one sensor at a time, etc. and gradually build up the full system, then you should be able to do it yourself. So I suggest you start with just one sensor, and look for a tutorial on getting started with that sensor. 

For example, Bill @dronebot-workshop has one of his excellent tutorials on the BME280 at https://dronebotworkshop.com/air-pressure-sensors/

I am not clear why you want two Arduino Nanos, but connecting them will require some thought, depending on the requirements of your project. 

Connecting two identical sensors to the same microcontroller I2C (or SPI) bus also requires some thought, as simply connecting them to the bus with identical settings would mean they will both try to respond at the same moment. Some sensors have a mechanism to choose alternate addresses, typically by a hardwired difference. There are alternate methods if the sensor does not provide one.

If you get stuck at a particular point, then please post a specific question for suggestions on how to proceed.
  

Good luck with your project and best wishes, Dave



   
ReplyQuote
robotBuilder
(@robotbuilder)
Member
Joined: 7 years ago
Posts: 2400
 

@rapido

A more complete request with what you have already done might help?

One uno reads the sensor and the other displays the result. Guessing what you are actually doing isn't much fun nor does it provide any incentive to get involved.

I assume the two Arduino are to communicate using the nRF24L01 (this is very short range) to "code the sensors together to remotely display the readings?"

If it is a coding issue then having the actual hardware configuration is required before any code can be written.

Long time ago since I played with the nRF24L01

https://forum.dronebotworkshop.com/introductions/my-first-time-creating-a-wecome-post/#post-28213

What  4 line lcd display are you using?

 


This post was modified 2 weeks ago 2 times by robotBuilder

   
ReplyQuote
(@sswcharlie)
Member
Joined: 6 years ago
Posts: 8
 

Hi   I put your text request into AI and I have a complete code and code as well.  Contact me on swchuck  at  gmail  dot com and I will send to you.  AI is very good and reliable.

Part of the text to give you and idea.  Quite a few pages of it altogether. 

************

Arduino I want to use 2 DS18B20 temperature sensors, BME280 humidity and pressure sensors,2 Arduino unos, 2 Nrf24L01 comms units, RG11 rain sensor, Davis wind direction and speed sensor. sensors together to remotely display the readings either on a monitor or a 4 line lcd display. For a fellow enthusiast

6:55 pm

 
REPLY

This is a request to help design an Arduino-based weather station with wireless communication. The user wants to:

  • Use 2 DS18B20 temperature sensors
  • BME280 humidity and pressure sensor
  • 2 Arduino Unos
  • 2 NRF24L01 wireless modules for communication
  • RG11 rain sensor
  • Davis wind direction and speed sensor
  • Display readings on a monitor or 4-line LCD

This is a legitimate maker/hobbyist project. I should provide helpful technical guidance on:

  1. The overall system architecture (one Arduino as transmitter with sensors, one as receiver with display)
  2. Wiring diagrams for each component
  3. Library requirements
  4. Code for both the transmitter and receiver

Since this involves substantial code, I should create actual code files rather than just showing snippets in the chat. Let me create:

  1. A transmitter sketch
  2. A receiver sketch
  3. A wiring guide/documentation

I should check if there are any relevant skills first. This involves Arduino code creation, so I should check the available skills.

Looking at the available skills:

  • docx - for creating documents
  • pdf - for PDFs
  • pptx - for presentations
  • xlsx - for spreadsheets
  • product-self-knowledge - not relevant
  • frontend-design - not relevant
  • skill-creator - not relevant

I don't see a specific Arduino or electronics skill, so I'll proceed without reading a skill file. I should create:

  1. Arduino code files (.ino)
  2. A comprehensive documentation file explaining the project

Let me create these files in /home/claude first, then move them to the outputs directory.

I'll help you create a complete Arduino weather station with wireless communication! This is a great project. Let me create the code and documentation for you.

 
 
 
 
 
 
 
 
 

Perfect! All files have been created and presented to the user. Let me provide a brief summary of what I've created.

Perfect! I've created a complete Arduino wireless weather station project for you. Here's what you'll find:

📁 Files Created:

  1. Weather_Station_Transmitter.ino - Reads all sensors and transmits data wirelessly
  2. Weather_Station_Receiver.ino - Receives data and displays on LCD or Serial Monitor
  3. SETUP_GUIDE.txt - Comprehensive setup, calibration, troubleshooting, and enhancement ideas
  4. WIRING_DIAGRAM.txt - ASCII wiring diagrams and connection tables

🌡️ Key Features:

  • Wireless transmission up to 100m+ outdoors
  • Displays temperature (3 sources), humidity, pressure, rainfall, wind speed & direction
  • Updates every 2 seconds
  • Works with 20x4 LCD or Serial Monitor
  • Includes interrupt-driven rain and wind speed measuremen

**********************

AND PART OF THE CODE.

 

 

/*
* Weather Station Transmitter
* Reads DS18B20 temps, BME280, RG11 rain, Davis wind sensors
* Transmits via NRF24L01 to receiver Arduino
*/

#include <SPI.h>
#include <RF24.h>
#include <Wire.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <Adafruit_BME280.h>

// NRF24L01 pins: CE=9, CSN=10
RF24 radio(9, 10);
const byte address[6] = "00001";

// DS18B20 on pin 2
#define ONE_WIRE_BUS 2
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

// BME280 on I2C (A4=SDA, A5=SCL)
Adafruit_BME280 bme;

// RG11 Rain Sensor on pin 3
#define RAIN_PIN 3
volatile unsigned int rainTips = 0;

// Davis Wind Speed (anemometer) on pin 4
#define WIND_SPEED_PIN 4
volatile unsigned int windSpeedCounter = 0;

// Davis Wind Direction (potentiometer) on A0
#define WIND_DIR_PIN A0

// Data structure to send
struct WeatherData {
float temp1; // DS18B20 #1
float temp2; // DS18B20 #2
float bme_temp; // BME280 temperature
float humidity; // BME280 humidity
float pressure; // BME280 pressure
float rainfall; // Rainfall in mm
float windSpeed; // Wind speed in km/h
int windDirection; // Wind direction in degrees
};

WeatherData data;

unsigned long lastSendTime = 0;
unsigned long lastWindCalc = 0;
const long sendInterval = 2000; // Send every 2 seconds
const long windCalcInterval = 3000; // Calculate wind speed every 3 seconds

void setup() {
Serial.begin(9600);

// Initialize NRF24L01
radio.begin();
radio.openWritingPipe(address);
radio.setPALevel(RF24_PA_MAX);
radio.stopListening();

// Initialize DS18B20
sensors.begin();

// Initialize BME280
if (!bme.begin(0x76)) { // Try 0x76, if fails try 0x77
Serial.println("BME280 not found!");
}

// Rain sensor interrupt
pinMode(RAIN_PIN, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(RAIN_PIN), rainTipISR, FALLING);

// Wind speed interrupt
pinMode(WIND_SPEED_PIN, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(WIND_SPEED_PIN), windSpeedISR, FALLING);

// Wind direction analog input
pinMode(WIND_DIR_PIN, INPUT);

Serial.println("Weather Station Transmitter Started");
}

void loop() {
unsigned long currentMillis = millis();

// Calculate wind speed every 3 seconds
if (currentMillis - lastWindCalc >= windCalcInterval) {
// Davis anemometer: 1 rotation per second = 2.4 km/h
data.windSpeed = (windSpeedCounter / 3.0) * 2.4;
windSpeedCounter = 0;
lastWindCalc = currentMillis;
}

// Send data every 2 seconds
if (currentMillis - lastSendTime >= sendInterval) {
readSensors();
transmitData();
lastSendTime = currentMillis;
}
}

void readSensors() {
// Read DS18B20 sensors
sensors.requestTemperatures();
data.temp1 = sensors.getTempCByIndex(0);
data.temp2 = sensors.getTempCByIndex(1);

// Read BME280
data.bme_temp = bme.readTemperature();
data.humidity = bme.readHumidity();
data.pressure = bme.readPressure() / 100.0F; // Convert to hPa

// Calculate rainfall (RG11: 0.01" per tip = 0.254mm)
data.rainfall = rainTips * 0.254;

// Read wind direction (Davis vane outputs 0-5V via resistor network)
int windDirRaw = analogRead(WIND_DIR_PIN);
data.windDirection = map(windDirRaw, 0, 1023, 0, 359);

// Print to Serial for debugging
Serial.println("=== Sensor Readings ===");
Serial.print("Temp1: "); Serial.print(data.temp1); Serial.println("°C");
Serial.print("Temp2: "); Serial.print(data.temp2); Serial.println("°C");
Serial.print("BME Temp: "); Serial.print(data.bme_temp); Serial.println("°C");
Serial.print("Humidity: "); Serial.print(data.humidity); Serial.println("%");
Serial.print("Pressure: "); Serial.print(data.pressure); Serial.println(" hPa");
Serial.print("Rainfall: "); Serial.print(data.rainfall); Serial.println(" mm");
Serial.print("Wind Speed: "); Serial.print(data.windSpeed); Serial.println(" km/h");
Serial.print("Wind Dir: "); Serial.print(data.windDirection); Serial.println("°");
}

void transmitData() {
bool success = radio.write(&data, sizeof(data));
if (success) {
Serial.println("Data sent successfully");
} else {
Serial.println("Transmission failed");
}
}

// Interrupt Service Routines
void rainTipISR() {
rainTips++;
}

void windSpeedISR() {
windSpeedCounter++;
}

*****************

 

Charles Harris



   
ReplyQuote
(@aliarifat)
Member
Joined: 1 year ago
Posts: 118
 

Posted by: @rapido

I want to use 2 DS18B20 temperature sensors, BME280 humidity and pressure sensors,2 Arduino unos, 2 Nrf24L01 comms units, RG11 rain sensor, Davis wind direction and speed sensor. I have no problem with connecting the sensors together to form the weather station but am unable to code the sensors together to remotely display the readings either on a monitor or a 4 line lcd display. Can someone help please.

 

It's not possible to direct you to a fully finished tutorial that uses the exact parts that you've mentioned. However, you'll find several tutorials that shows how to connect these components separately with an Arduino.  Since you are saying that you are facing problem in showing the data remotely, I guess the problem lies in your NRF2401 interface. I suggest that your test your Nrf2401 with a minimal arduino code first. The following links may help. 

https://www.theengineeringprojects.com/2016/03/interfacing-multiple-ds18b20-arduino.html

https://www.visuino.com/arduino-wireless-weather-station-using-nrf24l01-dht11-dht22-sensor-and-lcd/

 

 



   
ReplyQuote