Arduino Uno Connecting to Arduino Uno with WiFi Wemos D1 Using Lora

I am using Arduino Uno to send data to Arduino Uno with WiFi Wemos D1 by using LoRa-02(SX1278). Sensor that I'm using DHT22 and sharp gp2y1010au0f.

Im getting error at receiver side, it take long time to connect and this error come.
Can someone help me to solve this problem.
thank you

my pin for Wemos

 File "C:\Users\Iqbal\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2/tools/upload.py", line 66, in <module>
    esptool.main(cmdline)
  File "C:/Users/Iqbal/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/tools/esptool\esptool.py", line 3552, in main
    esp.connect(args.before, args.connect_attempts)
  File "C:/Users/Iqbal/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/tools/esptool\esptool.py", line 529, in connect
    raise FatalError('Failed to connect to %s: %s' % (self.CHIP_NAME, last_error))
esptool.FatalError: Failed to connect to ESP8266: Timed out waiting for packet header

Failed uploading: uploading error: exit status 1
//Arduino Uno Sender 
#include <SPI.h>
#include <LoRa.h>
#include "DHT.h"

#define DHTPIN 3     // Digital pin connected to the DHT sensor

#define DHTTYPE DHT22

int measurePin = A5;
int ledPower = 4;

unsigned int samplingTime = 280;
unsigned int deltaTime = 40;
unsigned int sleepTime = 9680;

float voMeasured = 0;
float calcVoltage = 0;
float dustDensity = 0;

DHT dht(DHTPIN, DHTTYPE);

void setup(){
  Serial.begin(9600);
  pinMode(ledPower,OUTPUT);

  Serial.println(F("DHTxx test!"));

  dht.begin();

  while (!Serial);
  Serial.println("LoRa Sender");
  if (!LoRa.begin(433E6)) {
    Serial.println("Starting LoRa failed!");
    while (1);
  }
}

void loop(){
  digitalWrite(ledPower,LOW);
  delayMicroseconds(samplingTime);

  float h = dht.readHumidity();
  float t = dht.readTemperature();
  float f = dht.readTemperature(true);

  // Check if any reads failed and exit early (to try again).
  if (isnan(h) || isnan(t) || isnan(f)) {
    Serial.println(F("Failed to read from DHT sensor!"));
    return;
  }

  float hif = dht.computeHeatIndex(f, h);
  float hic = dht.computeHeatIndex(t, h, false);

  voMeasured = analogRead(measurePin);

  delayMicroseconds(deltaTime);
  digitalWrite(ledPower,HIGH);
  delayMicroseconds(sleepTime);

  calcVoltage = voMeasured*(5.0/1024);
  dustDensity = 170*calcVoltage-0.1;

  if ( dustDensity < 0)
  {
    dustDensity = 0.00;
  }

  Serial.print("Sending packet: ");

  Serial.print("Raw Signal Value (0-1023):");
  Serial.println(voMeasured);

  Serial.print("Voltage:");
  Serial.println(calcVoltage);

  Serial.print("Dust Density:");
  Serial.println(dustDensity);

  Serial.print(F("Humidity: "));
  Serial.print(h);
  Serial.print(F("%  Temperature: "));
  Serial.print(t);
  Serial.print(F("°C "));
  Serial.print(f);
  Serial.print(F("°F  Heat index: "));
  Serial.print(hic);
  Serial.print(F("°C "));
  Serial.print(hif);
  Serial.println(F("°F"));  

  delay(2000);

  // send packet
  LoRa.beginPacket();
  LoRa.print("Raw Signal Value (0-1023):");
  LoRa.println(voMeasured);

  LoRa.print("Voltage:");
  LoRa.println(calcVoltage);

  LoRa.print("Dust Density:");
  LoRa.println(dustDensity);

  LoRa.print(F("Humidity: "));
  LoRa.print(h);
  LoRa.print(F("%  Temperature: "));
  LoRa.print(t);
  LoRa.print(F("°C "));
  LoRa.print(f);
  LoRa.print(F("°F  Heat index: "));
  LoRa.print(hic);
  LoRa.print(F("°C "));
  LoRa.print(hif);
  LoRa.println(F("°F"));  
  LoRa.endPacket();
  delay(5000);
}





Wemos D1 Reciver

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

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

  Serial.println("LoRa Receiver");

  if (!LoRa.begin(433E6)) {
    Serial.println("Starting LoRa failed!");
    while (1);
  }
}

void loop() {
  // try to parse packet
  int packetSize = LoRa.parsePacket();
  if (packetSize) {
    // received a packet
    Serial.print("Received packet '");

    // read packet
    while (LoRa.available()) {
      Serial.print((char)LoRa.read());
    }

    // print RSSI of packet
    Serial.print("' with RSSI ");
    Serial.println(LoRa.packetRssi());
  }
}

I get err

disconnect D2 for upload

I have try to upload without connecting D2, but still got the error above

@snapp_build,

Your other topic on the same subject deleted.

Please do not duplicate your questions as doing so wastes the time and effort of the volunteers trying to help you as they are then answering the same thing in different places.

Repeated duplicate posting could result in a temporary or permanent ban from the forum.

Could you take a few moments to Learn How To Use The Forum

It will help you get the best out of the forum in the future.

Thank you.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.