snapshot
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
# ESP32 Analog to Digital Conversion Throughput using Continuous ADC API
|
||||
|
||||
Data is reported in bytes per second when using a single ADC unit and two A/D channels.
|
||||
When each channel is measured with 4,000 samples per second the ADC is running at 8,000 samples per second as it multiplexes between the two channels.
|
||||
|
||||
The maximum sampling frequency depends on the ESP32 model.
|
||||
|
||||
The older ESP32 models can convert up to 2 Million samples per second, however there is discrepancy between the expected and effective throughput of about 20%.
|
||||
|
||||
The library creates int16_t datatype which is 2 bytes per sample.
|
||||
|
||||
## Adafruit Feather ESP32-S3 2MB PSRAM
|
||||
```
|
||||
|
||||
SPS : expected, measured
|
||||
150: error, sample rate eff: 300, range: 611 to 83,333
|
||||
306: 1,224, 1,000
|
||||
4,000: 16,000, 16,000
|
||||
8,000: 32,000, 32,000
|
||||
11,025: 44,100, 44,000
|
||||
16,000: 64,000, 64,000
|
||||
20,000: 80,000, 80,000
|
||||
22,050: 88,200, 89,000
|
||||
40,000: 160,000, 161,000
|
||||
44,100: error, sample rate eff: 88,200, range: 611 to 83,333
|
||||
```
|
||||
|
||||
## Sparkfun ESP32 WROOM Plus C
|
||||
```
|
||||
Data: bytes per second, single unit, two channels
|
||||
SPS/CH expected, measured % of expected
|
||||
5000: error, sample rate eff: 10000, range: 20000 to 2000000
|
||||
10000: 40,000, 32,000
|
||||
22050: 88,200, 72,000
|
||||
44100: 176,400, 144,000
|
||||
88200: 352,800, 157,000
|
||||
500000: 2,000,000, 1,635,000
|
||||
1000000: 4,000,000, 3,271,000
|
||||
```
|
||||
|
||||
## DOIT ESP32 DEVKIT V1
|
||||
```
|
||||
Data: bytes per second, single unit, two channels
|
||||
SPS : expected, measured 80% of expected
|
||||
5000: error, sample rate: 5000, range: 10000 to 1000000
|
||||
10000: 40,000, 32,000
|
||||
20000: 80,000, 64,000
|
||||
22050: 88,200, 72,000
|
||||
44100: 176,400, 144,000
|
||||
48000: 192,000, 156,000
|
||||
88200: 352,800, 288,000
|
||||
96000: 384,000, 313,000
|
||||
176400: 705,600, 576,000
|
||||
192200: 768,800, 628,000
|
||||
352800: 1,411,200, 1,153,000
|
||||
384000: 1,536,000, 1,256,000
|
||||
500000: 2,000,000, 1,635,000
|
||||
1000000: 4,000,000, 3,271,000
|
||||
1500000: error, sample rate: 1500000, range: 10000 to 1000000
|
||||
```
|
||||
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
* Internal ADC: It depdens pretty much on our processor & arduino version if and how
|
||||
* this is supported.
|
||||
*/
|
||||
|
||||
#include "Arduino.h"
|
||||
#include "AudioTools.h"
|
||||
|
||||
// On board analog to digital converter
|
||||
AnalogAudioStream analog_in;
|
||||
|
||||
// Measure throughput
|
||||
MeasuringStream measure(1000, &Serial);
|
||||
|
||||
// Copy input to output
|
||||
StreamCopy copier(measure, analog_in);
|
||||
|
||||
void setup() {
|
||||
|
||||
delay(3000); // wait for serial to become available
|
||||
|
||||
// Serial Interface
|
||||
Serial.begin(115200);
|
||||
// Include logging to serial
|
||||
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info); //Warning, Info, Error, Debug
|
||||
|
||||
// Configure ADC input
|
||||
auto adcConfig = analog_in.defaultConfig(RX_MODE);
|
||||
|
||||
// For ESP32 by Espressif Systems version 3.0.0 and later
|
||||
// see examples/README_ESP32.md
|
||||
// adcConfig.sample_rate = 22050;
|
||||
// adcConfig.adc_bit_width = 12;
|
||||
// adcConfig.adc_calibration_active = true;
|
||||
// adcConfig.is_auto_center_read = false;
|
||||
// adcConfig.adc_attenuation = ADC_ATTEN_DB_12;
|
||||
// adcConfig.channels = 2;
|
||||
// adcConfig.adc_channels[0] = ADC_CHANNEL_4;
|
||||
// adcConfig.adc_channels[1] = ADC_CHANNEL_5;
|
||||
|
||||
adcConfig.sample_rate = 44100; // per channel
|
||||
|
||||
Serial.println("Starting ADC...");
|
||||
analog_in.begin(adcConfig);
|
||||
|
||||
// Start Measurements
|
||||
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Warning); //Warning, Debug, Info, Error
|
||||
Serial.println("Starting through put measurement...");
|
||||
}
|
||||
|
||||
void loop() {
|
||||
copier.copy();
|
||||
}
|
||||
Reference in New Issue
Block a user