On using Arduino for a 2D TDOA applications with vibration sensors

Hi

I am looking into using Arduino, or another platform if more appropiate, to log data for a 2D TDOA application using the data from 3 vibration sensors. The need for 3 sensors instead of the typical two you see with mics is because, with vibration through solids, speed can not be considered constant like through air, so a third measure is necesary to solve the equation and find the direction of the vibration origin in 2D.

I have limited experience with microcontrollers and it will be my first time using Arduino. The only thing I want Arduino to do is to get the signal from the 3 sensors with a timestamp and pass it to a PC via USB for processing. The signal will have a max frequency no higher than 150Hz. I can not specify exactly the upper limit yet because I have not decided on the sensors and most likely I will have to test a few before settling for one (suggestions welcomed), but my signal should not have a frequency higher than 150Hz. For what I have been reading in the forums, if I sample at x10 that frequency (if the sensor allows it), I should have a nice signal, and Arduino is more than capable of sampling at 1.5KHz, so that part should not be a problem.

Since I will be using Python to analize the data in the computer, I have settled on using the Firmata protocol to pass data from the Arduino to the computer, since it has good libraries for both Arduino and Python. Again, I am open to suggestions.

Since a TDOA application is very sensitive about the time difference between the signals, it is important that the timing of the measures of the three sensors is accurate, and here is where my main doubt comes. Lets say I want to read three analog sensors every 1ms, for a 1kHz sample rate, and I first read the 3 sensors when I go into the loop, and after I have the 3 readings I send the three readings through the usb together with the timestamp, for the loop to go to sleep again until it is time to sample again. The question is, is there any Arduino platform that can guarantee I can read the 3 samples simultaneously, within a minimal time difference between the three? I have read here in the forums that the Arduino Uno can not.

If I was to read the 3 analog sensors sequentially instead of simultaneously, what kind of time difference can I expect between the readings?. The sensors will be separated around 0.5meters from each other, and I just need meters accuracy, nothing too fancy. Does anyone know if the error introduced by reading sequentially by for example an Arduino Uno would introduce an acceptable error or would it completely mess the algorythm?

From my ignorance, my guess is that using digital sensors I will have less control over the exact moment when the measurment is taken and would make the real timestamp of the signal even more moody adding more error, but I am open to using digital sensors if it can make it work better.

Speed of sound in solids is typically measured in km/s, so you'll need temporal accuracies of 10µs or less for
cm resolutions. For instance for aluminium its 6.32km/s or 6320 m/s, so 10cm is only 16µs for Al.

Solids are also very reverbarative meaning you can't use continuous tone, you must use transients so
that reflected energy has time to dissipate between soundings. Unless all the edges of your solid are
properly acoustically matched and damped a continuous tone will simply set up standing waves so that
the phase information at each point is of little use to you as it depends on the entire shape.

Incidentally trying to measure phase accurate to 10µs at 150Hz would be a "challenge" as that's only
0.5 degree of phase difference.

Continous tones also cannot distinquish between say 100 degrees and 460 degrees....

My first thought is that it would be helpful to know more about your application. The stated accuracy requirement on the order of "meters" suggests we're talking about very large structures. Also TDOA measurement accuracy is a strong function of the inverse of the signal bandwidth which makes the stated narrowness of the signal (150 Hz) a potential limitation to accuracy.

It's the case for virtually all microcontrollers that they can not read sensors strictly simultaneously. It's also the case that virtually all can read sensors sequentially with a deterministic delay between readings. It may complicate the math, but for TDOA one really only needs the time of validity for each sample.

A fairly naive implementation of two sensor sampling at a fixed interval (10 ms) might look like this (compiled, not tested):

unsigned long int nextSample ;
unsigned int sampleInterval = 10000 ;

void setup() {
  Serial.begin(115200) ;
  nextSample = micros() + sampleInterval ;  // Time for first sample
}

void loop() {
  if (micros() >= nextSample) {
    // Capture time of validity and sensor value for each channel
    unsigned long int time0 = micros() ;
    unsigned int A0_val = analogRead(A0) ;
    unsigned long int time1 = micros() ;
    unsigned int A1_val = analogRead(A1) ;

    // Print readings
    Serial.print(time0) ;   Serial.print(",") ;
    Serial.print(A0_val) ;  Serial.print(",") ;
    Serial.print(time1) ;   Serial.print(",") ;
    Serial.println(A0_val) ;

    // Update time of next sample
    nextSample = nextSample + sampleInterval ;
  }
}

