Turn an ESP32 with a GPS module into a GNSS RTK base station and NTRIP caster: it surveys in its own antenna position and serves RTCM 3.x corrections to rovers over the network. A second board runs the rover role - an NTRIP client that subscribes to the base and decodes its position stream.
This one sketch builds either role. Flip NTRIP_ROLE_BASE at the top:
Enable the feature for the whole build with -DPROTOCORE_ENABLE_NTRIP_CASTER=1 (already in build_opt.h here for the Arduino IDE). It implies PROTOCORE_ENABLE_NMEA0183 (the base surveys from GGA fixes). With PlatformIO:
Two ESP32-S3 boards, each with a GT-U7 (u-blox 6/7-class) GPS:
| GPS pin | ESP32-S3 pin | Notes |
|---|---|---|
| TX | GPIO18 | GPS → board RX (Serial1 RX); NMEA at 9600 8N1 |
| RX | GPIO17 | GPS ← board TX (Serial1 TX) |
| PPS | GPIO4 | 1 pulse/second; counted via interrupt |
| VCC/GND | 3V3 / GND |
Flash board B with NTRIP_ROLE_BASE 0 and BASE_IP set to board A's IP. It connects to the caster, subscribes to /BASE1, and prints each decoded frame:
The caster speaks NTRIP 1.0 and 2.0. From any machine on the network:
str2str (RTKLIB) and any NTRIP client (e.g. ntripclient, u-center) can also connect to <BASE_IP>:2101/BASE1.
RTK needs the base to broadcast observation messages (RTCM MSM: 1074/1077/1084/…), which are built from the receiver's raw carrier-phase / pseudorange measurements. The GT-U7 (like the NEO-6/7) does not output raw measurements (no UBX-RXM-RAWX). So it can only serve the surveyed reference point (1005/ 1006) - not the observations a rover needs to fix ambiguities. A true RTK base needs an F9P/M8T-class receiver; with one, the base would add MSM generation and the rover would compute a real fix.
What this example does prove, end to end on real hardware: survey-in position averaging → geodetic→ECEF → RTCM3 framing/CRC → NTRIP caster → NTRIP client → RTCM3 decode. The correction-transport pipeline is complete; only the raw-measurement source is missing.