Show Posts
Pages: [1]
1  Community / Exhibition / Gallery / Re: Sound Localization on: January 25, 2013, 12:27:29 pm
This is the code i am currently employing however i am fairly sure my coefficient is completely wrong. I understand it should have a relation to the distance of the microphones but not sure how to calculate or determine what this should be. Do I need to workout what the average time it would take for the sound to travel the distance between them and use that as the coefficient?

I have tried a few completely random values for this but as im sure you can guess had no positive results.

float coefficient = 400;
float soundAngleY = srvoPosn[y];
soundAngleY = asin (coefficient * summa / 2048.0) * 180.0 / PI;
2  Community / Exhibition / Gallery / Re: Sound Localization on: January 25, 2013, 06:12:56 am
So as well as the code for determine the position of the servos that you mentioned should i also remove this

for ( uint8_t i = 2; i < MIRROR; i++)  // LIMITS: 150 HZ
        {                                      // Electrical grid interference, Motor Vibration.
          vremn = 0;                                       
          if ((x_r[0][i] != -1) && (x_r[1][i] != -1))
            vremn = x_r[0][i] - x_r[1][i];           
            if (vremn >  1024) vremn -= 2048;
            if (vremn < -1024) vremn += 2048;
            vremn = (32 * vremn) / i;                                   
            vremn -= 256;                      // MIC Time Offset Correction (1 ADC, 25 usec delay).

          if (lokaVect[directin][i] < vremn) lokaVect[directin][i] += srvoAccl[directin];
          if (lokaVect[directin][i] > vremn) lokaVect[directin][i] -= srvoAccl[directin];

Or just a section of this, as it is filtering the motor sound right?

Thank you
3  Community / Exhibition / Gallery / Re: Sound Localization on: January 24, 2013, 12:30:23 pm
So i am about to incredibly over simplify this process by the way i describe it however tell me if I am on the right lines.

If i take the time difference before you apply the negative feedback loop, or are they one in the same in terms of calculations?
Then use the function you described in your last post, arcsine function I can determine the angle in which the sound has come from?
4  Community / Exhibition / Gallery / Re: Sound Localization on: January 24, 2013, 11:04:17 am
Ok thats good I thought the mapping would work however was not sure. The setup I am using is slightly different to your in that I am not actually using any servos. I just wish to create a visualisation of the angle from the stationary base. Would this cause any issues with the data I am getting?

I shall have to try and understand then why I am not receiving any data as I seem to be receiving "n" .

5  Using Arduino / Programming Questions / Servo pulse to degrees on: January 24, 2013, 09:33:04 am

I am trying to understand the way in which a servo is set to a specific degree depending on the pulseMin pulseMax and time.

I found this on the adafruit site that the following function converts degrees to pulse values.
pulselength = map(degrees, 0, 180, SERVOMIN, SERVOMAX);

So can i do this to calculate the reverse.
degrees = map(pulselength, SERVOMIN, SERVOMAX, 0, 180);

I don't know if I am over simplifying this as it feels like i need to take into account the update time.
I did try to find a already existing topic on this as i thought there must be a few but i couldn't so sorry if i have duplicated this.

Thank you
6  Community / Exhibition / Gallery / Re: Sound Localization on: January 24, 2013, 05:58:39 am
Really nice and extremely interesting project.

I am hoping to learn a great deal by studying your code. However I have a few questions that hopefully you won't mind answering.

Why do you constrain the values for the Y servo to 1500, 2100 and the X to 800, 1900?
So could i use the following to convert it to degrees?
rot = map(srvoPosn[y], 1500, 2100, 0, 180);

Also with regards to these lines,

if(faza[ind][i + MIRROR/2]) Serial.print(faza[ind][i + MIRROR/2]);
         else     Serial.print("n");

if the debug just prints "n" does it mean it is not correctly receiving audio?

Sorry for the very basic questions im just trying to understand the reasons behind what your doing and hopefully get a greater knowledge of FFT

Thank you
Pages: [1]