Borrar filtros
Borrar filtros

Convert ADC Voltage to dB

43 visualizaciones (últimos 30 días)
Johannes Plate
Johannes Plate el 14 de Dic. de 2022
Editada: David Goodmanson el 9 de Oct. de 2023
Hello folks,
I made some measurements with a hydrophone( preamp=30dB, water reference value 10^-6 Pa) and a AD converter. I want to get the dB values and plot them via 1/3 Octaveanalysis. The AD values are 16 bits, working/bias voltage -5 - +5 V, so reference voltage =10V. The code runs properly. I am asking for general check if the working routine is right and especially how to implement the hydrophone-preamp of 30 dB? Thanks in advance!
Kind regards
Johannes
% Steps:
% Vin(V) = OutputCode * LSBsize
% LSBsize(V/Code)= FSR/2^N
% FSR(V) = (m*Vref)/Gain
% m = 1;
% internal ADC gain should be 1
%Counts -> Voltage -> pressure level(underwater)
FSR = 10; % -5V - 5V
bits = 65536; % 16 Bits
LSB = FSR/bits; % LSB Size is the value or weight of the least significant bit (LSB) in the ADC code.
% Compute AD voltage
Vin = data_specific_cut * LSB; % [Volts]
% Compute pressure level (-163 dB Sensitivity at 1kHz from datasheet)
% [-163 dB re 1V/uPa -> 43dB re 1V/Pa -> 10^(-43/20)-> 0.007079457843841 V/Pa ]
Sensitivity = 0.007079457843841; % Transferfactor
Pressure = Vin/Sensitivity; % RMS for Vin??
Pref = 1*10e-6; % [reference value for water = 1 muPa = 10^-6 Pa]
dB = 20*log10(Pressure/Pref); % [dB re 1V/uPa]
% 30 dB Preamp hydrophone
data_dB = abs(dB); % doublecomplex to normal double

Respuestas (1)

Sivapriya Srinivasan
Sivapriya Srinivasan el 22 de Mayo de 2023
Editada: Sivapriya Srinivasan el 9 de Oct. de 2023
Hey Johannes,
Your code looks generally correct for converting the ADC values to voltage and then to pressure level in dB. However, I noticed a few things that might need clarification or adjustment:
1. ADC Reference Voltage: You mentioned that the reference voltage is 10V, but in your code, you calculate the LSB using a reference voltage of 5V (FSR = 10 and bits = 65536). Please ensure that the reference voltage is consistent throughout your calculations
2. Pressure Level Calculation: Your calculation for pressure level using Pressure = Vin/Sensitivity appears to be correct. However, keep in mind that this calculation assumes the voltage is the RMS value. If your Vin represents the peak value, you might need to divide it by the square root of 2 to convert it to RMS before computing the pressure level.
3. Calculation: Your calculation for dB using dB = 20*log10(Pressure/Pref) seems fine. It converts the pressure level to dB relative to 1 μPa. However, since you are interested in the absolute dB values for plotting, you can remove the abs() function in data_dB = abs(dB) since dB values are always positive.
4. Preamp Gain: If your hydrophone is equipped with a preamp with a gain of 30 dB, you can incorporate the gain into the calculation. Since the preamp amplifies the signal, you need to adjust the sensitivity value accordingly. To do this, multiply the sensitivity value by the gain factor in linear scale. In this case, you would use a sensitivity value of 0.007079457843841 * 10^(30/20) to account forthe30dBgain
Remember to verify the correctness of the hydrophone preamp gain value (30 dB) and double-check the specific calculations and conversions based on the hydrophone datasheet or other reliable sources. Additionally, consider whether you need to perform any frequency-weighting adjustments for 1/3 octave analysis.
Overall, the routine appears to be on the right track, but it's essential to ensure the correctness of the input values and perform appropriate validations and testing to validatetheresults.
You can refer to MathWorks Documentation for further assistance!
  3 comentarios
Sivapriya Srinivasan
Sivapriya Srinivasan el 9 de Oct. de 2023
Hello Carlos,
To convert the dB values to a positive scale, you can simply take the absolute value of the dB variable. This will give you the magnitude of the dB value without the sign.
Regarding the sensitivity adjustment, If the hydrophone preamp specifies a sensitivity of 210 dB SPL re: 1 µPa, then you don't need to adjust it further. The sensitivity value you provided (0.0000447) should be used directly without multiplying it by the preamp gain factor.
With this updation you should obtain positive dB values. Please note that the absolute value is taken after the calculation of dB to ensure that the values are positive.
I hope this clarifies the calculations for your specific case.
David Goodmanson
David Goodmanson el 9 de Oct. de 2023
Editada: David Goodmanson el 9 de Oct. de 2023
Hi Johannes, without getting into the details of the situation, it may be that you expect the dB values to be positive, but it is not true that "dB values are always positive". dB involve the log of a ratio, so if the ratio is greater than 1 the correspondng dB value is positive, and if the ratio is less than 1 the correspondng dB value is negative.

Iniciar sesión para comentar.

Categorías

Más información sobre Spectral Measurements en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by