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:
View live NMEA/UBX/RTCM stream.
2. Configuration Tools¶
Send UBX configuration directly:
3. Third-party Software¶
Compatible with:
- u-center (u-blox software)
- RTKLIB
- Custom GNSS tools
4. Debug and Diagnostics¶
Capture raw data for analysis:
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:
NAVclass - Navigation resultsRXMclass - Receiver manager messagesINFclass - Information messagesACKclass - AcknowledgmentsCFGclass - ConfigurationMONclass - Monitoring
RTCM¶
RTCM 3.x correction messages:
1005- Stationary RTK reference station ARP1077- GPS MSM71087- GLONASS MSM71097- Galileo MSM71127- BeiDou MSM71230- 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:
Via Console:
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 |