Introduction
In this tutorial, we’ll explore how to use the Waterproof Ultrasonic Sensor JSN-SR04T with Arduino to measure distance, even in outdoor or moist environments. This sensor is a robust alternative to the popular HC-SR04 ultrasonic sensor, designed specifically for harsh conditions. We’ll cover how it works, its key specifications, wiring, test code, and compare it with other ultrasonic sensors.
Whether you’re building a smart irrigation system, a water tank level indicator, or an outdoor robot, this sensor adds durability and range to your design. Let’s get started with understanding what makes the JSN-SR04T stand out.
To see this sensor in action in a real-world project, check out our IoT-Based Water Tank Monitoring System using JSN-SR04T and ESP8266.
What is the JSN-SR04T Ultrasonic Sensor?
The JSN-SR04T is a waterproof ultrasonic sensor that measures distance using sound waves. Unlike the HC-SR04, it has a separate, sealed transducer that allows it to function in wet or dusty environments. This makes it ideal for outdoor projects, water level monitoring, and applications where exposure to the elements is unavoidable.

This sensor emits ultrasonic waves and listens for echoes reflected back by nearby objects. By timing how long it takes for the sound to return, it can accurately determine how far away an object is. This principle makes it suitable for a variety of non-contact distance measurement applications.
Key Specifications
- Operating Voltage: 5V DC
- Measuring Range: 20cm to 600cm
- Accuracy: ~±1cm
- Interface: Digital (similar to HC-SR04)
- Working Temperature: -20°C to +70°C
- Waterproof Rating: IP66 (Transducer only)
- Signal Frequency: 40kHz
These specifications indicate that the JSN-SR04T is built for more demanding use cases than standard indoor sensors. Its wide temperature tolerance and waterproofing make it suitable for both industrial and hobbyist projects.
Working Principle of JSN-SR04T
The JSN-SR04T works similarly to the HC-SR04:
- Trigger Pulse: The Arduino sends a 10µs HIGH pulse to the sensor’s TRIG pin.
- Ultrasonic Wave Emission: The transducer emits an ultrasonic wave.
- Echo Detection: If an object is in range, the wave reflects back and is captured by the sensor.
- Time Measurement: The time between sending and receiving is measured.
- Distance Calculation: The sensor calculates the distance using the formula:
The division by 2 is because the sound wave travels to the object and back.
Components Required
- 1x JSN-SR04T Waterproof Ultrasonic Sensor
- 1x Arduino Board (Uno, Nano, Mega, etc.)
- Jumper Wires
- Breadboard or direct solder connections (recommended for outdoors)
Having a waterproof sensor doesn’t mean the entire setup is waterproof. Make sure to enclose the Arduino and any other electronics in a weatherproof box if you’re deploying the system outdoors.
JSN-SR04T with Arduino Wiring
Here’s how to wire the JSN-SR04T sensor to an Arduino board:
JSN-SR04T Pin | Arduino Pin |
---|---|
VCC | 5V |
GND | GND |
TRIG | Digital Pin 9 |
ECHO | Digital Pin 10 |

Note: Some versions come with a pre-mounted controller board; in that case, connect as per the pin labeling on the board.
Ensure you double-check the pinout for your version of the sensor. Incorrect wiring can lead to non-functional readings or even damage the sensor.
Test Code for JSN-SR04T with Arduino
// Test Code for JSN-SR04T with Arduino
const int trigPin = 9;
const int echoPin = 10;
long duration;
int distance;
void setup() {
Serial.begin(9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
}
void loop() {
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = duration * 0.0343 / 2;
Serial.print("Distance: ");
Serial.print(distance);
Serial.println(" cm");
delay(1000);
}
This code sends a pulse, waits for the echo, and prints the calculated distance every second. You can adjust the timing and logic for your specific application.
Example Readings
- Object at 1 meter → Distance: ~100 cm
- Hand at 50 cm → Distance: ~50 cm
- No object (max range) → No echo returned / timeout
Serial Monitor:

These results may vary slightly depending on environmental conditions, such as temperature, humidity, and object material.
Using JSN-SR04T for Water Level Monitoring
One of the most common and practical uses of the JSN-SR04T sensor is measuring the water level in tanks. Thanks to its waterproof transducer and extended range, it is ideal for this kind of project.
How it works in a tank setup:
- The sensor is mounted at the top of the water tank, facing downward.
- It continuously measures the distance between itself and the water surface.
- You can calculate the water level by subtracting the measured distance from the total height of the tank.
Example Calculation:
Let’s say your tank height is 100 cm.
If the sensor measures a distance of 40 cm to the water surface:
Water Level = Tank Height - Measured Distance
Water Level = 100 cm - 40 cm = 60 cm
This value can be displayed on an OLED screen, sent to a Blynk app, or used to trigger pump automation when the level drops below a threshold.
To see a complete example using this sensor for water tank monitoring, visit our IoT-Based Water Tank Monitoring System Guide.
Important Notes:
- Make sure the sensor is mounted firmly and perpendicular to the water surface.
- Avoid splashes directly hitting the sensor.
- If the readings are inconsistent, try adding a 470 µF capacitor across VCC and GND.
Applications
- Water Level Monitoring in tanks
- Parking Assistance Systems
- Outdoor Obstacle Detection
- Smart Irrigation Systems
- Industrial Automation
- Garbage Bin Level Detection
- Robotics Navigation
- Rainwater Harvesting Systems
The versatility of the JSN-SR04T allows it to be used in both DIY and professional environments. Its rugged nature gives it a unique advantage in scenarios where other sensors may fail.
Troubleshooting Tips
- Unstable Readings: Use a capacitor (~470 µF) across VCC and GND.
- No Readings: Check sensor orientation and wiring.
- Sensor Output Stuck: Try increasing the timeout or replacing the unit.
- Incorrect Distance: Ensure there are no angled surfaces or absorptive materials.
- Reading Jumps to Max Occasionally: This may happen if there’s no object in range or if the surface is highly absorbent or angled. Ensure the target surface is flat and within range.
Troubleshooting can help identify minor issues early and prevent incorrect readings in long-term deployments.
Comparison: JSN-SR04T vs HC-SR04 vs Other Ultrasonic Sensors
Feature | JSN-SR04T | HC-SR04 | US-100 |
---|---|---|---|
Waterproof | Yes (Transducer only) | No | No |
Range | 20cm – 600cm | 2cm – 400cm | 2cm – 450cm |
Accuracy | ±1cm | ±3mm | ±2mm |
Voltage | 5V | 5V | 3.3V/5V |
Environment | Indoor/Outdoor | Indoor | Indoor |
Cost | Higher | Low | Medium |
This comparison shows why the JSN-SR04T is preferred in harsh environments despite its higher cost. When weather resistance and extended range are required, it offers clear advantages.
If you’re interested in the basic working of the HC-SR04, we’ve covered it in this beginner-friendly article.
Conclusion
The JSN-SR04T is an excellent choice when your project requires distance measurement in wet, dusty, or outdoor environments. Its waterproof transducer, extended range, and compatibility with Arduino make it a go-to sensor for rugged DIY applications. With the simple wiring and code provided in this guide, you can easily integrate this sensor into your next Arduino project.
If you’re building a water level detector, an autonomous rover, or an outdoor monitoring system, this sensor is up to the task. For long-term reliability, make sure to protect your electronics from the environment and test the setup in actual conditions.