The JSN-SR04T is a waterproof ultrasonic sensor designed to measure distances or detect objects using ultrasonic waves. Its waterproof design makes it ideal for applications in wet or harsh environments, such as outdoor installations, liquid level measurement, and industrial automation. This sensor is particularly useful in scenarios where traditional ultrasonic sensors may fail due to exposure to moisture or water.
The JSN-SR04T is a robust and reliable sensor with the following key specifications:
Parameter | Value |
---|---|
Operating Voltage | 5V DC |
Operating Current | ≤ 30mA |
Measuring Range | 20cm to 600cm |
Accuracy | ±1cm |
Operating Frequency | 40kHz |
Waterproof Rating | IP67 |
Operating Temperature | -20°C to 70°C |
Trigger Input Signal | 10µs TTL pulse |
Echo Output Signal | TTL pulse width proportional to distance |
Dimensions (Sensor Head) | Diameter: 25mm, Length: 35mm |
The JSN-SR04T module has a 4-pin interface for easy integration into circuits. Below is the pinout:
Pin | Name | Description |
---|---|---|
1 | VCC | Power supply input (5V DC) |
2 | Trig | Trigger pin: Sends a 10µs TTL pulse to initiate distance measurement |
3 | Echo | Echo pin: Outputs a TTL pulse width proportional to the measured distance |
4 | GND | Ground connection |
Below is an example of how to connect and use the JSN-SR04T with an Arduino UNO:
JSN-SR04T Pin | Arduino UNO Pin |
---|---|
VCC | 5V |
Trig | Digital Pin 9 |
Echo | Digital Pin 10 |
GND | GND |
// Example code for JSN-SR04T with Arduino UNO
// This code measures distance and prints it to the Serial Monitor
#define TRIG_PIN 9 // Define the Trig pin
#define ECHO_PIN 10 // Define the Echo pin
void setup() {
pinMode(TRIG_PIN, OUTPUT); // Set Trig pin as output
pinMode(ECHO_PIN, INPUT); // Set Echo pin as input
Serial.begin(9600); // Initialize serial communication
}
void loop() {
// Send a 10µs pulse to the Trig pin
digitalWrite(TRIG_PIN, LOW);
delayMicroseconds(2);
digitalWrite(TRIG_PIN, HIGH);
delayMicroseconds(10);
digitalWrite(TRIG_PIN, LOW);
// Measure the duration of the Echo pulse
long duration = pulseIn(ECHO_PIN, HIGH);
// Calculate the distance in cm
float distance = duration / 58.0;
// Print the distance to the Serial Monitor
Serial.print("Distance: ");
Serial.print(distance);
Serial.println(" cm");
delay(500); // Wait for 500ms before the next measurement
}
No Output or Incorrect Readings
Unstable Distance Measurements
Sensor Not Detecting Objects
Echo Pin Always HIGH or LOW
Q: Can the JSN-SR04T measure distances underwater?
A: The sensor head is waterproof, but it is not designed for underwater distance measurement. It works best in air.
Q: How do I protect the module (PCB) from water?
A: Use a waterproof enclosure for the module while leaving the sensor head exposed.
Q: Can I use the JSN-SR04T with a 3.3V microcontroller?
A: The sensor requires a 5V power supply, but you can use a level shifter to interface the Trig and Echo pins with a 3.3V microcontroller.
Q: What is the maximum cable length for the sensor head?
A: The sensor head comes with a pre-attached cable. Extending the cable may degrade performance due to signal loss. Use shielded cables if extension is necessary.