Skip to content

Waterproof ultrasonic module JSN SR-04T to measure distance with Arduino



Hello, this tutorial is about measuring distance in “cm” and “inches”, using an ultrasonic module, it’s called JSN SR-04 T, similar to the famous HC-SR04, but this one has a waterproof probe, and we will wire it with Arduino Uno board and LCD i2c screen.

JSN SR04T_probe.jpg
Waterproof JSN SR-04T probe

This module is handy if you want to use it to measure a distance outdoor or in a not “electronic friendly”  environment as the probe and its wire make it possible to let the Arduino in a safe place. Also if you notice the probe is pretty much the same used in car parking sensors.

Here are few information about the module from its datasheet:

Data.png

For this project we gonna need: Arduino UNO board, LCD i²c screen and the JSN SR-04T, it is possible to use any display you want, just get the right library and code.

Wiring:

Wiring.png
JSN SR-04T module wired with Arduino UNO board and LCD i²c screen

That’s pretty much the wiring both modules are wired with GND and 5V, Trigger and Echo pins are with D11 and D12, then the LCD SDA and SCL are with A4 and A5, in the video you’ll see that the Vcc of the LCD is wired with A0, it’s because I didn’t want to use a breadboard so I put A0 as a HIGH OUTPUT which provides 5V.




Libraries:

For most ultrasonic module we usually use the NewPing library but as you can see it doesn’t work well with the module but you can try it:  Download here or Download here.

LCD i²c NewLiquidCrystal library: Download here.

Codes:

N.B: In the video tutorial I wired the A0 with LCD Vcc but in the codes below I removed those two lines, you can add them back if you want.

here are the 4 codes I’ve worked with, you’ll find measuring in both Metric and Imperial with both Serial monitor and LCD: Download here, otherwise check below

Code 1: Library example – NewPingExample

 

Code 2: Displays in “cm” on the Serial monitor

 

Code 3: Displays in “inches” on the Serial monitor

 



Code 4: Displays in “cm” on the LCD i2c

 

Code 5: Displays in “inches” on the LCD i2c

 

Push further with code 6:

If you want to try to measure underwater here’s a code with a few modification, check to video for more information:  Download the code here.

 



Tests:

The module works pretty fine, but for close up measures it won’t be good and it’s better to use the HC SR04T, but this one has a waterproof, so it depends on your project.

Serial check.png
The measures were stable without the library
LCD check 2.png
Module still working fine after a swim
LCD check 3.png
While measuring underwater I always get this value, in air it changes but in water not

 

Yassine View All

Automation and Electrical Engineer, Electronics amateur trying to share my little projects.

3 thoughts on “Waterproof ultrasonic module JSN SR-04T to measure distance with Arduino Leave a comment

Leave a Reply

Discover more from SURTR TECHNOLOGY

Subscribe now to keep reading and get access to the full archive.

Continue reading