Smart Intercom using ESP32 #1620
-
Hey guys, am trying to make my STR 200 TV intercom smart. I am currently working on picking up the microphone audio (which is the easiest since I don't need another person at the door). The output is 4.3V so I build a voltage divider circuit using resistors (the probe divides by 10): This is in theory my script to output the audio signal to a web browser (just for testing): https://youtu.be/rurvSKYao3U ` #include "AudioTools.h" // WIFI // Static IP configuration AudioWAVServer server(ssid, password); // ADC and I2S Configuration class ADCStream : public AudioStream {
}; ADCStream adcStream; void setup() {
} void loop() { Unfortunately, I don't hear anything. I tried outputting the ADC values and if I speak, the go up to a max of 300. Does anyone have an idea what I am doing wrong? |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments
-
Why adding all this complexity ? Just use an AnalogAudioStream in input mode! ps. your code will not work anymore if you upgrade to an actual ESP32 core version because the I2S API has changed! |
Beta Was this translation helpful? Give feedback.
-
@pschatzmann Thank you for the fast reply! What code should I use? I am using an ESP32-WROOM-32 board. The ultimate goal is to send the audio data via a web socket to my server |
Beta Was this translation helpful? Give feedback.
-
I have updated my code to this: `#include "Arduino.h" // WIFI credentials // Static IP configuration // TCP settings AnalogAudioStream in; unsigned long sampleCount = 0; void setup() {
} void loop() {
}` And am using this python script to save the values: import socket TCP_IP = "192.168.1.200" # ESP32's IP address Generate a unique filename based on current timestampfilename = f"audio_data_{datetime.now().strftime('%Y%m%d_%H%M%S')}.csv" with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
print(f"Data saved to {filename}") audio_data_20240716_172132.csv Is this what I should expect? Given that the above code is not working anymore for the board, what approach would you recommend so I can broadcast the digitised audio to web to listen to it (just to verify it is working)? |
Beta Was this translation helpful? Give feedback.
-
https://github.com/pschatzmann/arduino-audio-tools/wiki/It's-not-working Just test the value range of the ADC signal first with the sketch that I have sent you! |
Beta Was this translation helpful? Give feedback.
-
@pschatzmann I have set it to D32 pin. This is the serial output: What i have seen in the Oscilloscope is that it hovers around 2.1V and then fluctuates by a maximum of 0.1V |
Beta Was this translation helpful? Give feedback.
-
Just record a sine wave and display it with the Arduino Serial Plotter. ps: send out the raw data and convert it on the desktop. |
Beta Was this translation helpful? Give feedback.
Why adding all this complexity ? Just use an AnalogAudioStream in input mode!
Here is an example that reads from an analog mocrophone...
ps. your code will not work anymore if you upgrade to an actual ESP32 core version because the I2S API has changed!