Ultrasonic issue!

I am using waterproof ultrasonic module SR04M then maximum range measuring is just 110cm then it must be measuring as 450 cm so what is the problem?
I tried same code with normal module SR04 so it is work perfectly can measure 400 CM with out any problem
but when use waterproof module can not measure more than 110cm

this is the code I use

const int trigPin = 5;
const int echoPin = 4;

float duration, distance;

void setup() {
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT_PULLUP);
  Serial.begin(9600);
}

void loop() {
  digitalWrite(trigPin, LOW);
  delayMicroseconds(5);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(20);
  digitalWrite(trigPin, LOW);


  duration = pulseIn(echoPin,HIGH);
  distance = (duration*.0343)/2;
  Serial.print("Distance: ");
  Serial.println(distance);
  Serial.print("Pulse Width: ");
    Serial.println(duration);
  delay(1000);
}

Are you asking a question?

distance = duration / 58;

same result
the issue waterproof module maximum range measuring is 110cm = 6380us

const int trigPin = 5;
const int echoPin = 4;

long duration, distance;

void setup() {
  pinMode(trigPin, OUTPUT);
  Serial.begin(115200);
}

void loop() {
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(5);
  digitalWrite(trigPin, LOW);

  duration = pulseIn(echoPin, HIGH, 20000);
  distance = duration / 58;
  Serial.print("Distance: ");
  Serial.println(distance);
  Serial.print("Pulse Width: ");
  Serial.println(duration);
  delay(1000);
}

no any difference same isuue

ok, try:

duration = pulseIn(echoPin, HIGH, 2000);

just in case

result 0

my code working perfectly with normal ultrasonic module SR04 then I use same code with waterproof module then just maximum range measuring not more than 110cm

so, the function work perfectly fine. if manufacturer (or seller ) promised more then 110cm, refund sensor.

I have more than 15 pcs from different suppliers so all of them same issue can not measure more than 110cm

What is the density ratio of water to air? Maybe that has something to do with it?

Q1: Does the sensor give correct values for the distance up to 110 cm?
Q2: Does the sensor give correct values for short distances?
Q3: the SR04M can do serial output, does that give the same limitation?


WRT humidity

If air is warm and has a high humidity the speed of sound goes up.
This difference is max about 20% which is substantial but no factor 4.
See - GitHub - RobTillaart/SRF05: Arduino library for SRF05 distance sensor for a table.

Answer1: yes, it is just maximum value as 110cm
Answer2: yes, it give accurate readings
Answer3: I am using it with GPIO Mode

for Humidity here is just 35%

Is your 20,000 microseconds limiting the distance measurements?

I am using pulsein without limiting

I have checked that also if I put my hand near to module the reading changed is there anyone here experienced with waterproof module?

Ah, yes you are. I was looking at the proposed code.

BUT, you are NOT checking for zero being returned which indicates the default time out was hit. Why not eliminate the zero return in your code?

strange thing is that HC SR04 working perfectly but waterproof one not work properly

Do you know exactly what the difference is? Is it something visible?