Post Go back to editing

# How to convert the input voltage data to dB in ADAU1701

Category: Software

Hello All,

I'm learning how to convert the the input voltage to dB in ADAU1701, and i know the voltage gain formula: A(V)=20lg(Vo/Vi). I took a test that sending a 1kHz sinewave which RMS value is -14dB to ADAU1701, and i measured the voltage RMS level of the sinewave is 200mV using the Oscilloscopes.

my question is:

how is it implemented in SigmaStudio or ADAU1701 to convert the voltage to dB?  according to the formula, Vo and Vi should be known to calculate the voltage gain. but there is just the input voltage 200mV. Am i missing something? or Is it converted by using the full-scale input RMS voltage?

Could anyone give some explanation? Thanks!

Best Regards

Eason

• Hello Eason,

This is actually a very deep subject and to answer this requires a lot of explaining. There are a lot of variable as well.

The first thing to point out is that going from analog to digital is like going from a real building measurements to a CAD drawing in a computer.

In a computer you can have a room that is 10x10. These are numbers in a computer not in reality. what is 10? Ten of what? so "1" is what? 1 meter? 1 Foot? 1 inch? 1 mile? 1kilometer?

So let's pretend it is 10 meters. A decent sized room. 10m x 10m. So in the real room that is built, is it 10m x 10m? I guarantee it is not EXACTLY 10m x 10m. It could be 9.8m x 10.2m.

Then add to this a what if,... what if the ruler the carpenter was using was not exactly 1 meter long? It was actually 0.9m long. So now the 10x10 room is built a little smaller. Or for the case of an ADC, you are measuring the room and translating these measurements into the CAD drawing so a 10x10 room would be put in as an 11.1mx11.1m because the reference used to translate the real world to the digital world was a little short.

For the audio converters the ruler is the voltage reference. The voltage reference will be what a full scale volage reference is and if the voltage equals the voltage reference the resulting number in the digital world will be a "1". A full scale value. For a DAC it is the opposite. A "1" in the digital realm will be translated to a voltage output based on the value of the voltage reference.

Then add to this the complication that for audio converters we do not go from zero to full scale, We go from mid-scale to full scale positive and mid scale to full scale negative using 2's compliment numbers to represent a positive or negative value. This is why the converters usually sit at a common mode voltage when there is no signal in. This voltage is roughly mid way.

Now, let's add even MORE complication! The ADC converters in the ADAU1701 are a current input converter not voltage! So there is a mid-scale current, full-scale current and there will be a small current close to zero that will convert to full-scale negative in the digital side of the converter.

Here it is in the datashet:

So it is up to you to design an OpAmp input stage to convert a voltage to current and to put in the correct resistor to obtain the results you want for a full scale digital input.

Here are a few older posts that dicsuss similar issues with translating from analog to digital and back. These are for the voltage input ADCs but the basic concepts are the same.

(+) AD1938 voltage range - Q&A - Audio - EngineerZone (analog.com)

(+) AD1938 CODEC Full-Scale Input Voltage (Differential) - Q&A - Audio - EngineerZone (analog.com)

One other thing I should mention is that the meters in the DSP core will report the RMS value so a full scale 0dBFS signal will be reported as -3dB. You can see this if you simply drag in an oscillator and connect the output to a meter. The oscillators are exactly 0dBFS in the DSP core. I should qualify this as a 0dBFS level of a 24 bit level right justified in the 28 bit core. There is some headroom in the core above 0dBFS. We do this so there is a clear understanding of the full scale level in and out of the core.

Dave T

• Hello Dave,

Appreciate for your quick response and detailed explanation. based on the full-scale input in the datasheet, i changed the resistor actually used and i got the right dB data.

By the way, i'm thinking about reading the input or output RMS value of ADAU1701 directly with a microcontroller, i checked the SigmaStudio and didn't find any RMS hold module to implement this, so just to confirm that is it possible to do this function on ADAU1701? Hope you can give some suggestion. thanks！

Eason

• Hello Eason,

You can use an average or peak envelope generator then do some calculations to translate it to RMS and send it to a readback cell then read it with your microcontroller but we already did all that for you with the meter blocks. SigmaStudio uses the meter blocks to integrate the date over a 10ms period and SigmaStudio reads the DSP every 10ms to pick up the data then displays it on the screen. The PC does do some calculations as well.

Here are some older posts where I discuss this topic.

(+) ADAU1701 Readback Register on a Microcontroller - Q&A - Audio - EngineerZone (analog.com)

Dave T