Blynk 2xDHT22 Chicken Farm Problem

• Hardware model - Wemos D1 mini
• Smartphone IOS
Hi people Im new to programming micro controllers but i have good basic Electricity knowlage

i have a problem i have trayed to build a remote Temp/Hum observartion in the Chicken farm that we have


the first DHT22 Shows good readings for 1-2 days then it stoops but the connection with D1 is still online
and The second DHT22 after i reconnect it it shows some readings for few min then it stop and pops a signal every 10-15 min

first DHT22-----20m(cable)----D1 mini
second DHT 22 --------50m(cable)-------D1 mini

i trayed without and with pullup resistor(4.7k) bettwean +5v and signal on second DHT22 same resoult

any Idea…? i wold like that both are working and reading constantly so i can observe the temp in both sides of my farm
ty

Simply paste your code between ``` If you don’t format your code, your topic can be deleted by moderators.

#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <DHT.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "xxxxx";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "xxxx";
char pass[] = "xxxx";

#define DHT1 D7 //hat digital pin we're connected to
#define DHT2 D6 
//#define DHT3 D5   
// Uncomment whatever type you're using!
//#define DHTTYPE DHT11     // DHT 11
#define DHTTYPE DHT22   // DHT 22, AM2302, AM2321
//#define DHTTYPE DHT21   // DHT 21, AM2301

DHT dht1(DHT1, DHTTYPE);
DHT dht2(DHT2, DHTTYPE);
//DHT dht3(DHT3, DHTTYPE);
BlynkTimer timer;

// This function sends Arduino's up time every second to Virtual Pin (5).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
void sendSensor()
{
  float h1 = dht1.readHumidity();
  float t1 = dht1.readTemperature(); // or dht.readTemperature(true) for Fahrenheit
  float h2 = dht2.readHumidity();
  float t2 = dht2.readTemperature(); // or dht.readTemperature(true) for Fahrenheit
  //float h3 = dht3.readHumidity();
  //float t3 = dht3.readTemperature(); // or dht.readTemperature(true) for Fahrenheit
  if (isnan(h1) || isnan(t1)) {
    Serial.println("Failed to read from DHT sensor!1");
    //return;
    
  }
  if (isnan(h2) || isnan(t2)) {
    Serial.println("Failed to read from DHT sensor!2");
    //return;
  }
 // if (isnan(h3) || isnan(t3)) {
   // Serial.println("Failed to read from DHT sensor!3");
    //return;
  //}
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
  Blynk.virtualWrite(V5, h1);
  Blynk.virtualWrite(V6, t1);
  Blynk.virtualWrite(V7, h2);
  Blynk.virtualWrite(V8, t2);
  //Blynk.virtualWrite(V9, h3);
  //Blynk.virtualWrite(V10, t3);
  }

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

  Blynk.begin(auth, ssid, pass);
  // You can also specify server:
  //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);
  
  dht1.begin();
  dht2.begin();
  //dht3.begin();
  // Setup a function to be called every second
  timer.setInterval(3000L, sendSensor);
}

void loop()
{
Blynk.run();
timer.run();
}

void loop()

You should probably read this:

The sensible way to approach this is to have multiple D1Minis in the remote locations, with short wires attached to the sensors.
You may also want to use something better than the DHT22, as they are notoriously slow and inaccurate.

Also, you should read the Blynk terms and conditions for the free (Developer) version of the app. I’m guessing that your farm is a commercial business, and if the app is being used to support that business then you may need a subscription.

Pete.

ty. can you give me an example of a better sensor

Until recently, I’ve been using the BME280, but I have a weather station with a sensor inside a plastic housing like this:
image

The BME sensors stop working after a while due to moisture problems - despite being coated in water resistant lacquer.

I’ve now gone for a waterproofed SHT20 sensor like this:


and so far it’s working very well.

The SHT20 sensor is also available in a regular enclosure like this:

Pete.