snapshot
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
|
||||
# Stream Analog Input to Serial Output
|
||||
|
||||
## General Description:
|
||||
|
||||
We just send the audio data that we receive from microphone the Serial output, so that we can monitor it in the Serial Plotter.
|
||||
|
||||
Here is the result on the Arduino Serial Plotter:
|
||||
|
||||

|
||||
|
||||
|
||||
### Analog Input:
|
||||
|
||||
| ADC | ESP32 | UNO R4
|
||||
| --------| --------|-------
|
||||
| VCC | 3.3V | 3.3V
|
||||
| GND | GND | GND
|
||||
| OUT | GPIO34 | A0
|
||||
|
||||
For the input I was using a MCP6022 Microphone Sensor.
|
||||
Plaese note that the signal that we receive from the ADC might need to be adjusted so that it is oscillating around 0.
|
||||
|
||||

|
||||
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* @file streams-analog-serial.ino
|
||||
* @author Phil Schatzmann
|
||||
* @brief see https://github.com/pschatzmann/arduino-audio-tools/blob/main/examples/examples-stream/streams-adc-serial/README.md
|
||||
* @copyright GPLv3
|
||||
* #TODO retest is outstanding
|
||||
*/
|
||||
|
||||
#include "Arduino.h"
|
||||
#include "AudioTools.h"
|
||||
|
||||
AnalogAudioStream in;
|
||||
AudioInfo info(8000, 1, 16);
|
||||
CsvOutput<int16_t> out(Serial); // ASCII output stream
|
||||
StreamCopy copier(out, in);
|
||||
|
||||
// Arduino Setup
|
||||
void setup(void) {
|
||||
Serial.begin(115200);
|
||||
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Warning);
|
||||
|
||||
auto cfgRx = in.defaultConfig(RX_MODE);
|
||||
// cfgRx.start_pin = A1; // optinally define pin
|
||||
// cfgRx.is_auto_center_read = true;
|
||||
cfgRx.copyFrom(info);
|
||||
in.begin(cfgRx);
|
||||
|
||||
// open output
|
||||
out.begin(info);
|
||||
|
||||
}
|
||||
|
||||
// Arduino loop - copy data
|
||||
void loop() {
|
||||
copier.copy(); //
|
||||
}
|
||||
Reference in New Issue
Block a user