Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

External ADC + external DAC on esp32 #1525

Answered by pschatzmann
gurinkirill asked this question in Q&A
Discussion options

I have next scheme: mic -> DAC (PCM5102A) -> esp32 -> ADC (PCM1808) -> speaker. I configure these like:

#include "Arduino.h"
#include "AudioTools.h"
I2SStream in;
I2SStream out;
StreamCopy copier(out, in);
void setup() {
 Serial.begin(115200);
 AudioLogger::instance().begin(Serial, AudioLogger::Info);
 // ADC
 auto configAdc = in.defaultConfig(RX_MODE);
 configAdc.port_no = 0;
 configAdc.pin_bck = 33;
 configAdc.pin_ws = 32;
 configAdc.pin_data = 25;
 configAdc.i2s_format = I2S_STD_FORMAT;
 configAdc.bits_per_sample = 32;
 configAdc.channels = 2;
 configAdc.sample_rate = 44100;
 configAdc.is_master = true; // optional because default setting
 configAdc.use_apll = false;
 configAdc.pin_mck = 3;
 in.begin(configAdc);
 // DAC
 auto configDac = out.defaultConfig(TX_MODE);
 configDac.port_no = 1;
 configDac.pin_bck = 14;
 configDac.pin_ws = 26;
 configDac.pin_data = 27;
 configDac.i2s_format = I2S_STD_FORMAT;
 configDac.bits_per_sample = 32;
 configDac.channels = 2;
 configDac.sample_rate = 44100;
 configDac.is_master = true;
 configDac.use_apll = false;
 configDac.pin_mck = 3;
 out.begin(configDac);
}
void loop() {
 copier.copy(); 
}

After uploading there is only noise in speakers. What can be the problem?

The DAC works well with internal esp32's ADC, but after connecting external one I'm facing that problem. So, I think that the problem may be related to incorrect ADC setting. I tried to change ADC's .is_master to false, nothing happens.

Connection scheme:
Снимок экрана 2024年04月23日 111229

You must be logged in to vote

Just look at the provided examples: There is a one port soluton where you can share the pins and a two port solution where you would need to specify the port:

Replies: 2 comments 8 replies

Comment options

Just look at the provided examples: There is a one port soluton where you can share the pins and a two port solution where you would need to specify the port:

You must be logged in to vote
0 replies
Answer selected by pschatzmann
Comment options

Hello @gurinkirill,
Did you manage to get your project working? Because I have a similar project and I don't get any sound coming out of the PCM5102 (which works fine on its own) - I think it's the PCM1808 that's causing the problem...
Many thanks in advance !

You must be logged in to vote
8 replies
Comment options

Maybe problem is in connection? Some esp's pins are inappropriate for i2s communication

Comment options

Thank you, I will try this connection of the jumpers !
But did you still keep the pcm1808 with the microphone ? Or do you have your microphone directly connected to the ESP's ADC ?

Comment options

Mic out is connected to ADC input, mic voltage and ground to esp. MAX9814 (mic) out pin → PCM1808 ADC R_IN

Comment options

Thank you so much for taking the time to help me! I'll try this when I have time.

Comment options

If you have any more questions, you are welcome)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /