Skip to content

glompos21/tinysa-web

Repository files navigation

TinySA Web Interface

A modern, web-based spectrum analyzer interface for TinySA and TinySA Ultra devices. Control your TinySA from any device with a web browser - desktop, tablet, or phone!

Python License Status

Features

🎯 Core Functionality

  • Real-time Spectrum Display - Live spectrum graphs with configurable traces
  • Waterfall Display - Time-based spectrum waterfall with history
  • Device Control - Full control of TinySA settings (RBW, LNA, attenuation, spur removal)
  • Multi-Trace Support - Up to 4 traces with Normal/Max Hold/Average modes
  • Marker System - 4 user-adjustable markers with frequency and power readout

📡 Advanced Features

  • Multi-Range Scanning - Scan multiple non-contiguous frequency ranges efficiently
  • Frequency Lists - Load predefined frequency markers from CSV files
  • Frequency Search - Scan multiple bands with automatic range merging
  • WiFi Analysis - Pre-configured 2.4GHz/5GHz WiFi frequency lists
  • Data Export - Export spectrum and waterfall data to CSV

🎨 User Interface

  • Responsive Design - Works on desktop, tablet, and mobile browsers
  • Dark Theme - Easy on the eyes during long analysis sessions
  • Collapsible Panels - Organized controls that expand/collapse
  • Color-Coded Ranges - 14-color palette for frequency range visualization
  • Interactive Graphs - Zoom, pan, and export graphs with Plotly

⚡ Performance & Stability

  • USB Buffer Management - Automatic buffer flushing prevents crashes
  • Error Recovery - Graceful handling of device communication errors
  • Threaded Scanning - Non-blocking UI during spectrum sweeps
  • Optimized Multi-Range - Intelligent merging of overlapping frequency ranges

Screenshots

(Add screenshots here showing the main interface, waterfall display, and multi-range scanning)

Quick Start

Prerequisites

  • TinySA or TinySA Ultra device
  • Python 3.7+
  • USB connection to TinySA device

Installation

  1. Clone the repository

    git clone https://github.com/yourusername/tinysa-web.git
    cd tinysa-web
  2. Install dependencies

    pip install -r requirements.txt
  3. Connect your TinySA device via USB

  4. Run the application

    python3 app.py
  5. Open your browser

    Navigate to: http://localhost:8050

That's it! You're ready to analyze spectrum! 🎉

Usage

Basic Operation

  1. Connect to Device

    • Click "Scan" to find TinySA devices
    • Select your device from dropdown
    • Click "Connect"
  2. Configure Frequency

    • Set Start/Stop frequencies OR
    • Set Center/Span frequencies
    • Adjust Points (number of measurement points)
  3. Configure Settings

    • RBW (Resolution Bandwidth): Auto or manual
    • LNA: Enable for low-power signals
    • Attenuation: Auto or manual
    • Spur Removal: Auto/On/Off
  4. Start Sweep

    • Click "Run" to start continuous sweeping
    • Watch real-time spectrum updates
    • Click "Stop" to pause

Advanced Features

Multi-Range Scanning

Scan multiple non-contiguous frequency ranges in one sweep:

  1. Go to Frequency Search section
  2. Select a frequency search list (e.g., wifi_all_bands)
  3. Enable Auto-merge ranges for optimal performance
  4. Set merge threshold (default 1.0 MHz)
  5. Click Load
  6. Click Run to scan all ranges

Example: Scan both 2.4GHz and 5GHz WiFi bands simultaneously!

Frequency Lists

Load predefined frequency markers:

  1. Go to Markers section
  2. Select a frequency list from dropdown
  3. Click Load
  4. Markers appear on spectrum graph
  5. Toggle Show Labels to hide/show names

Waterfall Display

View spectrum history over time:

  1. Go to Waterfall section
  2. Check Enable Waterfall
  3. Set history size (10-500 scans)
  4. Start sweep to collect data
  5. Click Clear History to reset
  6. Click Export CSV to save data

Data Export

Export spectrum or waterfall data:

  • Spectrum CSV: Current spectrum snapshot
  • Waterfall CSV: Full time-series data with timestamps

Frequency Lists

Pre-configured WiFi Lists

Located in frequency_lists_search/:

  • wifi_2.4ghz.csv - All 14 WiFi channels (2.4GHz)
  • wifi_2.4ghz_optimized.csv - Single 2.4GHz band (fastest)
  • wifi_2.4ghz_nonoverlap.csv - Non-overlapping channels (1, 6, 11, 14)
  • wifi_all_bands.csv - Complete WiFi spectrum (2.4GHz + 5GHz)

Creating Custom Lists

