Matt 74dd3646b5 Performance tweaks
Optimization Walkthrough: 83kHz ADC Streaming
Achievement
Maximized the ESP32-C6 ADC continuous mode performance, achieving 83kHz stable streaming (hardware max) with 0 dropped packets.

Key Optimizations
1. Architecture: Zero-Copy Streaming
Change: Removed ws_sender_task and RingBuffer.
Mechanism:
adc_read_task
 sends binary WebSocket frames directly.
Benefit: Reduced context switching and memory copies (approx +25% throughput).
2. Frontend: Decoupled Rendering
Change: Replaced onmessage -> draw() with requestAnimationFrame loop.
Mechanism: ws.onmessage only updates the data buffer. The browser draws at 60Hz.
Benefit: Eliminated UI jitter caused by drawing >60 times per second.
3. Latency: Power Save Disabled
Change: esp_wifi_set_ps(WIFI_PS_NONE)
Mechanism: Keeps the Wi-Fi radio active 100% of the time, preventing ~100ms sleep cycles.
Benefit: Eliminated periodic latency spikes which caused buffer overflows.
4. Buffering: Throughput Tuning
Change: ADC_READ_LEN increased 1024 -> 4096 bytes.
Change: Driver buffer max_store_buf_size increased 1024 -> 16384 bytes.
Benefit: Provided ~30ms of safety margin for Wi-Fi blocking operations, preventing driver-level overflows.
Final Configuration
Sample Rate: Up to 83kHz.
Packet Size: 4096 bytes (batched).
Latency: <50ms end-to-end.
Drops: 0.
2025-12-13 10:32:40 +00:00
2025-12-13 10:32:40 +00:00
2025-12-12 21:55:13 +00:00
2025-12-12 21:55:13 +00:00
2025-12-12 22:18:48 +00:00
2025-12-12 22:17:33 +00:00

ESP-Scope

Overview

ESP-Scope is a web-based oscilloscope built using the ESP-IDF framework. It allows users to visualize analog signals in real-time through a web browser. The project leverages the ESP32's ADC capabilities and serves a web interface for signal visualization.

esp-scope

Features

  • Real-time signal visualization on a web browser.
  • Adjustable sample rate (10-100000 Hz), bit width, and attenuation.
  • Crosshair functionality for precise measurements.
  • Adjustable trigger level.
  • Reset functionality to clear settings and reload the interface.

Getting Started

Prerequisites

  • ESP32 development board.
  • ESP-IDF installed and configured.
  • USB cable to connect the ESP32 to your computer.
  • A web browser (e.g., Chrome, Firefox).

Downloading the Project

  1. Clone the repository:
    git clone https://github.com/MatAtBread/esp-scope.git
    
  2. Navigate to the project directory:
    cd esp-scope
    

Building and Flashing

If you have the esp-idf VSCode extension, just click on the flame to build, flash & monitor. Use the config settings for "espScope" to set youur WiFi SSID & password.

  1. Set up the ESP-IDF environment:
    . $IDF_PATH/export.sh
    
  2. Configure the project:
    idf.py menuconfig
    
  3. Build the project:
    idf.py build
    
  4. Flash the firmware to the ESP32:
    idf.py -p [PORT] flash
    
    Replace [PORT] with the serial port of your ESP32 (e.g., /dev/ttyUSB0 or COM3).
  5. Monitor the serial output:
    idf.py monitor
    

Accessing the Web Interface

If your DHCP server supports it, the app sets its hostname and you can just navigate to http://esp-scope (you may have/need a default domain extension)

  1. After flashing, the ESP32 will display its IP address in the serial monitor.
  2. Open a web browser and navigate to the displayed IP address (e.g., http://192.168.4.1).
  3. Use the web interface to:
    • Adjust settings like sample rate, bit width, and attenuation.
    • Visualize signals in real-time.
    • Reset the interface using the "Reset" button.

Attaching hardware

The displayed signal is sampled from ADC0. The test signal is output on D1.

License

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

Acknowledgments

  • Built using the ESP-IDF framework by Espressif Systems.
  • Inspired by the need for affordable and accessible signal visualization tools.
Description
ESP-Scope 网页示波器固件(ESP32-S3)
Readme MIT 1.4 MiB
Languages
C 76.8%
Ruby 9.8%
HTML 4.2%
JavaScript 3.6%
CMake 2.6%
Other 3%