03-04-2012 11:10 AM
In my current assignment, I am to create a program in labview that continuously measures a distance between 20 cm and 1 meter, using a small speaker and microphone as transmitter and receiver of a 40 kHz signal. (SR-40-R-10B)
We are using the NI-USB-6212 hardware card with NI-DAQmx driver software.
I think I have a pretty good idea about how it should work, but I haven't got a clue how to do it (in Labview)
Basically, I'd think a short 40 kHz pulse could be transmitted, while also starting a timer. Then, the input-channel waits for its input (being the signal received by the microphone), which stops the timer. Use x= v/t (with v speed of sound, t = elapsed time) and you have the distance. Repeat this 10x per second and you have a 'continuous' measurement.
Please see the attachment for what I have so far, but it's not much.
I have also looked at the .vi file provided here: (https://decibel.ni.com/content/docs/DOC-19917) but I could not figure out how it worked, even though it seems so easy. However, it seems there is some hardware/programming in the chip itself, whereas I only have a transmitter & receiver and the 6212-card.
Any help would be greatly appreciated! I think it should be rather simple, but it just won't come to me.
03-06-2012 07:12 AM
Hello,
Thanks for your posting in this forum and hope that I can assist you to go further.
I found an example in the link below that you can start with and hope it could be useful.
https://decibel.ni.com/content/docs/DOC-19917
If you have any question, it could be great to hear it from you.
Regards,
Hossein
03-07-2012 11:51 AM
Thanks for your reply, but the link you provided is the same I mentioned in my post 😉
Anyway, I finished the program now in a slightly different way than I first thought. I thought I'd just upload it here in case anyone has a similar problem later on / needs inspiration.
The program works between 0 and 150 cm (tested), but possibly even at larger distances. I kept having a 3-5 cm deviation though, and I'm not sure what causes it.
03-08-2012 02:34 AM
Hi,
Sorry for that
I couldn't see what the problem is in your vi but I think that the sampling rate has influence in your measurement. If that is not high enough you will lose some info of your signal and causes some jitter which has influence in your accuracy.
I found another example in the link below.
I hope this helps
http://zone.ni.com/devzone/cda/epd/p/id/6470
Regards,
Hossein