Go Down

### Topic: Creating cordinates using piezo microphone (Read 3204 times)previous topic - next topic

#### Norwegian_User

##### Sep 18, 2008, 08:08 pmLast Edit: Sep 18, 2008, 08:11 pm by Norwegian_User Reason: 1
I want to create a 'device' that can track where i hit (like a snare) on a surface.

My thought were to use three piezo microphones and then calculate the delay the 'sound/hit' takes to each microphone to then get the 'coordinates' of where the hit occurred.

Lets say the red dot is where i hit the surface. The upper right microphone would get the signal before the bottom microphone and upper left microphone.
Also I believe it should be possible to read the velocity/amplitude of the hit as well!

The problem is that i'm completly new to arduino and would need help to achieve this.

The end 'product' would be to display the 'coordinate' within processing.org

cheers

#### mem

#1
##### Sep 18, 2008, 09:07 pm
It sounds tricky. To measure position within a cm or so you would need to measure the time differential to single digit microseconds.  It wont be easy getting a clean signal to measure and the arduino can't do very many instructions in a microsecond. I would think even interrupts would be too slow to capture the events correctly.

Perhaps someone with some experience with the sensors can suggest a technique that could work, but I would be inclined to find something other than sound to do the detection of that is permissible. For example, you could use low resolution camera on the underside of an opaque surface and detect the shadows as an object came in contact with the surface. If very low resolution is acceptable, I think an optical mouse has 20x20 pixel resolution and that should not be difficult to interface with the Arduino if you can get it to focus over the full area of your surface.

#### leKuk

#2
##### Sep 18, 2008, 10:11 pm
some time ago someone posted about some kind of shooting targets (gun or rifle shooting that is). if i remember correctly he used 4 microphones and a little math to calculate the coordiantes of a hit.
the target area was a little larger than a cd though (like 1x1m?) PLUS his sound waves travelled through air which makes them like 8 times slower than through the plastic of a cd.

sound travels a little faster than 300m/second in air. that's about 30cm in a milliSecond, or still 0.3mm in a microSecond. for plastics the speed usually is higher than 2000meters/second.

as mem put it: this is tricky if not impossible with your pictured setup.

good luck though.

//kuk

#### Norwegian_User

#3
##### Sep 19, 2008, 12:53 am
the cd is purely for illustration purpose (i should have mentioned this in the first post)

final 'pad' is probably 1 x 1 meter

#### Grumpy_Mike

#4
##### Sep 22, 2008, 12:44 am
I still think you are pushing it, it sounds more like a project for a physics student rather than an arts one. Was it dreamed up by an arts lecturer as well?

The best bet for you to try this is to get the waveforms displayed on an oscilloscope, then you know what signals you are dealing with and if it is possible to make this micro do the job. Don't try and do it first as you are sure to get nowhere.

#### Norwegian_User

#5
##### Sep 22, 2008, 07:16 pmLast Edit: Sep 22, 2008, 11:36 pm by Norwegian_User Reason: 1
Yeah, art and programming/electro things are hard to combine I guess

Looking at similar topics and http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1218303858/3#3 looks quite similar to what i want.

Another sollution that i'm thinking of is :

int rawcount1, rawcount2, rawcount3;
int THRESHOLD = 100;

void setup()
{
Serial.begin(9600);
}

void loop()
{

if( rawcount1 > THRESHOLD ) {
Serial.print (rawcount1);
Serial.print (", ");
}

if( rawcount2 > THRESHOLD ) {
Serial.print (rawcount2);
Serial.print (", ");
}

if( rawcount3 > THRESHOLD ) {
Serial.print (rawcount1);
Serial.print (", ");
}

// delay(500);
}

Anyone care to help a noob with coding? or a push in the right way.

cheers

#### Grumpy_Mike

#6
##### Sep 23, 2008, 09:58 am
That code don't actually do much apart from print out values if they are above a threshold. I suspect you want to make a note of the timer at each point and once all three sensors have tripped then find out which tripped first, second and third and what the time differences are between them. I still think they will be too small to be able to do much with.

#### mem

#7
##### Sep 23, 2008, 10:31 amLast Edit: Sep 23, 2008, 10:32 am by mem Reason: 1
I  reinforce Mikes suggestion that you validate the feasibility of getting measureable data before deciding on how to write the code.

Try to get access to an oscilloscope so you can view the output of the sensors. Ideally you want to see all three sensors but you can get a fair idea of what is happening if you look two sensors at a time.

You want to check to see if the pulses are clear (i.e. no reflections off the edge of the pad creating 'echoes' that may confuse your detection). If you can clearly detect the pulses, try to measure the time difference with two sensors as you hit the pad in various places. The scope will not provide precise time measurements but it should give an indication of the range of values you can expect. You want to determine the approximate durations of the shortest and longest pulses you need to measure. For a given pad material, the precision of measurement is determined by the shortest duration you can accurately measure, the longest duration is determined by the distance between pads and the sound origin (i.e. size of the pad).

If it looks like the pulses have distinctive edges and the durations for the shortest distance you want to measure (i.e the measurement precision you need) is more than a few microseconds, then knowing the range of timing values will make it easier to think about the best way to design the arduino code.

#### leKuk

#8
##### Sep 23, 2008, 11:00 am
found what i was talking about earlier:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1196329716,
still very impressing to me, but don't know if he ever finished it.

kuk

#### mem

#9
##### Sep 23, 2008, 11:42 amLast Edit: Sep 23, 2008, 11:45 am by mem Reason: 1
Quote
found what i was talking about earlier:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1196329716,

Its not clear how much of that linked project was actually implemented and how much was  speculation.

340m/s is the speed of sound through air, not whatever material the target is made from!  And although using timer1 at the arduino clock rate would give the posted theoretical resolution of just under .2mm for measurements of sound through air, but to actually get 1.4mm accuracy across 4 microphones, one would need to detect and store all of the four readings in less time than it takes an arduino to save and restore the registers to handle a single interrupt.

I would be interested to know if its actually possible to time even three microphones that fast using the arduino even at the comparatively slow speed of sound through air.

It would be very interesting to hear from bzeidler about how far he actually got with that project.

Go Up