snr

Example of the component carlos-lorenzo/ads1299 v0.1.6
# ADS1299 SNR Measurement Example

This example computes the Signal-to-Noise Ratio (SNR) for all 8 channels of the ADS1299 by comparing the internal baseline noise (shorted inputs) against the internal test signal.

## How It Works

The example utilizes the continuous acquisition driver and cross-core IPC (Inter-Process Communication) to gather sample chunks. It runs a simple, two-step procedure:

1.  **Noise Measurement:** Inputs are internally shorted, and the RMS noise is calculated over a 1-second period.
2.  **Signal Measurement:** The internal test signal is enabled, and its signal power is measured over another 1-second period.

### Computed Metrics

For both phases, the collected voltage samples ($v_i$) over $N$ total samples are used to calculate:

**Mean Square (Power)**
$$Mean Square = \frac{1}{N} \sum_{i=1}^{N} v_i^2$$

**Root Mean Square (RMS)**
$$RMS = \sqrt{Mean Square}$$

**Signal-to-Noise Ratio (SNR)**
$$SNR = \frac{Mean Square_{signal}}{Mean Square_{noise}}$$

**SNR in Decibels (dB)**
$$SNR_{dB} = 10 \log_{10}(SNR)$$

## Quick Start

The hardware setup requires standard SPI connections (MISO, MOSI, SCLK) alongside ADS1299 control pins (CS1, DRDY, START, RESET) and power management (ANPWREN). Ensure your ESP32 target matches the definitions at the top of `main.cpp`.

To run the example, navigate to this directory and execute:

```console
idf.py set-target esp32s3
idf.py build flash monitor

To create a project from this example, run:

idf.py create-project-from-example "carlos-lorenzo/ads1299=0.1.6:snr"

or download archive (~4.64 KB)