Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Hardware Advice for measuring sound

Hello,

My masters project has taken a turn and now I am using the speed of sound. There are two arguments that have arisen. One from my supervisor who says that LabVIEW is used in industry and that it is a real-time environment, meaning I would be able to measure the time taken for sound to travel x metres (minimum 0.5m and 7m maximum).

 

On the other hand the Labview guru on campus has suggested that using a USB interface, and the fact that Windows XP is not a real time environment would not return true times and there are other priorities that Windows has to handle firs giving erroneous times.

Which argument is true, and which solution should I take.

Firstly, should I using a microcontroller with dedicated timers to time the sound by starting a counter at 1.2MHz and take start value and finish value and then working backwards to get the time, with the obvious hard part of setting up communications with Labview through serial.

Or should I purchase some sort of serial/USB interface for Labview that would be able to handle the job. If this option is best suited, are there any recommendations for hardware? I'm using the SCB-68 which can only be used on a desktop computer. I need something that is either Serial or USB as the final product will be controller via laptop.

Cheers

0 Kudos
Message 1 of 18
(5,918 Views)

Kamilan,

There is truth in both statements but it depends on the testing being done.  NI has a LabVIEW Realtime Module which can be used to respond to events in a deterministic fashion.  Software processing on a Windows XP machine will not be deterministic but will be on a real time operating system such as Pharlap.  On the other hand, acquiring data will be deterministic because it will utilize the DAQ Hardware and its clock.  The important note to make is that the software processing will not give you deterministic behavior if you are not using a real-time operating system.

In terms of the acquisition, I believe that you may just want to start your microphones simultaneously and then post process the data to find the change in time.  The other option would be to start your data acquisition devices simultaneously and then post process the data.  It sounds as if this will run only once and then the data is viewed.  The counter method would also be feasible and would only require one additional software processing step: # of counts/timebase used.  If you need a USB DAQ device then I might recommend the 621x series or a card such as the USB-6218.  The final design will depend on the equipment available to you and if devices can be started simultaneously.

0 Kudos
Message 2 of 18
(5,909 Views)

Hello,

I will take all that you said into consideration. I was talking to my Dad about the problem and an idea popped into my head. Its a combination of both solutions. I figured that I could build an external square wave oscillator. Instead of using a software timer, have Labview read rising edges. When I tell the robot to make the beep, Labview will start counting rising edges, and then when the "received" signal is received, stop counting.

This way, if we know the frequency, the time can be calculated. The higher the oscillator frequency, the higher the resolution. What do you think? Will this USB interface be able to handle high clock speeds?

Cheers

K

 

0 Kudos
Message 3 of 18
(5,906 Views)

Kamilan,

Looks like a good starting place.  The maximum detectable frequency of a counter is going to be the timebase utilized / 4.  You are correct to assume that a higher frequency means better resolution, though.  You could also configure a pulse width measurement with the counter on your daq device.  This developer zone provides a little more insight into this application.  Basically, you could provide a signal to your gate which will tell how long the signal is traveling.  (while traveling the signal is high)  The source will be your internal timebase and you can take your count and find the time.  Hope this suggestion helps!

0 Kudos
Message 4 of 18
(5,891 Views)

Hello,

 

I'm just testing if I can use an external oscillator to timer. I'm using a NI-PCI 6229 and a SCB-68 interface box. I'm having trouble with the connections. Any advice for using the DAQx?

 

The is not wiring diagram, so I’m not sure where to put the signal in.

 

Cheers

 

0 Kudos
Message 5 of 18
(5,885 Views)

Kamilan,

 

The pinouts of the PCI-6229 can be found on page 22 of the PCI-622x manual.  The wiring will depend on the exact application that you wish to achieve.  For example, if you would like to count the number of pulses from the external oscillator then you would need to place your oscillating signal in the source of a counter.  I have also included an image which shows what the pinouts of the 6229 correspond to.  Hope this helps.

0 Kudos
Message 6 of 18
(5,875 Views)

Hi,

 

Thank you so much for that data. It's exactly what I was looking for. I will post an update on my progress Monday when I am in the Labs next.

 

Cheers

 

0 Kudos
Message 7 of 18
(5,863 Views)
Hi there,  That wiring diagram was exactly what I needed. Thanks for that. It has been recommended that I need to use an event based timer operation to get the results I want. Basically I let the timer run, then when the signal is sent I want to take the current count and store it somewhere. Then when the signal is received I want to take the current count at that time. Subtract the two, and that will give me the number of counts it took to send and receive. Work backwards and then I'll get the time. Any suggestions on how to do this? Cheers  K 

 

0 Kudos
Message 8 of 18
(5,828 Views)

Kamilan,

 

You could utilize buffered event counting for this.  You would need to have a control signal coming into the counter's gate while the signal being counted is attached to the source.  The only caveat here is that there would have to be a start and stop signal both sharing the gate.  More information concerning the Buffered Event Counting can be found here.  You may also wish to utilize an arm start trigger for your application.  The following line was taken from the DAQmx Help "When you configure an Arm Start Trigger, a counter task does not respond to any Start Triggers until after the Arm Start Trigger occurs. You can configure this trigger to occur on a digital edge."  This means that counting will not occur until the arm start trigger is encountered and then you can also have the stop signal coming into the gate of the counter.  The count that is latched into the buffer at this point should be the count from the time of the start to the stop signal.  This example illustrates how to setup an arm start trigger for a different counter application.  You will notice that the trigger has to be setup using property nodes. 

0 Kudos
Message 9 of 18
(5,816 Views)

Hello

 

I've got the program working with the NI PCI 6229 and SCB-68. Is there a USB equivalent that I can use on a laptop that will give me the same DAQs? Here is my code. So you can see how many Inputs and outputs I need. There is an addition 5 digital outs needed to drive the robot.

 

 Any advice would be great

 

Cheers

 

K

0 Kudos
Message 10 of 18
(5,610 Views)