For better than 1% accuracy, read a separate temp sensor (e.g., DS18B20) and compute:
1. Overview & Key Differentiators The AJ-SR04M is an improved, industrial-grade variant of the popular HC-SR04. Unlike the standard HC-SR04, this module is enclosed in a waterproof, IP67-rated housing , making it suitable for outdoor, dusty, or humid environments (e.g., tank level sensing, outdoor robotics, car reverse sensors). aj sr04m datasheet
long duration = pulseIn(ECHO, HIGH, 30000); // timeout 30ms (≈5m) if (duration == 0) Serial.println("Out of range"); else float distance = duration / 58.3; Serial.print("Distance: "); Serial.print(distance); Serial.println(" cm"); For better than 1% accuracy, read a separate temp sensor (e
delay(60);
while GPIO.input(ECHO) == 0: pulse_start = time.time() while GPIO.input(ECHO) == 1: pulse_end = time.time() For better than 1% accuracy