LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sound Pressure; Converting DAQmx data to dB using LabVIEW 2012

I am very new to LabVIEW, DAQ systems, and data acquisition in general, and have been tasked with a seemingly daunting task.  I must compose a VI which will indicate the maximum decibel level of a percussive sound.

To accomplish this, I have the following;

- NI cDAQ-9178 Chassis (USB)

- NI 9232 module

- a PCB pressure prepolarized 377A12 microphone (model 378A12), with a PCB microphone preamplifier

- a Larson Davis CAL200 microphone calibrator

- LabVIEW 2012 Full Development System

 

So far, I've been able to use the Measurement & Automation Explorer, as well as the DAQ assistant (DAQmx) to get a signal from the microphone, but I'm not quite sure about how to convert that signal to dB.

 

In both the Measurement & Automation Explorer, as well as the DAQ assistant, I have input the following settings;

- Max Level (dB): 140 <--- from microphone user manual

- sensitivity: 0.25 mV/Pa <--- from microphone user manual  

- Iex Value (A): 4m <--- preamplifier user manual gives a range of 2 to 20 mA

- dB Reference: I left it as 10u, 'cause I have no idea what this is for.

- No custom scale

- Terminal Configuration was left as "Let NI-DAQ Choose"

- Acquisition mote: continuous samples

- Rate (Hz): 51.2k

 

For this task, I hope to capture the peak dB level of a very short (almost instantaneous) percussion (e.g. gun shot).

 

Two conversion equations were provided in the documentation for the microphone, but their application baffles me slightly.  The first is the conversion from output voltage to pressure; Pressure (Pa) = Voltage (mV) / Sensitivity (mV/Pa)

The second is the conversion from output voltage signal (Vrms) to sound pressure level (dB); dB = 20 Log(Vrms/(S*Pref)), where S is sensitivity and Pref is reference pressure (20E-6).

I've input these equations into a VI and output the results into a Waveform Chart.  The microphone calibrator produces a steady tone in either 94 dB or 114 dB, so I attempted to use that signal to produce the waveform.  The VI will measure the 114 dB signal at around 120 dB, but doesn't produce a waveform for the 94 dB at all.

I've attached the VI, but I'm guessing it's pretty useless without the hardware.

 

Either way, I'm not quite sure I'm headed in the right direction, and I would greatly appreciate any input or suggestions.

 

Cheers,

 

Ryan

0 Kudos
Message 1 of 7
(6,967 Views)

Hello RP_Colt,

 

I was checking your VI and you’re measuring one channel, hence outputting one waveform. You need to measure two channels in order to output two waveforms and display them using the waveform chart.

 

Regards,

 

Alina M

0 Kudos
Message 2 of 7
(6,929 Views)
Hi,

The dB reference sounds like it should be set to the same as you Pref. this input is going to set the 0 dB value.

Cheers,
James Mc
========
CLA and cRIO Fanatic
My writings on LabVIEW Development are at devs.wiresmithtech.com
0 Kudos
Message 3 of 7
(6,925 Views)

RP_Colt

 

You need to set the dB Referance 20u, 20u is equal to 2e-5

 

on the calibration tab inside the daq assistant you should be able to to cal your microphone using LD CAL200, use the settings of 94 dB @ 1000Hz.  the measured sensitivity should be close to the .25mv/Pa

 

remove the rest of the math outside of the DAQ assistant.

 

then you should be good.

 

 

0 Kudos
Message 4 of 7
(6,912 Views)

So, the last week or so has been very busy, not leaving me with a lot of time to reply, but I've done some changes with mixed results.

 

I've abandoned the DAQ assistant VI in favour of the DAQmx method.  I found an example of a VI for sound pressure measurement, and have modified it a bit to suit (see attached image)

 

In response to some of your reply's;

 


@amezam wrote:

Hello RP_Colt,

 

I was checking your VI and you’re measuring one channel, hence outputting one waveform. You need to measure two channels in order to output two waveforms and display them using the waveform chart.

 

Regards,

 

Alina M


Yup... that's the intent; there is only one channel being measured... one microphone, one channel, one waveform chart.

 

 


@James_McN wrote:
Hi,

The dB reference sounds like it should be set to the same as you Pref. this input is going to set the 0 dB value. 

Cheers,

0dB for reference sound, in either the DAQ assistant or in NI MAX, results in no reading at all.  According to the reference information that came with the microphone, Preference is 2e-5 Pa.  

 


@tmcarson wrote:

RP_Colt

 

You need to set the dB Referance 20u, 20u is equal to 2e-5

 

@ON the calibration tab inside the daq assistant you should be able to to cal your microphone using LD CAL200, use the settings of 94 dB @ 1000Hz.  the measured sensitivity should be close to the .25mv/Pa

 

remove the rest of the math outside of the DAQ assistant.

 

then you should be good.

 

 


 

Everything you wrote makes perfect sense, and I've made some changes to the original VI I've posted to reflect your comments (see attached VI), but I've run into more issues;

 

@1) the calibration tab / wizard doesn't work with the 94 dB @ 1000Hz setting of the calibrator... it only works with the 114 dB setting.  At the 94 dB setting it returns an error.  

 

2) once calibrated, the peak amplitude reads around 12 to 14 unitless increments... I'm guessing they're microvolts, but LabVIEW seems to omit a lot of units.  So, with this said, it appears the math is still required to convert mV to dB... unless I missed something.

 

 

Anyway, as it stands, I've been able to use the VI as shown in the attached image to produce a waveform and see the positive peak of a almost instantaneous sound (specifically, a gun shot)... and we've been able to compare this peak sound pressure to those from test done years ago.  The problem, I think, is calibration; the sound pressure we're observing is 10 to 20 dB greater than that of previous tests.

 

So, what I'm trying to do now is find a way to a) adjust some variable to calibrate the readings of the mic, and b) record the instantaneous positive peak either by exporting to excel or by some other means.  Right now, we're firing a rifle with the mic about a meter away from the muzzle and using 'print screen' to capture an image of the waveform... obviously not the best way to do things, for sure.

 

To make matters more interesting; I only have about a day or so to get this working before we start using it for tests... and at the same time, I have to write a program that will do virtually the same thing, but with a force transducer so we can measure recoil force.  I'm almost to the point of hiring an outside contractor to write these programs for us, as this is well beyond my LabVIEW knowledge and experience (core 1 & 2 courses only).

 

 

 

Download All
0 Kudos
Message 5 of 7
(6,881 Views)

Try the attached project. I modified a LV example - IEPE continuous input 

 

I removed some stuff and added a "cal" tab

 

if you turn the trigger on to the analog start you can play with the level voltage the capture the impulse noise

 

the png is the setup for the impulse triggered acquisition

Download All
0 Kudos
Message 6 of 7
(6,857 Views)

hi! i tried to open your project on my file but it seems like there are some VI im missing

0 Kudos
Message 7 of 7
(6,468 Views)