From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

How to set up a microphone using DAQmx C Reference?

Solved!
Go to solution

Hello guys.

 

I'm have NI USB-9234 Hardware and I downloaded DAQmx (20.1ver).

I want to collect the sound data from microphone(PCB 378B02) that linked the USB-9234's channel 1 by using DAQmx C Reference function.

 

It is working good but when loud sound occurring to the microphone, recorded *.wav file have some crackling noise.

Here is my source code. ( I referenced the example code. Path : ..NI-DAQ\Examples\DAQmx ANSI C\Analog In\Measure Sound Pressure)

 

DAQmxErrChk (DAQmxCreateTask("",&taskHandle));

DAQmxErrChk(DAQmxCreateAIMicrophoneChan(taskHandle, "Dev1/ai0", "", DAQmx_Val_PseudoDiff, DAQmx_Val_Pascals, 50, 124.0, DAQmx_Val_Internal, 0.005, NULL));

DAQmxErrChk(DAQmxCfgSampClkTiming(taskHandle,"",25600,DAQmx_Val_Rising,DAQmx_Val_ContSamps, 1000));

DAQmxErrChk(DAQmxRegisterEveryNSamplesEvent(taskHandle,DAQmx_Val_Acquired_Into_Buffer, 1000,0,EveryNCallback,NULL));
DAQmxErrChk(DAQmxRegisterDoneEvent(taskHandle,0,DoneCallback,NULL));

 

I wonder if my DAQmx function is not correct.

 

Anyone who know the microphone setting, please let me know

0 Kudos
Message 1 of 2
(2,239 Views)
Solution
Accepted by topic author yena2

Did you do the math?

 

Your Mic has 50mV/Pa sensitivity. It can handle a signal at 3% distortion up to 137 dB re 20 uPa. 

 

You configure the DAQmx channel to be able to read up to 125dB re 20 uPa.

 

This 125dB SPL is around 40 Pa at 50mV/Pa, this results in a signal of 2Vrms, so about +-3Vp. This seems to be fairly safe for the range of the USB-9234 which is specified at +-5V max. You could go up to 3Vrms (about 60Pa or 129dB re 20uPa).

 

But the microphone specifies that it requires an excitation voltage between 20 to 30 Volt, while the USB-9234 only delivers a rated IEPE compliance voltage of 19 Volt at 2.1mA typical.  You want it to deliver 5mA so there is a good chance that the specified 19V are not really reached. And your Microphone has an output bias of 10 to 14V, which could mean in the worst case that there is only 5V of the 19V excitation available to power the microphone, and that to produce a signal that lies close to 5V at maximum. That must somewhere somehow clip sooner or later.

 

So it would seem likely that at high sound pressures the internal circuitry of your microphone doesn't have enough voltage headroom to still operate in its linear range. First I would try to lower the constant excitation current from 5mA to the minimum specified for the microphone, which is 2mA. 

 

Of course it would be helpful if you can somehow organize an oscilloscope to look at the signal that you connect to the USB-9234.

Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 2
(2,157 Views)