A responsive, network-based terminal for interacting with MEG-D microcontrollers over a UDP JSON serial bridge.
MEG-D Terminal provides a clean desktop interface for sending commands and observing device output in real time, without requiring a direct serial connection.
MEG-D Terminal bridges a local user interface to remote serial devices through a microcontroller acting as a UDP-to-UART gateway.
User Input -> UDP (JSON) -> MCU -> UART -> Device
Device Output -> UART -> MCU -> UDP (JSON) -> Terminal
The application communicates with the microcontroller over UDP using a structured JSON protocol. The MCU performs routing between network packets and serial devices.
- UDP-based communication
- JSON protocol for structured messaging
- Device-targeted serial routing
- Real-time console output
- Local echo with distinct styling
- Responsive UI (non-blocking architecture)
- Automatic endpoint latching
- Packaged executable support (no Python required on target system)
The terminal communicates with the MEG-D microcontroller using a JSON-over-UDP protocol.
{
"type": "serial_tx",
"device": "SerialLIGHT",
"data": "$Lb100",
"seq": 1
}-
type
Must be"serial_tx" -
device
Target serial device on the MCU (e.g.SerialLIGHT,SerialUSB) -
data
Raw string transmitted directly to the UART -
seq
Sequence number generated by the client
{
"type": "serial_rx",
"device": "SerialLIGHT",
"data": "OK\\r\\n",
"seq": 42
}- Only messages matching the selected device are displayed
datais a JSON-escaped string- Output is appended directly to the console stream
This system uses UDP, so there is no persistent connection. Instead, the MCU tracks the most recent client.
- The client sends an initial packet (empty
serial_tx) - The MCU records the sender’s IP and port
- All responses are sent to that endpoint
- Only one active client is effectively supported at a time
- The most recent client to send a packet becomes the active console
- User enters text in the input field
- Pressing Enter or Send transmits the text exactly as entered
- No newline characters are automatically added
- Text is wrapped into a
serial_txJSON packet and sent over UDP
- The application listens on a local UDP port
- Incoming packets are parsed as JSON
- Valid
serial_rxmessages are displayed in the console
- Sent text is immediately displayed in the console
- Local echo is rendered in a different color from device output
- Python 3.10+
- Tkinter (included with standard Python on Windows)
python megd_terminal.pyInstall PyInstaller:
pip install pyinstallerBuild executable:
pyinstaller --windowed --onefile --name "MEG-D Terminal" megd_terminal.pyThe output executable will be located in:
dist/
MEGD-Terminal/
├── megd_terminal.py
├── README.md
├── requirements.txt
└── assets/
- The terminal is stream-oriented, not line-oriented
- The MCU handles all routing between network and serial devices
- The protocol is intentionally minimal and extensible
- No ANSI / VT100 terminal emulation is implemented
- Optional newline modes (CR, LF, CRLF)
- Multi-device tabs or sessions
- Binary-safe transmission mode
- Logging and session recording
- Improved connection diagnostics
MIT License
Copyright (c) 2026
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND.