Pages: [1]   Go Down
Author Topic: Creating cordinates using piezo microphone  (Read 1228 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 13
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Please help me achieve this project as it is part of my fine art degree show.
cheers
« Last Edit: September 18, 2008, 01:11:20 pm by Norwegian_User » Logged

London
Offline Offline
Tesla Member
***
Karma: 10
Posts: 6255
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

berlin
Offline Offline
Sr. Member
****
Karma: 0
Posts: 295
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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


Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 13
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

the cd is purely for illustration purpose (i should have mentioned this in the first post)

final 'pad' is probably 1 x 1 meter
Logged

Manchester (England England)
Online Online
Brattain Member
*****
Karma: 618
Posts: 33955
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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?  :o

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.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 13
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yeah, art and programming/electro things are hard to combine I guess smiley

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()
{

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

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

rawcount3 = analogRead(2);
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
« Last Edit: September 22, 2008, 04:36:08 pm by Norwegian_User » Logged

Manchester (England England)
Online Online
Brattain Member
*****
Karma: 618
Posts: 33955
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

London
Offline Offline
Tesla Member
***
Karma: 10
Posts: 6255
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: September 23, 2008, 03:32:34 am by mem » Logged

berlin
Offline Offline
Sr. Member
****
Karma: 0
Posts: 295
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged

London
Offline Offline
Tesla Member
***
Karma: 10
Posts: 6255
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: September 23, 2008, 04:45:55 am by mem » Logged

Pages: [1]   Go Up
Jump to: