SamLoureiro
Member
Hello, I am using Digital MEMS Mic SPH0641LU4H-1 (https://www.elecrow.com/digital-mems-microphone.html) to apply PdM in bearings. I am using Arduino Framework and, according to the datasheet of the microphone, it is capable of "hearing" a range between 100Hz to 80kHz. To make it operate in ultrasonic mode, I need to change the clock to 3.072 MHz ≤ fCLOCK ≤ 4.8 MHz. I have done this code, but the FFT is not detecting any frequencies, even in the first bins. Can anyone help me, please?
#include <Audio.h>
#include "setI2SFreq.h"
#define SAMPLE_RATE_192K 192000
// GUItool: begin automatically generated code
AudioInputPDM pdm1; //xy=180,111
AudioFilterStateVariable filter1; //xy=325,101
AudioOutputI2S i2s1; //I2S audio output
AudioAmplifier amp1; //xy=470,93
AudioAnalyzeFFT1024 fft1024_1; //xy=616,102
AudioConnection patchCord1(pdm1, 0, filter1, 0);
AudioConnection patchCord2(filter1, 2, amp1, 0);
AudioConnection patchCord3(amp1, fft1024_1);
// GUItool: end automatically generated code
void setup() {
AudioMemory(50);
filter1.frequency(30); // filter out DC & extremely low frequencies
amp1.gain(8.5); // amplify sign to useful range
setI2SFreq(192000);
}
void loop() {
if (fft1024_1.available()) {
// each time new FFT data is available
// print 20 bins to the Arduino Serial Monitor
//512 bins, 187.5 hz each bin
Serial.print(millis());
Serial.print("FFT: ");
for (int i = 0; i < 20; i++) {
float n = fft1024_1.read(i);
if (n >= 0.001) {
Serial.print(n, 3);
Serial.print(" ");
} else {
Serial.print(" -- "); // don't print "0.000"
}
}
Serial.println();
}
}
#include <Audio.h>
#include "setI2SFreq.h"
#define SAMPLE_RATE_192K 192000
// GUItool: begin automatically generated code
AudioInputPDM pdm1; //xy=180,111
AudioFilterStateVariable filter1; //xy=325,101
AudioOutputI2S i2s1; //I2S audio output
AudioAmplifier amp1; //xy=470,93
AudioAnalyzeFFT1024 fft1024_1; //xy=616,102
AudioConnection patchCord1(pdm1, 0, filter1, 0);
AudioConnection patchCord2(filter1, 2, amp1, 0);
AudioConnection patchCord3(amp1, fft1024_1);
// GUItool: end automatically generated code
void setup() {
AudioMemory(50);
filter1.frequency(30); // filter out DC & extremely low frequencies
amp1.gain(8.5); // amplify sign to useful range
setI2SFreq(192000);
}
void loop() {
if (fft1024_1.available()) {
// each time new FFT data is available
// print 20 bins to the Arduino Serial Monitor
//512 bins, 187.5 hz each bin
Serial.print(millis());
Serial.print("FFT: ");
for (int i = 0; i < 20; i++) {
float n = fft1024_1.read(i);
if (n >= 0.001) {
Serial.print(n, 3);
Serial.print(" ");
} else {
Serial.print(" -- "); // don't print "0.000"
}
}
Serial.println();
}
}