cheap audio recording device for sonar experiment? - Page 1
Forum section: electronics / projects

author: JBeale
author_rank: Frequent Contributor
timestamp: August 12, 2020, 05:06:22 am
content: Apologies if this post violates any rules... I'm looking for an inexpensive USB audio input device which can record a single-channel analog audio signal at 96 kHz. 16-bit resolution is fine. I can make it mic or line level as needed. I have not found anything that can do this below $100. Does such a thing exist?I was hoping for something like a small cheap USB audio dongle with just a mic and headphone jack, except a newer, better one that uses a codec chip with a 96 kHz rate. Most new PCs and even phones can do this, but most of the USB audio devices that advertise 96 kHz are output-only DAC devices for headphones. I see there are complete USB microphones offering 192 kHz, for around $42 (Neewer brand- ironically the mic itself only is spec'd up to 16 kHz!) however I don't want any kind of microphone. The cheapest input device with these specs I found was "PreSonus AudioBox USB 96" around $100 which does 96 kHz at 24 bits. I'm wondering if I can do better if I don't need stereo XLR inputs, mixer controls, and phantom power.

author: magic
author_rank: Super Contributor
timestamp: August 12, 2020, 06:26:26 am
content: Via VT1620A can do that. Here's noise floor at 96kHz / 24b in units of dBFS per 1.5Hz bandwidth:I did verify that noise goes up across all frequencies when I touch the input connector so it seems to be working.The datasheet claims 192kHz recording capability but it didn't work for me, even at 16b.I only have a PCB of that dongle, but IIRC it looked like this:editAnd of course the real question, why bother with USB when every integrated soundcard can do 192kHz these days?

author: JBeale
author_rank: Frequent Contributor
timestamp: August 12, 2020, 02:08:50 pm
content: Thank you, that device looks like exactly what I wanted. This is a remote-sensing application using a Raspberry Pi, which has no built-in audio input, so I have to get an external device.It looks like the chip does work with Linux (at 96 kHz at least).https://www.eevblog.com/forum/rf-microwave/linux-usb-audio-soundcard-questionrant/msg844065/#msg844065

author: magic
author_rank: Super Contributor
timestamp: August 12, 2020, 02:57:03 pm
content: Yes, the spectrum analyzer whose output I posted works only on Linux. It should be fine on a Pi.I'm not sure if the device is capable of 192kHz recording at all because table 6 on page 13 only mentions 192kHz playback (and this works on Linux).BTW, the input is AC coupled to a virtual ground generated by the soundcard in addition to a 2Hz digital highpass on the low end of the spectrum.Now, have fun finding a dongle with this chip.

author: JBeale
author_rank: Frequent Contributor
timestamp: August 12, 2020, 08:57:52 pm
content: I was surprised to realize that I had a Syba SD-AUD20101 USB dongle already sitting in my spare parts bin.https://www.sybausa.com/index.php?route=product/product&path=65_136&product_id=694I plugged it into my Pi and it does actually work to record at 96 kHz. It claims to do 24-bit, but actual SNR is not better than 16 bit. But anyway the performance is good enough and should work fine in my application. Looks like it is an older design, but seems to be still available in a few places.Code:pi@rp03:~ $ lsusbBus 001 Device 005: ID 040d:3400 VIA Technologies, Inc.pi@rp03:~ $ arecord -f S24_3LE -c 2 -r 96000 -D hw:1,0 -d 5 test96.wavRecording WAVE 'test96.wav' : Signed 24 bit Little Endian in 3bytes, Rate 96000 Hz, Stereo

