Hi Michael and Zainul Thanks a lot for your response. I am grateful to be hearing from you.
I will look into the corrected mean solution before I suggest some hardware changes to my team. Although, my bigger question was why direct sampling by calling getData->dataReady on a free running ADC (this is what is used in the SoundLocalizer example in Tinyos-2.x described in the book also) responds better ? if I try to do threshold detection of every sample using the same interface and direct sampling I get values which are very responsive and high rate of sampling. I know I am loosing on some precision by sampling at a rate other than the default ATM128_ADC_PRESCALE but since I am mainly using it for thresholding I think my application can handle it. Can you tell me some comparison between the microphone setup used by the MicP and MicStream compared to the SoundLocalizer direct sampling setup ? Thanks a lot once again Sincerely Akankshu Dhawan On Thu, Nov 12, 2009 at 1:30 PM, Michael Schippling <sc...@santafe.edu>wrote: > I suspect that the straight averaging thing is not what you want. > > I haven't looked at the mic data, but it's sampling an AC > signal (sound wave pressure alternates between compression > and rarefaction at the frequency you perceive) and is probably > biased so a no-pressure signal is pretty much in the middle of > the ADC range. Averaging that AC signal over a number of high-low > pressure waves will just give you the middle again. > > If that is the case, what you want to do is rectify the signal -- > half-wave would just chop off the samples below the mid-value, > full-wave would invert them around the mid-value -- before > trying to average to get a "loudness". If you are trying > to get the "Sound Pressure Level" -- how loud the sound is at > any particular time -- it's called "Envelope Following" in the > good old days of signal processing. If you know any electronics, > what you want to build is a diode or diode bridge, to rectify > the signal, and a capacitor to filter, or average, it to a slowly > varying DC value. > > MS > > Akankshu Dhawan wrote: > >> Hi All >> I am using two mechanisms for high sampling. >> 1. Using MicStreamC and changing the prescalar value inside MicP to >> ATM128_ADC_PRESCALE_32 and the gain value is set to 64. I create a buffer of >> 1000 samples and every time the buffer gets full I take the average and >> print it out. The problem is that the microphone does not seem to be >> responding or is not showing me sufficiently precise values. The average >> when I dont make a noise is around 500 ADC.. and even if I am clapping >> shouting (for long durations) it still shows me slightly */lower values >> /like 497 etc. So I am not sure why this is so ?* >> >> 2. When I created the low level interfaces on my own using the sample >> SoundLocalizer example in Tinyos programming book, I am giving the >> microphone ADC a free run at the same prescale setup (there is a difference >> of some parameter being passed through getData as FALSE in that example >> which is suppose to cater to LEFT_ADJUSTMENT ) but when I compare the values >> that I am getting inside dataReady they respond well to sounds. This would >> work for me but I am just curious why the MicStream does not work. This way >> I would not have to recreate all the buffer code. >> >> If anyone can please tell me what setting inside MicSetting or MicP have I >> done wrong that it is not responding. >> >> Thanks a lot. >> >> SIncerely >> Akankshu Dhawan >> >> -- >> First they ignore you, then they laugh at you, then they fight you, then >> you win. >> - Mahatma Gandhi >> >> >> ------------------------------------------------------------------------ >> >> >> _______________________________________________ >> Tinyos-help mailing list >> Tinyos-help@millennium.berkeley.edu >> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help >> > -- First they ignore you, then they laugh at you, then they fight you, then you win. - Mahatma Gandhi
_______________________________________________ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help