Weather Station using ESP8266 and some recycled sensors

Hi Guys

My project is a weather station in Extremadura (Spain) a land with long droughs, using materials below:

Presure and temperature: sensor BMP280
Humidity: sensor DHT21
Light sensor: ?

From a spoiled PCE-FWS 20 station:

Rain gauge (Excellent tutorial by Rebecca Ricks)
Anemometer
Wind vane

Following Alvaro’s sketch: Create ioT Realtime Dasboards, and changing only bmp280 sensor, and t was succesfull. I can see in my dashboard Pressure and temperature.
Uaaaau! for a newbie like me it was great!

Next step was attaching DHT21 sensor, but…
Trying to do the same thing with sensor DHT21, is not so easy as I thought.
Could someone help me with code have to add in the sketch to read humidity from this sensor?

Thank you very much in advance.
Best regards!
Andreu

Hi again,
After a lot of temptatives and using the sample sketch, I’ve succesfully connected bmp280 and dht21 sensors. Now I’d like to implement rain sensor (the same of SparkFun weather kit). Anybodey knows how to implement the code below to see it in the dashboard?
It seems to be a simple state detection counter but need to read rain quantity marked as "x"
x = numClicksRainGauge*0.2794, factor conversion to mm

Thank you
Andreu


    /* Arduino sketch for Weather device from Sparkfun.
Uses only the rain gauge.
(copyleft) 2010 F. Javier Dominguez Murillo

This sketch simply counts the numbers of "clicks" occured at the
rain gauge by interrupts, and shows this number (and equivalent rain
quantity in litres per square meters) by serial port every second.

*********************************************************************/

#define PIN_RAIN_GAUGE  2     // Digital 2 (INT_0)

volatile int numClicksRainGauge = 0; // Incremented in the interrupt
float x; // for calculate the rain quantity

//=======================================================
// Initialize
//=======================================================
void setup() {
  Serial.begin(9600);
  //pinMode(2, INPUT_PULLUP); // Enable internal pull-up resistor on pin 2 (Cal probar-ho)
  pinMode(PIN_RAIN_GAUGE, INPUT);
  digitalWrite(PIN_RAIN_GAUGE, HIGH);
  attachInterrupt(0, countRainGauge, FALLING);

}

//=======================================================
// Main loop.
//=======================================================
void loop() {


x = numClicksRainGauge*0.2794; // factor conversion as indicated in datasheet
  Serial.print(numClicksRainGauge); // number of contact closures
  Serial.print(" clicks, ");
  Serial.print(x); // quantity of rain in mm (litres per square meters)
  Serial.print(" mm (L/m2)\n");
  delay(1000);

 
}

//=======================================================
// Interrupt handler for rain gauge. Called on every
// contact closure
//=======================================================
void countRainGauge() {
numClicksRainGauge++;
}

Cadbury Egg Weather Station

Arduino Uno
WeMos D1

WeMos D1 used like a network card. Uno as a data acquisition board.