author: JBeale
author_rank: Frequent Contributor
timestamp: August 16, 2020, 06:06:59 am
content: FWIW. My application is finding the standing water level in a vertical pipe, having only access to the top of the pipe. I'm trying to get the best resolution possible in an automatic unattended measurement, for not too much money. The water surface is typically 5 m down. The pipe has a joint around the 3 m point and it is overall nearly, but not precisely straight. Consequently the water surface is not directly visible from the top. So a laser rangefinder is out, and acoustic methods were what first came to mind.Using a Pi with some other consumer parts (USB audio stick, tweeter, lav mic, Arduino board, each around $10) so far I have ranging results stable at the 1 mm level over a 5 m distance. Stability is quite different from accuracy, but so far it's encouraging. Except for a few cm at the very top, the pipe is buried underground, so its inside temperature doesn't change much. The biggest measurement variable is the gas concentration, as there's often some methane around stagnant water, and probably other stuff with different sound velocities than fresh air. The saving grace is the pipe joint, which also has an acoustic reflection and serves as a calibration mark with a known distance, allowing the actual sound velocity to be computed (and neglecting stratification, eg. hoping the gas composition below 3 m is similar to that above). Below is 15 minutes of data I got just now. I send a set of 47 pulses at the top of each minute, calculate distance D1 to the joint and D2 to the water level, and the full RMS variation (shown in parens) within each set is usually < 1 mm. I haven't yet protected the mic from ambient environment noise, which may explain the occasionally larger values. The final value "D2a" is the sound-speed-corrected apparent distance down to the water surface in meters, based on a known value D1 of 3.062 m according to a steel tape.Code:1811.wav 96 kHz 10.000 sec 47 pulses D1: 3.036 (0.0004) m D2: 5.510 (0.0003) m 341.955 m/s D2a: 5.5579 m1812.wav 96 kHz 10.000 sec 47 pulses D1: 3.036 (0.0005) m D2: 5.510 (0.0003) m 341.952 m/s D2a: 5.5578 m1813.wav 96 kHz 10.000 sec 47 pulses D1: 3.036 (0.0005) m D2: 5.510 (0.0003) m 341.960 m/s D2a: 5.5580 m1814.wav 96 kHz 10.000 sec 47 pulses D1: 3.036 (0.0004) m D2: 5.510 (0.0003) m 341.945 m/s D2a: 5.5577 m1815.wav 96 kHz 10.000 sec 47 pulses D1: 3.036 (0.0004) m D2: 5.510 (0.0003) m 341.966 m/s D2a: 5.5580 m1816.wav 96 kHz 10.000 sec 47 pulses D1: 3.036 (0.0006) m D2: 5.510 (0.0003) m 341.968 m/s D2a: 5.5581 m1817.wav 96 kHz 10.000 sec 47 pulses D1: 3.036 (0.0004) m D2: 5.510 (0.0003) m 341.959 m/s D2a: 5.5580 m1818.wav 96 kHz 10.000 sec 47 pulses D1: 3.036 (0.0004) m D2: 5.510 (0.0003) m 341.943 m/s D2a: 5.5578 m1819.wav 96 kHz 10.000 sec 47 pulses D1: 3.036 (0.0015) m D2: 5.510 (0.0009) m 341.974 m/s D2a: 5.5582 m1820.wav 96 kHz 10.000 sec 47 pulses D1: 3.036 (0.0011) m D2: 5.510 (0.0006) m 341.957 m/s D2a: 5.5581 m1821.wav 96 kHz 10.000 sec 47 pulses D1: 3.036 (0.0007) m D2: 5.510 (0.0004) m 341.954 m/s D2a: 5.5581 m1822.wav 96 kHz 10.000 sec 47 pulses D1: 3.036 (0.0005) m D2: 5.510 (0.0003) m 341.970 m/s D2a: 5.5584 m1823.wav 96 kHz 10.000 sec 47 pulses D1: 3.036 (0.0005) m D2: 5.510 (0.0003) m 341.945 m/s D2a: 5.5579 m1824.wav 96 kHz 10.000 sec 47 pulses D1: 3.036 (0.0006) m D2: 5.510 (0.0004) m 341.971 m/s D2a: 5.5584 m1825.wav 96 kHz 10.000 sec 47 pulses D1: 3.036 (0.0005) m D2: 5.510 (0.0003) m 341.954 m/s D2a: 5.5581 m

author: magic
author_rank: Super Contributor
timestamp: August 16, 2020, 08:32:22 am
content: Quite neat if it will prove accurateI was wandering how much the speed of sound varies with pressure and temperature, but the calibration joint solves it I suppose

author: JBeale
author_rank: Frequent Contributor
timestamp: August 16, 2020, 04:50:06 pm
content: Temperature is the most obvious thing. Speed of sound in air goes from 337.2 m/s @ 10C up to 343.1 m/s @ 20 C, which a 1.7% change. The surface ambient air temp recently is 22-35 C, but measured temperature in the pipe is 16.3 C at 1 m, 14.6 C at 2 m, and 13.2 C at 3 m down. That means speed should be near 340.0 m/s, instead of the measured value of 341 to 343 m/s. Over the course of a day, I found the temperature even just 1 m below the surface generally changes less than 0.2 C, and it becomes more stable as you go down. With sound speeds up to 1% faster than expected, explaining it by temperature requires the effective mean air temperature in the top 3 m would have to be at times 17 C, and at other times 20 C, which is far outside of possibility both in the actual value, and the change in value over time.For an ideal gas, sound speed is entirely independent of pressure, because pressure goes up linearly with density, and those factors cancel each other out for speed. Air is not too far off ideal in that area, it's less than a 0.1% effect. Humidity (at STP) causes at most a 0.35% increase in sound speed, going from 0 to 100% relative humidity.A maybe less obvious factor is methane gas, for example from any organic decay in stagnant water. The speed of sound in 100% methane is 446 m/s, or 23% faster than air. So just a 4% methane content could explain the result. Since methane is lighter than air, I'd expect it to escape out the top of an open pipe over time, but my pipe is nearly sealed by my sensor at the top.Just leaving the top of the pipe open for 1 hour reduced the excess-speed anomaly by a factor of 2. Putting a smaller hose down inside the pipe and pumping down ambient air down to flush out the existing air reduced the speed anomaly by a factor of 10, giving me 340.14 m/s, a nearly exact match to expected speed. So that seems to point to a lighter-than-air gas accumulation as the cause.

