Skip to content

TCP API

The RTK Base provides a TCP socket interface for direct access to GNSS data streams.

Overview

Similar to gpstomqtt, the RTK Base opens TCP port 8000 for raw GNSS protocol access.

Connection Details

Parameter Value
Port 8000
Protocol TCP
Authentication None (local network only)
Max Connections Configurable (default: 5)

Data Flow

From RTK Base to Client

All valid packets received from the ZED GNSS module are forwarded:

  • NMEA sentences
  • UBX protocol packets
  • RTCM correction data

From Client to RTK Base

Data sent by clients is forwarded to the ZED serial port:

  • Configuration commands
  • Query requests
  • UBX configuration

Use Cases

1. Real-time GNSS Monitoring

Connect with terminal or custom application:

nc 192.168.4.1 8000

View live NMEA/UBX/RTCM stream.

2. Configuration Tools

Send UBX configuration directly:

echo -e '<UBX_BINARY>' | nc 192.168.4.1 8000

3. Third-party Software

Compatible with:

  • u-center (u-blox software)
  • RTKLIB
  • Custom GNSS tools

4. Debug and Diagnostics

Capture raw data for analysis:

nc 192.168.4.1 8000 > gnss_capture.bin

Protocol Support

NMEA 0183

Standard GPS sentences:

  • $GNGGA - Global positioning system fix data
  • $GNGLL - Geographic position
  • $GNGSA - GNSS DOP and active satellites
  • $GNGSV - GNSS satellites in view
  • $GNRMC - Recommended minimum specific GNSS data
  • $GNVTG - Course over ground and ground speed
  • $GNZDA - Time and date

UBX Protocol

u-blox proprietary protocol:

  • NAV class - Navigation results
  • RXM class - Receiver manager messages
  • INF class - Information messages
  • ACK class - Acknowledgments
  • CFG class - Configuration
  • MON class - Monitoring

RTCM

RTCM 3.x correction messages:

  • 1005 - Stationary RTK reference station ARP
  • 1077 - GPS MSM7
  • 1087 - GLONASS MSM7
  • 1097 - Galileo MSM7
  • 1127 - BeiDou MSM7
  • 1230 - GLONASS code-phase biases

Connection Example

Python Client

import socket

# Connect to RTK Base
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(('192.168.4.1', 8000))

# Read data
while True:
    data = sock.recv(1024)
    if data:
        print(data.hex())  # Or parse NMEA/UBX/RTCM

# Send UBX command
ubx_command = bytes([0xB5, 0x62, ...])  # UBX frame
sock.send(ubx_command)

Command Line

# View stream
nc 192.168.4.1 8000

# Save to file
cat < /dev/tcp/192.168.4.1/8000 > output.log

# Send and receive
echo '$PUBX,41,1,0007,0003,9600,0*' | nc 192.168.4.1 8000

Configuration

Enable/Disable TCP API

Via REST API:

# Currently always enabled on port 8000
# Future versions may support configuration

Via Console:

# Check if TCP server is active
netif

# View active connections
dbg task

Performance

Bandwidth

Typical data rates:

  • NMEA only: ~1-2 KB/s
  • NMEA + UBX: ~3-5 KB/s
  • Full output (with RTCM): ~10-20 KB/s

Latency

  • Processing delay: <10ms
  • Network latency: Depends on connection
  • Total: Typically <50ms local network

Troubleshooting

Connection Refused

Cause: TCP server not running or port blocked

Solution:

  • Check RTK Base is operational
  • Verify port 8000 is not firewalled
  • Restart RTK Base if needed

No Data Received

Cause: ZED module not operational

Solution:

  • Check ZED status via web interface
  • Verify antenna connection
  • Review system logs

Garbled Data

Cause: Binary protocols not properly decoded

Solution:

  • Use protocol-aware tools (u-center)
  • Parse binary frames correctly
  • Check baudrate settings

Connection Drops

Cause: Network issues or timeout

Solution:

  • Implement keep-alive in client
  • Check WiFi/Ethernet stability
  • Reconnect automatically

Security Considerations

  • TCP API is unauthenticated
  • Only available on local network
  • No encryption on data stream
  • Use MQTT for secure remote access

Comparison with Other Interfaces

Interface Port Protocol Use Case
HTTP REST 80 HTTP/JSON Configuration, monitoring
MQTT 8883 MQTT/TLS Cloud connectivity, remote
TCP 8000 Raw binary Local debugging, tools
UDP 5003 Datagram RTCM broadcast, robots

References