Two bridges choose the protocol · 06 of 11

One pin, three names

The silkscreen reads ECHO/SDA/TX and TRIG/SCL/RX, all six names at once, because one board has to serve four protocols. Three of those names are wrong at any given moment — and in one mode the pin marked ECHO does nothing at all.

The same four pins, four times

One pin, three names
GPIO
ECHO becomes
ECHO
TRIG becomes
TRIG
Wires
4
The question: hold it high briefly to start a measurement. The answer, as a pulse whose width is the round trip. The silkscreen prints ECHO/SDA/TX and TRIG/SCL/RX because one board has to serve all four modes — count from the square pad and the order is always GND, VCC, ECHO, TRIG.

GND and VCC never change. The last two do, and the silkscreen prints every possibility because the board cannot know which one you chose.

The one that catches people

In 1-Wire mode, the working pin is TRIG and ECHO is not connected to anything.

That is worth reading twice, because every instinct says otherwise. The pin called ECHO is the one that carries the answer in GPIO mode, and it is called ECHO first in the string printed on the board. But the single-wire mode puts both directions on the pin marked TRIG/SCL/RX — the trigger goes out on it and the reply comes back on it — and leaves the other one idle.

Wire it the way the name suggests and you get a board that is working perfectly and saying nothing.

The board does tell you, if you look closely: the net that reaches the TRIG pin is named TRIG/RX/SCL/1WIRE, and the one that reaches ECHO is not. But that is in the design files, not on the silkscreen, and the silkscreen is what you have at the bench.

The ordinary two

I2C. ECHO becomes SDA, TRIG becomes SCL. Both need pull-up resistors like any I2C bus, and most microcontroller boards already have them; the sensor itself does not provide any.

UART. ECHO becomes TX and TRIG becomes RX, named from the sensor's point of view. So the sensor's TX goes to your board's RX and its RX to your board's TX — crossed, the way serial always is.

Counting from the square pad

None of these names are visible once the board is in a breadboard, because the printing is on the side now facing away from you.

What is still visible is the square pad, which is pin 1 and is GND. Counting from it, the order is always GND, VCC, ECHO, TRIG whatever the pins are being used for — the position never moves, only the meaning. Every sketch in this handbook says "count from the square pad" in its header comment for exactly this reason.

When it does not work

In 1-Wire mode, which pin is the data wire?

TRIG. Not ECHO, despite ECHO being the pin whose name suggests it carries the answer. The single wire sends the trigger out and receives the pulse back on the pin marked TRIG/SCL/RX, and the ECHO pin is left disconnected. This is the single most common way to wire this board wrong.

For UART, does TX go to TX?

No — TX goes to your board's RX, and RX to your board's TX. The names on the sensor describe what the sensor does with the pin, so the sensor's transmitter has to reach your receiver. Two TX pins wired together is two outputs fighting and no data.

Which pin is SDA and which is SCL?

ECHO is SDA and TRIG is SCL, which you can read straight off the silkscreen: the names are printed in the same position in both strings. It is worth double-checking anyway, because swapping them on an I2C bus produces a scan that finds nothing rather than an error.

Why print names that are wrong most of the time?

Because the alternative is four different boards. One layout serving four protocols has to label every pin for every mode, and the mode table printed beside the pins is what tells you which column you are in. It is dense rather than wrong.

Where this goes next

What comes back over I2C or UART, and the unit nobody guesses.

Three bytes of micrometres

Edit this page — content/books/ultrasonic-sensor/one-pin-three-names.mdx

Community

Questions about this product

See what other owners have asked, and read their solutions.

Ask a question ↗

Ultrasonic Distance Sensor

Loading discussions…

Discuss this article

Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.

Browse Modules and blocks on the forum