author: JBeale
author_rank: Frequent Contributor
timestamp: November 18, 2020, 04:10:02 am
content: Here is a different system but similar to the previous one. Plastic PVC pipe this time, instead of steel. Here is a look at the audio signal which is the sonar return, just using a cheap 48kHz USB audio device this time. In this case I've got a very short 2 kHz pulse as the transmit signal, with the microphone right next to the speaker at the top of the pipe. There is a tiny reflection signal from a pipe joint about 7 feet down, then a bigger signal from a weight I suspended further down as a distance calibration mark, and then finally the largest reflection at the water surface. Interestingly I then also get several reflections of the weight, as some of the sound pulse continues to bounce back and forth between the weight and the water, like an infinity mirror.

author: pwlps
author_rank: Frequent Contributor
timestamp: November 19, 2020, 06:04:54 pm
content: Quote from: JBeale on August 16, 2020, 06:06:59 am1mm resolution (at 2 kHz ?) seems excellent to me. How do you calculate the distance ? Correlation between pulse and echo by FFT ?

author: JBeale
author_rank: Frequent Contributor
timestamp: November 20, 2020, 04:42:15 pm
content: Quote from: pwlps on November 19, 2020, 06:04:54 pmYes, I think it is pretty good. At first I tried a cross-correlation approach, but (maybe because the full waveform has various non-idealities from impedance bumps due to the geometry of my pipe connector) I found I got more consistent measurements (in the RMS variation sense) with a simpler method, just the timing of the two zero-crossings before and after the main peak of the Tx and Rx signals. Because the sound path is fully enclosed in a pipe, which is almost all underground, this is a far quieter and more stable system than an open-air situation. I have now set up three such systems, each slightly different; my last post showed data from my P3 system The best-performing one is P1, using a good ADC (24-bit 96 kHz) and enclosed inside concrete blocks at the surface to reduce ambient acoustic noise, gives me a shot-to-shot RMS noise level around 0.01 mm or 10 microns (!) Now that is just noise level, not DC accuracy, but with the known, fixed distance D1 to the pipe joint, you can reduce the systematic effect of temperature changes etc.Here's a sample of data from that system just now. The CSV file contains the current UNIX epoch (seconds), number of pulses measured in this group, D1 calculated mean distance to pipe joint in meters, standard deviation in mm, D2 mean distance to water surface in meters, and standard deviation of that in mm. Because the D1 pipe joint reflection is a smaller signal, its SNR is lower, so it has a little bit more jitter (mean std = 10.3 um) than the D2 water surface signal (mean std = 8.1 um). The consistency of the 20-pulse mean D1 value (distance to pipe joint) is mostly single-digit microns, suggesting the ~60 micron trend in mean D2 over the 148 second time period shown here, might be real. However a change of 60 um over 5 m is a change of just 12 ppm. Measuring that reliably is doubtful, and I don't know how I could independently confirm it.Code:epoch(s) pnum D1(m) s1(mm) D2(m) s2(mm)1605888678 20 3.122714 0.008 5.137543 0.0081605888690 20 3.122713 0.009 5.137547 0.0101605888712 20 3.122717 0.012 5.137561 0.0101605888724 20 3.122716 0.009 5.137563 0.0071605888746 20 3.122718 0.010 5.137573 0.0051605888758 20 3.122718 0.011 5.137576 0.0061605888780 20 3.122718 0.008 5.137583 0.0101605888792 20 3.122721 0.013 5.137591 0.0061605888813 20 3.122714 0.010 5.137598 0.0101605888826 20 3.122721 0.011 5.137605 0.009

author: JBeale
author_rank: Frequent Contributor
timestamp: November 20, 2020, 06:36:10 pm
content: Here's a data trace from my P1 system as per previous post (with the lowest noise), although the signal may look less pretty. On this one the peak Tx pulse is around 4 kHz but it's so short that it is also pretty wideband. You can see there is a long ring-down from the Tx peak. Also the reflection signals are not really closely matched in shape to the Tx after the first cycle so a correlation peak would become smeared out. On this system the pipe coupler is a short section with larger diameter, so the acoustic impedance step causes that reflection to be inverted relative to the Tx pulse, although the water surface in acoustic terms is like a shorted transmission line, so that reflection has a positive sense.

author: cdev
author_rank: Super Contributor
timestamp: November 22, 2020, 11:57:13 pm
content: I wonder if someone could treat the mechanical vibrations in the water in the pipe exactly like RF using a suitable transducer (piezo button, probably) and use the pseudo-TDR in a nanoVNA? The lowest frequency it supports is pretty low.