Aj Sr04m Datasheet May 2026

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");

Actual distance = Measured distance * (343.0 / sqrt(331.3 * (1 + T_celsius/273.15))) | Parameter | Conditions | Value | |-----------|------------|-------| | Supply voltage | Absolute max | 5.5V | | Supply voltage | Operating | 4.5V – 5.5V | | Logic input low | Trig, EN | < 0.8V | | Logic input high | Trig, EN | > 2.0V (3.3V compatible) | | Echo output low | IOL = 2mA | < 0.4V | | Echo output high | IOH = 2mA | > 4.0V (5V logic) | | Output impedance | - | 100 Ω | aj sr04m datasheet

| Pin | Name | Function | |-----|------|-----------| | 1 | VCC | +5V DC (regulated) | | 2 | Trig | Trigger input (active high, 10 µs min pulse) | | 3 | Echo | Echo output (PWM width = time of flight) | | 4 | GND | Ground | long duration = pulseIn(ECHO, HIGH, 30000); // timeout

// Add 1kΩ resistor from Echo to ESP32 pin, and 2kΩ from pin to GND. // Then code same as Arduino but use pulseIn() or interrupts. 10.3 Raspberry Pi (Python) import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) TRIG = 23 ECHO = 24 GPIO.setup(TRIG, GPIO.OUT) GPIO.setup(ECHO, GPIO.IN) Overview & Key Differentiators The AJ-SR04M is an

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).

def get_distance(): GPIO.output(TRIG, False) time.sleep(0.05) GPIO.output(TRIG, True) time.sleep(0.00001) GPIO.output(TRIG, False)

For tank level sensing, ensure no obstructions inside the beam cone. For obstacle avoidance, mount multiple sensors to cover blind spots. 6. Temperature Compensation & Accuracy The datasheet specifies ±1% accuracy at 20°C. However, sound speed changes with temperature: