-
Notifications
You must be signed in to change notification settings - Fork 50
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
base: main
Are you sure you want to change the base?
ADC bias injection #159
Conversation
- removes clipping - makes louder
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); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
@SmittyHalibut This is my measurements after bias injection: |
To inject bias you need hardware modification:
Fixes: #148