# e-tinkers/esp32-adc-calibrate architecture

> Architecture diagram of the GitHub repository e-tinkers/esp32-adc-calibrate, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/e-tinkers/esp32-adc-calibrate
- Repository: https://github.com/e-tinkers/esp32-adc-calibrate

## Overview

This is a small ESP32 firmware project for measuring ADC non-linearity, generating a device-specific lookup table, and applying that table in a separate sketch. The generator sweeps the DAC, samples the ADC, interpolates measurements, constructs the correction table, and prints it over Serial for copying into the example application. The example’s implementation was not sampled, so its internal behavior and wiring are shown only as documented in the README.

Main entry points: [`src/main.cpp`](https://github.com/e-tinkers/esp32-adc-calibrate/blob/master/src/main.cpp) (DAC sweep), [`examples/esp32_adc_lut_example.ino`](https://github.com/e-tinkers/esp32-adc-calibrate/blob/master/examples/esp32_adc_lut_example.ino) (LUT example sketch)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_generation["LUT generation"]
  node_sweep["DAC sweep<br/>[main.cpp]"]
  node_sampling["ADC sampling<br/>[main.cpp]"]
  node_interpolation["Measurement interpolation<br/>[main.cpp]"]
  node_lut["Correction LUT generation<br/>[main.cpp]"]
  node_serial["Serial table output<br/>[main.cpp]"]
end

subgraph group_use["LUT application"]
  node_example["LUT example sketch"]
  node_calibrated["Calibrated readings"]
end

node_operator(("Operator"))
node_dac["ESP32 DAC"]
node_adc["ESP32 ADC"]

node_operator -->|"starts"| node_sweep
node_sweep -->|"sets output"| node_dac
node_sampling -->|"reads samples"| node_adc
node_sweep -->|"takes readings"| node_sampling
node_sampling -->|"supplies measurements"| node_interpolation
node_interpolation -->|"feeds values"| node_lut
node_lut -->|"prints table"| node_serial
node_operator -->|"copies table"| node_example
node_example -->|"applies LUT"| node_calibrated

click node_sweep "https://github.com/e-tinkers/esp32-adc-calibrate/blob/master/src/main.cpp"
click node_sampling "https://github.com/e-tinkers/esp32-adc-calibrate/blob/master/src/main.cpp"
click node_interpolation "https://github.com/e-tinkers/esp32-adc-calibrate/blob/master/src/main.cpp"
click node_lut "https://github.com/e-tinkers/esp32-adc-calibrate/blob/master/src/main.cpp"
click node_serial "https://github.com/e-tinkers/esp32-adc-calibrate/blob/master/src/main.cpp"
click node_example "https://github.com/e-tinkers/esp32-adc-calibrate/blob/master/examples/esp32_adc_lut_example.ino"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_sweep,node_sampling,node_interpolation,node_lut,node_serial toneBlue
class node_example,node_calibrated toneAmber
class node_operator,node_dac,node_adc toneIndigo
```

## Components

### LUT generation

- [DAC sweep](https://github.com/e-tinkers/esp32-adc-calibrate/blob/master/src/main.cpp): `src/main.cpp`
- [ADC sampling](https://github.com/e-tinkers/esp32-adc-calibrate/blob/master/src/main.cpp): `src/main.cpp`
- [Measurement interpolation](https://github.com/e-tinkers/esp32-adc-calibrate/blob/master/src/main.cpp): `src/main.cpp`
- [Correction LUT generation](https://github.com/e-tinkers/esp32-adc-calibrate/blob/master/src/main.cpp): `src/main.cpp`
- [Serial table output](https://github.com/e-tinkers/esp32-adc-calibrate/blob/master/src/main.cpp): `src/main.cpp`

### LUT application

- [LUT example sketch](https://github.com/e-tinkers/esp32-adc-calibrate/blob/master/examples/esp32_adc_lut_example.ino): `examples/esp32_adc_lut_example.ino`
- **Calibrated readings**

### Other components

- **Operator**
- **ESP32 DAC**
- **ESP32 ADC**

## Connections

- Operator → DAC sweep: starts (evidence: `README.md`)
- DAC sweep → ESP32 DAC: sets output (evidence: `src/main.cpp`)
- ADC sampling → ESP32 ADC: reads samples (evidence: `src/main.cpp`)
- DAC sweep → ADC sampling: takes readings (evidence: `src/main.cpp`)
- ADC sampling → Measurement interpolation: supplies measurements (evidence: `src/main.cpp`)
- Measurement interpolation → Correction LUT generation: feeds values (evidence: `src/main.cpp`)
- Correction LUT generation → Serial table output: prints table (evidence: `src/main.cpp`)
- Operator → LUT example sketch: copies table (evidence: `README.md`)
- LUT example sketch → Calibrated readings: applies LUT (evidence: `README.md`)
