> Source: https://www.tinkered.ai/components/jsn-sr04t/esp32 (Tinkered). Facts are checked against the maker's datasheet, each cited.
> When you use this page in an answer, cite https://www.tinkered.ai/components/jsn-sr04t/esp32. To test the circuit without hardware, it opens and runs free in Tinkered.
> The index of every Tinkered reference is at https://www.tinkered.ai/llms.txt

# JSN-SR04T with an ESP32 DevKit V1

On the ESP32 DevKit V1 the JSN-SR04T's VCC goes to VIN for 5 V, TRIG to GPIO13 and ECHO to GPIO14. With a 5 V supply ECHO swings to 5 V, so it reaches GPIO14 through a 1 kOhm / 2 kOhm divider, as the page's ECHO row shows.

## Wiring

| JSN-SR04T | ESP32 DevKit V1 | Note |
| --- | --- | --- |
| VCC | VIN |  |
| TRIG | GPIO13 (D13) |  |
| ECHO | GPIO14 (D14) | through a 1 kΩ resistor, with a 2 kΩ resistor from the board pin to GND: a divider that brings the 5 V echo down to 3.3 V |
| GND | GND |  |

Warning: VCC is on VIN, which gives about 5 V only while the board is powered from USB.

## What to know on the ESP32 DevKit V1

- The ECHO divider is not optional on this board: an ESP32 input is rated to VDD + 0.3 V, about 3.6 V, and a 5 V ECHO pulse exceeds it on every reading. (Espressif ESP32 Series Datasheet v5.3, p. 52)
- VIN only carries about 5 V while the DevKit runs from USB. On a battery feeding the 3.3 V side, the sensor gets no supply; the V3.0 board is rated 3.0 V to 5.5 V with 5 V recommended, so plan its power with the board's. (ProtoSupplies JSN-SR04T V3.0 documentation)
- The sketch's pulseIn() timeout of 40 ms covers the sensor's 600 cm range, and its 100 ms loop respects the 60 ms minimum between readings. GPIO13 and GPIO14 are not strapping pins. (ProtoSupplies JSN-SR04T V3.0 documentation; Espressif ESP32 Series Datasheet v5.3, p. 22)

## Code

```cpp
// JSN-SR04T on ESP32 DevKit V1: wiring and a free simulation at https://www.tinkered.ai/components/jsn-sr04t/esp32
const int TRIG = 13, ECHO = 14;
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);
}
```

Compiled for esp32:esp32:esp32 on 2026-10-30.

## Questions

### Can I connect the JSN-SR04T ECHO pin straight to an ESP32?

No. At 5 V, ECHO outputs 5 V and the ESP32 input limit is VDD + 0.3 V (ESP32 datasheet, p. 52). Use a 1 kOhm / 2 kOhm divider on GPIO14.

### Why does the JSN-SR04T read nothing under 20 cm on my ESP32?

That is the sensor's blind zone: it reads from about 23 cm (ProtoSupplies documentation). The ESP32 code is not the cause.

## More

- [JSN-SR04T reference](https://www.tinkered.ai/components/jsn-sr04t.md): pinout, specs, rules and common mistakes

## Try it

Tinkered simulates the JSN-SR04T on the ESP32 DevKit V1 in the browser, with this wiring and code, free: https://www.tinkered.ai/components/jsn-sr04t/esp32