An issue, which may not be immediately apparent, is that the time to send the serial data for each sample interval is significant at even modestly fast sample rates. The maximum number of characters from the above is 4 digits for each of the ADC samples, and up to 9 digits for each of the time tags, plus the commas and line feed, so (24 + 29 + 4) = 30 characters. At about 0.1 millisecond/character at 115200 baud that gives a minimum sample interval of 3 milliseconds and I've only implemented two sensor channels.

Running this code however should demonstrate that the time relationship between channel sampling is constant, so the time tagging per channel isn't necessary. In fact with TDOA one really only needs to know the relative time between samples within a single sensor channel and from one sensor channel to another. The period between sets of readings is fixed by the loop code above and "analogRead()" on an Arduino Uno executes in about 0.11 millisecond, so that is the expected channel to channel time offset. Given that these will be fixed, the time tag output probably isn't necessary at all.

The sensors will be separated around 0.5meters from each other, and I just need meters accuracy, nothing too fancy

You have 3 sensors 0.5m apart - yet you want to triangulate to a resolution of "meters" over, presumably,
a large area?

Your sensors probably need to be further apart to get best angular resolution then. Wider baseline is
more resolution for free.

Thanks for the answer.

Let me take a step back and explain what I am trying to achieve. I want to detect vibration sources in a building, like a noisy air condition box for example or a neighbor's big subwoofer.

As far as I have been reading the speed of sound on concrete should be between 3200 and 3600, and as I said I only need meters accuracy, a general area where the vibration are coming from. Also, the separation between the sensors can be increased if necessary of course.

Given this, is it realistic to do this with accelerometers and TDOA? Is there a better system to accomplish the task?

I had even though about just getting one accelerometer, maybe even something precise like this Geophone - SM-24 - SEN-11744 - SparkFun Electronics , and try to find the source by moving the sensor around to where the noise gets louder, but not sure if the attenuation will be enough to make the source "followoable" just by power attenuation. I read several studies on being able to do TDOA on vibration in buildings, good enough to be able to locate people walking in a building and even differentiate the person based on their particular walk pattern, so they put me in this course.

Also coding is not a problem for me. The electronics and sensor part is where I have barely any experience (I did some basic microcontrollers courses decades ago and nothing since). I was planning on using timer interrupts but if your code is solid enough that's a lot simpler. Would upgrading from a Arduino Uno to a Zero or something even beefier help?

I am open to any suggestion on how to solve this problem.

I'd be interested in a pointer(s) to the literature you've read on this topic.

As Mark T notes, you want a large baseline for the sensor, more or less in the corners of the building is probably optimum.

In the related post on this topic I envisioned a "leading edge approach and a small enough geometry that a single processor could service all the sensors. That is, the impulse of the projectile hitting a board results in a large amplitude pulse, the time of arrival of which can be detected directly and whatever subsequent vibrations happen are not relevant. With a continuous time narrowband signal (presumably like an air conditioner vibration) there is no leading edge to detect. An approach to detection is to cross correlate pairs of sensor channels and look for the correlation peak which occurs at the TDOA. This will be complicated a great deal by the fact that there will be reflected versions of source signal (off the edges of the concrete slab and other discontinuities) arriving at various delays intervals that will result in additional correlation peaks. There are approaches to mitigate this sort of thing but the signal processing is non-trivial.

That said, I expect the problem is solvable within some constraints, which, if somebody has done so and written a paper on the topic must be the case.

From a sensor perspective, I'd expect it requires a distributed network so something like a geophone at the corners of the slab with a collection process, which could well be an Arduino microcontroller, sending data to the processing node would will be a PC class machine. The collection synchronization part of the problem in this sort of distributed model becomes more complicated and probably would be done over whatever network connects the nodes.

MrMark this one was one of the first I found and read: ILoViT: Indoor Localization via Vibration Tracking

They use the vibration sensors that the building already has. In my ignorance I assumed they were doing it for convince, not because they needed as much distance as possible between the sensors..

