3 Replies Latest reply on May 27, 2016 3:37 PM by Intel Corporation

    How to verify sample rate on Intel Galileo?

    flicky

      'm sampling a guitar signal as part of a guitar tuning project. The sampling (2048 Hz) is done in software using the arduino IDE on Galileo. I have concerns that because the sampling isn't real-time , it may be fluctuating and creating bad data for the FFT that runs later in the program.

      How would i go about checking the exact frequency of the samples to check if it is indeed causing the FFT to give back inconsistent data? And how would i fix this problem ? (it currently has an accuracy of +/- 2Hz which is unacceptable for a tuner)

      Here's how i'm sampling incoming guitar signal:

       

      for (n = 0; n < 100; n++) // capture 100 data points
      {
        start = micros();
        SigAmplitude = analogRead(Signal);

        while (finish < start + (489)) //gives approx 2K Hz sample rate
        {
        finish = micros();
        }

        x[n] = (SigAmplitude - 512);  //get rid of DC bias
        y[n] = 0; // no imaginary part

      }

        • 1. Re: How to verify sample rate on Intel Galileo?
          FGT

          Hi flicky ,

           

          Yocto is not a real time OS, so I suggest you sample at the maximum rate. i.e. no delay. i.e. no


            while (finish < start + (489)) //gives approx 2K Hz sample rate
            {
            finish = micros();

            }

           

          and save the time with each of the samples for the time equivalent to 100 samples. Later, just downsample at the times you need and interpolate if needed (which does not seem to be necessary right now, but given that yocto is not a RT OS there may be some extra-large jitter somewhere.

           

          HTH,

           

          Fernando.

          • 2. Re: How to verify sample rate on Intel Galileo?
            Intel Corporation
            This message was posted on behalf of Intel Corporation

            Hi, 

            Measuring the sample rate via software is not very effective due to the sketch is also measuring the time that takes running of other instructions, for example, in your sketch, it will also measure how it takes to run the condition in the while function. You can create a file that saves the analogRead and the micros() after every reading, at the end you can manually do the subtraction using the time measurements.
            Which is the sample rate you need for your project?

            Regards,
            Charlie
             

            • 3. Re: How to verify sample rate on Intel Galileo?
              Intel Corporation
              This message was posted on behalf of Intel Corporation

              Hi flicky,

              I would like to know if you have been able to read the sample rate on the pins, please let us know the sample rate you are looking for.

              Regards,
              Charlie