ESP32-A2DP
ESP32-A2DP copied to clipboard
ESP32 internal DAC playing music with noise
Hi Everyone!
I'm using a DEVKIT V1 (ESP32 WROOM 32) to test my project, but when i start a BT connection with my Android using the internal DAC of ESP32 i hear a lot of noise when music played (of course, if they is not playing too).
My question is, this "issue" is caused by internal DAC or my "hardware"?
I'm using exemple codes only, with a P2 jack removed of a motherboard and connected in GPIO25, GPIO26 and GND pins, my board are powered with a 5v~1A power supply on VIN/GND pins and nothing more, I'm not using any amplifier, only my headphone connected on P2...
Having, same issue, searching for solutions, I think it's isolation problem, it picks up noise of data that's going through the board. https://newbedev.com/esp32-adc-not-good-enough-for-audio-music Looks like the problem is that, ADC pins are not isolated from PSU, so we also get noise that is provided from PSU.
I'm using wemos lolin32 lite clone board.
Just a thought: powering the device from a battery (Power Bank) might help - if the noise comes from the power supply
Same happens with battery :), tried 2 different batteries.
try to add 220uF capacitor in + audio signal
Well it helps with the noise, but also lose a lot of top end sound. 22uF 33uF 47uF wasn't quite enough to get rid of the noise, 100uF was enough but top end cuts off.
I just did some testing today with a cheap china DEVKIT V1 from DOIT and I confirm that I am getting some noise as well, so I guess this is a generic problem coming from the radiation of the cpu and the bluetooth emitter.
The most reliable way is to use an external DAC: https://github.com/pschatzmann/ESP32-A2DP/wiki/External-DAC
The ESP32 has no isolation between the power supplies of the analogue and digital aspects of the chip. In fact the analogue and digital portions are so intertwined (necessary for the RF system to work) that it would be very hard to have any decent noise control. RF operations have short bursts of higher current usage which causes a lot of noise on the power supply, and that noise is reflected through the DAC outputs.
It's unavoidable given the architecture of the ESP32, and there is nothing you can do to cure it.
To have anything even vaguely approaching good audio you have to use an external I2S DAC, and make sure it's powered by a separate power feed - with added filtering - than the ESP32 to prevent the ESP32's noisiness from ending up affecting the DAC's sound quality.
when I connect power suppy using 3.3v of esp32 for AMP, and stop play music, there is no Common Ground noise,but when I play music, there have noise again. I guess, the noise is produced by esp32 bluetooth emmiter. so there no good solution for remove noise when you use internel DAC. Maybe externel DAC could fix this
Yes it will!
Try a different ground pin (there are several) on the ESP32 for your sound stage. Some ground pins definitely give more distortion than others, especially on cheap knockoff ESP32s, especially with BLE initialized.
Try a different ground pin (there are several) on the ESP32 for your sound stage. Some ground pins definitely give more distortion than others, especially on cheap knockoff ESP32s, especially with BLE initialized.
Wait... There are cheap knockoff esp32s out there? Do you mean devkit boards, or the esp32 modules themselves?
Wait... There are cheap knockoff esp32s out there? Do you mean devkit boards, or the esp32 modules themselves?
I mean the boards. The cheaper ones create RF distortion on their common grounds.
This can be minimized by using a piezo speaker wired in H-Bridge configuration directly to pins 25 and 26 and using a dual-GPIO-pin AC driver rather than the usual single-pin DC drivers with dirty grounding.
AC drivers give a much cleaner, louder sound. Also single-pin DC drivers can burn out the voltage regulator if the speaker is directly grounded without a transistor. DC drivers also destroy piezo speakers over time, whereas AC does not.
The general recommendation is to use the internal DAC only for testing or if noise is acceptable. Otherwise use a proper I2S DAC!
Большинство усилителей имеют дифференциальные входы IN+ и IN-, если подключить их оба к GPIO то шумы питания должны взаимно компенсироваться, но это только теория.
You guys got improved audio quality by placing capacitors like this? (In "series" as the image shows...)
As opposed to placing capacitors to ground...
I do not have the same audio quality issues as in - the audio is bad in both scenarios, but there's a much different sound here
Это устранит проблему лишь частично, правильное решение подключать источник звука к дифференциальным выходам DAC
Sorry, my chinese is a bit rusty... How much for 3 dumplings?
Anyway... It turns out the DAC is fine at higher volumes, because the noise is a problem when it's at lower voltages. I get pretty good results with just a 2kOhm to 15kiloOhm resistor and the volume at 2/3s or higher.
The resistors quiet the actual sound that is output through the speakers (so that I can play at high DAC voltage outputs without burning my eardrums, and without it being bothered by the antenna noise).
One might also consider a rotary potentiometer to keep the DAC output at a high voltage (noiseless), but have the volume be more adjustable. Without one you'd want to write a volume function to adjust the new range to start at about 2/3 the current maximum volume.
Adding inline caps and resistors is effectively creating highpass filters to reduce the RF interference. This comment "just use a proper I2C DAC" is kind of missing the point. The idea is to minimize BoC by using the internal DAC.
Also the commentator above is writing in cryllic, not hànzì (it's Russian not Chinese) and contained zero dumpling content. See examplar below:
У Хемпмана фетиш на пельмени 亨普曼喜欢饺子