This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LAUNCHXL-F28379D: Are my ADC measurements inaccurate?

Part Number: LAUNCHXL-F28379D

Hi all,

Introduction:

I am working on an acoustic sensor for echolocation using F28379D (Ver: 2.0). The sensor consists of a speaker (250ST/R160) and a microphone (SPU0410LR5H-QB), the speaker emits a 25kHz sine wave (Vpp of 24V) and when the microphone receives the echo, it converts acoustical energy (sound waves) into electrical energy (the audio signal). This signal is fed to the ADC (Pin #30), which samples the signal at 250kHz (10 points per period).

The sequence of action is as follows:

  • The sensor turns left.
  • Turn ON the speaker, emit a sine wave for 0.5ms, turn OFF the speaker.
  • Do nothing for 1ms.
  • Turn ON the ADC, stay ON for 5ms, turn OFF the ADC.
  • The sensor turns right and then this process is repeated.

This is how it looks in the oscilloscope:

Blue signal is the Microphone sensor reading, yellow signal is the ADC reading (outputted from the DAC).

The circuit: 

What was the initial problem?

The purpose is to determine which side of the sensor, the object is located by comparing the maximum reading in the left ADC window to the max reading of the right ADC window.

As you can see (in Figure 1) the amplitude of the echo on the RHS is significantly larger (compared to the LHS), showing that the sensor is doing what it is supposed to do yet the max amplitudes of the ADC readings are almost the same, making it impossible to determine where the object is located. 

I found out that although the ADC is configured to sampled at 250kHz, the frequency of the ePWM signal (that triggers the conversions) was 500kHz. This was something I changed on purpose (to see if the readings are getting more accurate) and apparently I forgot to change it back to what it was. Question: Is this the actually reason why the ADC readings were not proportional to the amplitude of the signal that is being fed in?

What is the current problem?

I wrote a code that initiates a timer and counts the time taken until a reading that is greater than a given threshold value is received. The purpose of this code is to determine how far the object is located as well as the direction at which it is located. Although, I cannot display the max amplitude in real time, I found a reasonable threshold value by try and error (using LEDs as indicators). Question: Can I use the following formula to calculate the threshold value? Threshold = V_measured * (4096/3.3) where V_measured is the voltage measured by the oscilloscope.

The problem is that although the code successfully detects the farness of the obstacle, timing the interval of which max echo is received is not helpful since the echo is only detected right after the ADC window is turned ON (measured time is ≈ 0) and disappears when the obstacle is placed further way, despite the fact that the obstacle is still within the measurement range of the sensor. Question: What could be a possible reason to this strange behavior?

  • Hi Canberk,

    What is the output impedance and voltage range of the microphone? Is the voltage buffered? If so, what is the BW of the buffering op-amp?
  • Hi Devin,

    The maximum output impedance of the microphone is 400Ω and the supply voltage range is 1.5-3.6V. No the voltage is not buffered - why did you ask? 

    The datasheet can be found here: SPU0410LR5H-QB.pdf

    Regards,

  • Hi Canberk,

    When the output impedance is high you can have issues with sampling if the S+H window duration isn't long enough (S+H duration is controlled by the ACQPS setting in the SOC configuration).  You also typically want some capacitance between the ADC input and ground.  Try adding a capacitor on the ADC input of ~10x to 30x Ch (145pF to 435pF) and calculate the required S+H window using the following formulas (note: numbers are slightly different since this excerpt is from F28004x device; you can find the F2837x input model parameters in the datasheet under "Single-Ended Input Model Parameters").  Also note that long wires can result in significant (from the S+H perspective) inductive impedance, so for best performance build a daughter-card to dock with the launchpad or buffer the signal close to the ADC input with an op-amp.    

  • Hello Devin,

    I added 200pF ceramic capacitors between the ADC input pin and the GND pin. I have doubled the sampling frequency (20 points per period instead of 10 points).

    The image below shows the actual signal (in yellow) and the ADC reading (in blue). The ADC reading is fed into a DAC and then monitored using the oscilloscope.

      

    As it is marked by the red anulus, there are still some spikes in the echo signal. The performance of my code greatly depends on peak echo measurements and hence I need it to be more accurate. Do you have other suggestions? 

  • Hi Canberk,

    Did you increase the S+H duration.  With 400-ohm + 200pF source impedance I think you'll need a S+H duration in the balpark of 600-700ns.

    You may also want to try and test the ADC and DAC separately to determine if one or the other is causing the issue.  Maybe scan-in a known pattern and then replay it on the DAC?