Create your own frequency lists in CSV format:

Frequency Search (frequency_lists_search/*.csv):

name,startF,stopF
2.4GHz WiFi,2400,2500
5GHz UNII-1,5150,5250

Frequency Markers (frequency_lists/*.csv):

name,startF,stopF,preset,value,colour
Channel 1,2412000000,0,marker,true,yellow
WiFi Band,2400000000,2500000000,broadcast,true,cyan

See frequency_lists_search/README_WIFI.md for details.

Architecture

Project Structure

tinysa-web/
├── app.py                      # Main entry point
├── backend/                    # Backend modules
│   ├── device.py              # TinySA device communication
│   └── frequency_manager.py   # Frequency list management
├── frontend/                   # Frontend modules
│   ├── layout.py              # UI layout
│   ├── callbacks.py           # Interactive behavior
│   └── styles.py              # Styling
└── frequency_lists_search/    # Frequency search CSV files

Clean Architecture

  • Separation of Concerns: Frontend and backend are completely separated
  • Modular Design: Each module has a single responsibility
  • Easy to Extend: Add features without touching existing code
  • Well Documented: Comprehensive inline documentation

See ARCHITECTURE.md and QUICKSTART.md for details.

Technical Details

Supported Devices

  • TinySA Basic (up to 960 MHz)
  • TinySA Ultra / TinySA4 (up to 6 GHz)

Requirements

  • Python: 3.7 or higher
  • Dash: Web framework
  • Plotly: Interactive graphing
  • NumPy: Numerical processing
  • pySerial: USB communication
  • tsapython: TinySA protocol library

Performance

  • Scan Speed: ~500ms per sweep (varies by RBW and points)
  • UI Update Rate: 2 Hz (configurable)
  • Waterfall History: Up to 500 scans
  • Max Points: 450 (TinySA device limit)

Stability Improvements

Recent enhancements for rock-solid performance:

  • USB Buffer Flushing: Automatic buffer management after every scan
  • Error Recovery: Continues sweep on transient errors
  • Exception Handling: Top-level error catching prevents crashes
  • Timeout Protection: Graceful handling of device timeouts

See FIXES.md for details.

FAQ

Q: Why use this instead of QtTinySA?

A: TinySA Web offers:

  • Cross-platform (works on any device with a browser)
  • No installation needed on client devices
  • Remote access capability
  • Modern web UI
  • Multi-range scanning
  • Advanced data export

Q: Can I use this remotely?

A: Yes! Change host='0.0.0.0' in app.py to accept connections from other devices on your network. Access via http://your-ip:8050

Security Note: Only use on trusted networks. No authentication is implemented.

Q: Does it work with TinySA Basic?

A: Yes! Fully compatible with both TinySA Basic and TinySA Ultra. The app auto-detects your device.

Q: Can I scan 2.4GHz and 5GHz WiFi at the same time?

A: Yes! Use the wifi_all_bands.csv frequency search list with auto-merge enabled.

Q: Why do I see only one color when loading WiFi channels?

A: The original 14 channels are merged for efficient scanning but displayed with 14 different colors. This gives you both speed and clarity. See MERGE_AND_MARKERS.md.

Troubleshooting

Device Not Found

  • Check USB connection
  • Ensure TinySA is powered on
  • Try a different USB cable/port
  • Check USB permissions (Linux/Mac may require udev rules)

Connection Fails

  • Close other applications using the device (QtTinySA, etc.)
  • Unplug and replug the device
  • Check device is in command mode (not in bootloader)

App Crashes During Scan

  • Update to latest version (USB buffer fixes included)
  • Check USB cable quality
  • Reduce number of points
  • Disable LNA if not needed

Slow Performance

  • Reduce number of points
  • Use narrower frequency range
  • Enable auto-merge for multi-range scans
  • Use faster RBW setting

Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Development Guidelines

  • Follow PEP 8 style guide
  • Add docstrings to functions
  • Update documentation for new features
  • Test on both TinySA Basic and Ultra if possible

Roadmap

Planned Features

  • Authentication for remote access
  • Preset configurations (save/load settings)
  • Signal recording and playback
  • Peak detection and tracking
  • Interference analysis tools
  • Multi-device support (multiple TinySAs)
  • API for external control
  • Mobile-optimized UI

Community Requests

Have a feature idea? Open an issue!

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • TinySA Hardware: tinysa.org
  • tsapython Library: Python interface for TinySA
  • Dash Framework: Plotly's web framework
  • QtTinySA: Inspiration for features and UI design

Support

Related Projects


Made with ❤️ for the RF community

Star ⭐ this repo if you find it useful!

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages