Monitoring & Verification
Building an OpenLCB node is only half the battle. You also need visibility into what your node is doing. This section introduces the monitoring tools and how to verify your node is working correctly.
JMRI: The Essential Monitoring Tool
JMRI (Java Model Railroad Interface) is a free, open-source tool for model railroad control and monitoring. It’s essential for OpenLCB development:
Why JMRI?
- Message decoder - Translates raw hex into readable OpenLCB messages
- Network monitor - See all CID, RID, AMD, event messages in real-time
- Testing tool - Send events to your node and verify responses
- Layout integration - Connect your node to a larger LCC network
- Configuration editor - Edit node settings (via CDI) without recompiling firmware
For OpenLCB development, JMRI is invaluable for seeing what’s happening on the network.
TCP/GridConnect Protocol
When your ESP32 node runs a TCP server (on port 12021 by default), JMRI connects as a TCP client. The communication uses GridConnect ASCII format, which is human-readable:
:X18AD4000N;
:X19B84000N;
:X1CED4000N;
:X1080C000N;
Each line is an OpenLCB message. The format is:
:X- GridConnect header18AD4000- OpenLCB header and data (hex)N- Indicates normal message (not error);- Message terminator
What You’ll See: When your node starts up, JMRI shows:
- Four CID frames (checking alias availability)
- RID frame (reserving an alias)
- AMD frame (mapping Node ID to alias)
- Initialized message (node is online and ready)
- Producer/Consumer Identified messages (node capabilities)
- Event reports (button presses, LED changes, etc.)
This startup sequence takes a few milliseconds and happens automatically.
Running a Local TCP Hub
Your ESP32 node runs both a node (producing/consuming events) and a hub (routing messages) simultaneously. The hub is a simple TCP server:
- Listens on port 12021 by default
- Accepts connections from JMRI, other nodes, and monitoring tools
- Forwards all OpenLCB messages between participants
- Requires just a few lines of OpenMRN-Lite code to set up
This is a key design pattern: a single device can be both a node and a hub, which is perfect for development and small layouts.
Quick Verification Steps
When your node is running:
- Serial monitor - See startup messages and debug output
- JMRI connection - Connect JMRI to
localhost:12021(or your ESP32’s IP address) - Message trace - Watch the four startup frames (CID/RID/AMD/Init)
- Event test - Produce and consume a test event; watch it appear in JMRI
- Node properties - View your node’s name and description (from SNIP data)
Chapter 4 includes detailed screenshots and step-by-step JMRI configuration instructions.
What’s Next
With monitoring tools in place, you’re ready to:
- Install PlatformIO (Chapter 3)
- Build and deploy the async_blink example
- Verify it with JMRI
- Start understanding the code
Let’s get hands-on in the next chapter.