Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADC bias injection #159

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

dkaukov
Copy link

@dkaukov dkaukov commented Jan 3, 2025

  • removes clipping
  • makes louder

To inject bias you need hardware modification:

    DRA818 AOUT-+---- GPIO34 (ADC Input)
                |
               [R1] 22kΩ
                |
 GPIO26 (DAC2) -+
                |
               [C1] 0.1µF
                |
               GND

Fixes: #148

- removes clipping
- makes louder
@SmittyHalibut
Copy link
Collaborator

SmittyHalibut commented Jan 6, 2025

What voltage does 138 on the DAC generate? Line 191.

V2 hardware (and v1.9 when I get time to lay it out) already biases to 0.59vDC using a simple resistor divider on the regulated 3.3v supply. Vref is 1.1v, so 0.59v is just about the center. Meaning, v2 hardware should work well without any modifications.

@@ -186,6 +187,8 @@ void initI2SRx() {

ESP_ERROR_CHECK(i2s_driver_install(I2S_NUM_0, &i2sRxConfig, 0, NULL));
ESP_ERROR_CHECK(i2s_set_adc_mode(I2S_ADC_UNIT, I2S_ADC_CHANNEL));
dac_output_enable(DAC_CHANNEL_2); // GPIO26 (DAC1)
dac_output_voltage(DAC_CHANNEL_2, 138);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What DC voltage does this generate?

Copy link
Author

@dkaukov dkaukov Jan 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @SmittyHalibut,

The SA818 datasheet lists the audio output amplitude at 0.7v, though in practice it's closer to 2v Vpp (probably datasheet states RMS value).

To accommodate this, I opted for ADC_ATTEN_DB_12, which provides an input range of 150 mV to 2450 mV (Espressif ADC Reference).

Theoretically, the ideal bias point would be at the center of this range:
[(2450 + 150) / 2 = 1.3v]

However, in practice, I’ve found 1.75v to work better for my boards. By "better," I mean that in 12-bit mode, it reads around 2048, which aligns with the center of the ADC range.

@dkaukov
Copy link
Author

dkaukov commented Jan 6, 2025

@SmittyHalibut This is my measurements after bias injection:

IMG_20241223_150452423.jpg

@dkaukov dkaukov requested a review from SmittyHalibut January 7, 2025 01:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[PCB] Connecting Audio to ADC is Problematic
2 participants