JSN-SR04T with an Arduino Uno
A waterproof 40 kHz ultrasonic rangefinder that measures distance with a single sealed transducer and is drop-in compatible with HC-SR04 trigger/echo code.

The JSN-SR04T should run from 5 V, which the Arduino Uno's 5V pin provides, and its ECHO output then swings to 5 V, the Uno's own logic level, so it goes straight to D10 with no divider. TRIG sits on D9, and the sketch times ECHO with pulseIn().
Wiring the JSN-SR04T to the Arduino Uno
Pin by pin.
| JSN-SR04T | Arduino Uno |
|---|---|
| VCC | 5V |
| TRIG | D9 |
| ECHO | D10 |
| GND | GND |
What to know on the Arduino Uno
- Powered from 5 V, ECHO's high is 5 V; on the Uno that needs no divider, unlike on 3.3 V boards. The module draws 30 mA while measuring, an easy load for the Uno's 5V pin.ProtoSupplies JSN-SR04T V3.0 documentation
- pulseIn() with its 40,000 µs timeout blocks the Uno for up to 40 ms when nothing echoes; with the 60 ms minimum cycle the module needs, plan on roughly ten readings a second at most and keep other time-critical work out of that loop.ProtoSupplies JSN-SR04T V3.0 documentation; Arduino language reference, pulseIn()
- ECHO is an input on D10, which is also the Uno's SPI SS pin. If the project adds an SPI device, SPI.begin() turns D10 into an output and the ATmega328P needs it to stay one, so move ECHO to another pin such as D8.Arduino UNO R3 datasheet, p. 10; Microchip ATmega328P datasheet DS40002061B, SPI section
- Nothing closer than about 23 cm reads correctly; on the Uno the sketch then usually prints a wrong short distance or 'out of range', not an error.ProtoSupplies JSN-SR04T V3.0 documentation
JSN-SR04T code for the Arduino Uno
Compiled for arduino:avr:uno on 2026-10-30.
// JSN-SR04T on Arduino Uno: wiring and a free simulation at https://www.tinkered.ai/components/jsn-sr04t/arduino-uno
const int TRIG = 9, ECHO = 10;
void setup() { Serial.begin(115200); pinMode(TRIG, OUTPUT); pinMode(ECHO, INPUT); }
void loop() {
digitalWrite(TRIG, LOW); delayMicroseconds(2);
digitalWrite(TRIG, HIGH); delayMicroseconds(20); digitalWrite(TRIG, LOW);
unsigned long us = pulseIn(ECHO, HIGH, 40000UL); // 0 = no echo within ~6.8 m
if (us == 0) Serial.println("out of range");
else { Serial.print(us / 58.0, 1); Serial.println(" cm"); }
delay(100);
}
JSN-SR04T on the Arduino Uno: questions
Does the JSN-SR04T need a voltage divider on an Arduino Uno?
No. Run it from the Uno's 5V, as recommended, and ECHO's 5 V high goes straight into a Uno pin. The divider is only for 3.3 V boards.
Why does the JSN-SR04T freeze my Uno sketch?
pulseIn() waits for the echo, up to the 40 ms timeout in the example, and the Uno does nothing else meanwhile. Read the sensor every 60 ms or more and keep the rest of loop() short, or time ECHO with an interrupt on D2 or D3.
Can I use the JSN-SR04T with an SD card module on the Uno?
Yes, but move ECHO off D10, which is the Uno's SPI SS pin and must stay an output when SPI is in use.
Keep going
This guide as plain Markdown. /components/jsn-sr04t/arduino-uno.md