The problem becomes more complicated now. Let's see if I understood the suggestion:

In this new scenario, to deploy the sensors, I need a plan of the building and accurate measures for the position of the sensors in the plan.

As for the data collection, I'm guessing I have to go wireless and, as you pointed out, that complicates analizing the data, as the data from each sensor can vary in the time when it was taken. It will not be synchronized. I strongly doubt it is possible to exactly synchronize the data gathering over WiFi.

For the boards, I am leaning to go with an ESP32 now, given that it has WiFi, and, for what I've read it can have two cores, which would allow the chip to interrupt to gather data regularly while at the same time dealing with the WiFi without having to worry about optimizing the code too much. Plus is cheap and Arduino compatible.

Then in the middle of the building I would put the laptop acting as AP and pray the signal reaches from all the devices. If the data transmission through wifi gives me reception problems I guess I would have to change to a different protocol with a frequency that goes through walls easier. Once the sensors are all connected, the laptop sends the signal to start recording and starts receiving the data to try to make sense of it.

How many sensors would be enough or good? Would 3 still be enough?

Also I think I'll try first with an accelerometer that I can buy locally as the geophone is not sold in my country, plus is not cheap. If the signal is not good enough I can always import a few of the geophones.

Have I missed something? Any other suggestion?

Thank you both for taking time to answer.

There exists NTP sychronization for the ESP32. It would be an interesting and straightforward experiment to write a sketch that synchronizes two such devices using NTP and have them put out a pulse at specific times, say on every 1 second event and measure the difference in these pulses with an oscilloscope. 1 millisecond relative sync offset doesn’t seem implausible for sensors on the same access point/NTP service, but I really have no idea.

You need three sensors at a minimum to do TDOA location in 2 dimensions.

dirlo:
Thanks for the answer.

Let me take a step back and explain what I am trying to achieve. I want to detect vibration sources in a building, like a noisy air condition box for example or a neighbor's big subwoofer.

As far as I have been reading the speed of sound on concrete should be between 3200 and 3600, and as I said I only need meters accuracy, a general area where the vibration are coming from. Also, the separation between the sensors can be increased if necessary of course.

Basically no, this is not going to work the way you hope, this is a system mainly of standing waves, see
my earlier comment.

Here's an analogous system: Sand Vibration Patterns - Chladni Plate - YouTube
Basically the vibration modes depends far more on the building than the excitation sources,
and its not easy to analyze the modes of vibration of any complex shape across a range
of frequencies. The best you can do is survey for the highest vibration ampltudes, and maybe
try an acoustic camera Acoustic camera - Wikipedia

Apparently vibration sensors in many phones are suitable for measuring vibration amplitudes,
so this could help track down the hot-spots (which might be the source, or might just be
a resonance).

MarkT:
Basically no, this is not going to work the way you hope, this is a system mainly of standing waves, see
my earlier comment.

Here's an analogous system: Sand Vibration Patterns - Chladni Plate - YouTube
Basically the vibration modes depends far more on the building than the excitation sources,
and its not easy to analyze the modes of vibration of any complex shape across a range
of frequencies. The best you can do is survey for the highest vibration ampltudes, and maybe
try an acoustic camera Acoustic camera - Wikipedia

The noise is not that strong, is more like a rumble, mmmm mmmm, and has a pattern. I believe you but I am surprised it can achieve that level of rebounding in a whole building with such low volume/energy. But it is true resonance can do stuff that seem unintuitive.
About the acoustic camera, I am not sure that would work very well, as I am pretty sure the noise is distributed through vibration in the structure, not through the air. But if I wanted to try to build that, what kind of microphone sensor would be adequate for it?

Apparently vibration sensors in many phones are suitable for measuring vibration amplitudes,
so this could help track down the hot-spots (which might be the source, or might just be
a resonance).

I already tried with the phone, but I do not think my phone (non of my two phones) are precise enough to notice any amplitude change. I might try to get one of the geophone's to see if I have more luck with that, and do a kind of heat map of the building. Once that is done and with the extra information, I might see what my options are.

Somehow offtopic, but if the vibration is really standing waves, does that mean that if the noise comes from a neighbour's subwoofer, I would be able to eliminate the vibration by just having him equalizing out the modal frequencies of the building, the frequencies that make the building resonate?

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.