This repository contains the implementation of a robust two-way digital communication system using Software-Defined Radio (SDR). Built with GNU Radio and Nuand bladeRF hardware, the project features a complete custom protocol stack for reliable text messaging between nodes.
Designed for two-computer communication, the system integrates a graphical Pager GUI, utilizes custom Python blocks for robust message queuing, and implements intelligent half-duplex channel management to prevent collisions over the air.
- Custom MAC & Priority Arbiter: Prioritizes control packets (ACKs) over data packets using Fair Queuing and dynamic aging to prevent starvation.
- Half-Duplex "Carrier Sense": Intelligent Rx/Tx switching. If a node detects incoming data while attempting to transmit, it pauses its ARQ loop, yields the channel, and resumes seamlessly once the channel is clear.
- Robust Error & Collision Handling: Stop-and-Wait ARQ: Reliable transmission with automatic timeouts.
- Binary Exponential Backoff: Recovers gracefully from multi-node collisions.
- CRC-32 Error Detection: Automatically rejects corrupted packets at the receiver.
- Hardware-Level Optimization: Utilizes prepended dummy bytes to successfully flush hardware buffers and prevent PDU truncation during burst transmissions.
- Network Scalability: 8-bit addressing supports up to 256 unique nodes.
- Modern GUI: A PyQt5 desktop dashboard featuring real-time chat, timestamps, and color-coded delivery status indicators (Sending, Sent/ACKed, Failed).
- Simulation Ready: Includes ZeroMQ (ZMQ) fallback configurations to simulate the wireless channel across multiple PCs without requiring physical SDRs.
The project follows a strict layered communication architecture, separating the application logic from the GNU Radio signal processing flowgraph using Python Embedded Blocks.
| TCP/IP Layer | Implementation Details |
|---|---|
| Application Layer | EchoWave PyQt GUI, Real-time chat interface, Message history, Delivery status. |
| Transport Layer | Automatic fragmentation/reassembly of long messages, Sequence numbering, ACK parsing. |
| Network Layer | Node addressing (1-byte Hex), Target destination filtering. |
| Data Link Layer | Custom MAC Arbiter, Half-Duplex Pause/Resume logic, Pure ALOHA access, Binary Exponential Backoff, CRC-32 validation. |
| Physical Layer | Preamble insertion, QPSK Modulation/Demodulation, Hardware buffer flushing, Manual gain control. |
The system allows multiple SDR nodes to communicate over a shared, uncoordinated wireless channel.
1. Packet Framing
- Each transmitted packet is framed with a custom header to ensure routing and integrity:
[ Dest Address | Src Address | ACK Flag | Sequence Num | FIN Flag | Payload Length | Payload Data | CRC-32 ]
2. The ARQ Lifecycle
- Transmission: The sender transmits a framed packet and starts a timeout clock.
- Acknowledgment: The receiver catches the packet, verifies the CRC-32, drops it if it's a duplicate sequence, and immediately fires back a high-priority ACK.
- Retransmission: If the sender's timeout expires before receiving the ACK, it assumes a collision. It calculates a random backoff interval (which grows exponentially with consecutive failures) and tries again, up to a defined retry limit.
The repository contains both stable deployment implementations and experimental simulation drafts used during development.
| Flowgraph File | Status | Description |
|---|---|---|
SDR Implementation/device_node.grc |
Stable | The primary flowgraph for a physical SDR node. Integrates the full protocol stack, half-duplex switching, and EchoWave GUI for use with bladeRF hardware. |
Simulation/Single device loopback/loopback.grc |
Stable | A complete system simulation. Used for testing the Tx/Rx logic, ARQ loops, and the GUI in a safe loopback environment without requiring RF hardware. |
Simulation/drafts/Multiuser/Multiuser.grc |
Draft | Experimental simulation flowgraph testing uncoordinated channel access, multi-node collisions, and ZeroMQ (ZMQ) network routing. |
Simulation/drafts/Priority Handler/Priority_handler.grc |
Draft | Experimental workspace dedicated to isolating and testing the MAC Arbiter, priority queuing (ACK vs. Data), and dynamic aging logic. |
- Nuand bladeRF (xA4 or xA9 models highly recommended)
- USB 3.0 connection
- GNU Radio (v3.10+)
- Python 3.x (with PyQt5 for the GUI)
- SoapySDR and
libbladeRFdrivers
Recommended Environment: It is highly recommended to run this system on Ubuntu. GNU Radio and SDR hardware drivers are significantly more stable, performant, and easier to configure in a native Linux environment compared to Windows.
Open your terminal and execute the following commands to install the Nuand PPA, the necessary drivers, and the gr-osmosdr package required for GNU Radio integration:
sudo add-apt-repository ppa:nuand/bladerf
sudo apt-get update
# Install bladeRF tools and specific FPGA packages for xA4/xA9
sudo apt-get install bladerf libbladerf-dev bladerf-fpga-hostedxa4 bladerf-fpga-hostedxa9
# Install osmoSDR to link the bladeRF with GNU Radio
sudo apt-get install gr-osmosdr- To ensure compatibility with modern drivers, the bladeRF hardware must be running firmware version 2.6.0.
- Flash the updated firmware to the bladeRF. Load the corresponding FPGA bitstream for your specific model (
hostedxA4.rbforhostedxA9.rbf) using thebladeRF-clibefore executing the flowgraphs.
- Clone this repository.
- Open the
.grcflowgraph files in GNU Radio Companion. - Verify that the sample rates match exactly between the Tx and Rx blocks.
- Adjust the manual gain settings depending on the physical distance between the two SDR nodes to prevent signal loss.
- Connect the bladeRF hardware to both Node A and Node B via USB 3.0.
- Open the flowgraph in GNU Radio Companion and compile it.
- Launch the
Device_node.grcfile on both machines. - Enter the target node's Hex address and begin messaging!
- Team EchoWave (Department of Electronic & Telecommunication Engineering, University of Moratuwa): (From Left to Right)
- Samarasinghe S.M.R.R. - 230566U
- Eranga W.A.O. - 230175U
- Gamage S.K. - 230195F
- Tharushika G.K.E. - 230636K



