Hello again guys
As I mentioned on a previous post, I am working on a project involving a PDM microphone pre-amplifier and a I2S UDA1334 decoder.
For now, I would like to test the PDM processing part using an Adafruit PDM Microphone.
My main issue right now is the lack of resources and examples of the usage of the library. I am using a Teensy 3.6 board.
I cannot figure out how to get the signal from the microphone. There is no clear indication if it can only be used with the Audio adaptor board or if it possible to use a standalone Teensy.
Here is what I've done so far:
1. Using the audio design tool GUI I created the following sketch:
However, upon inspection of the wiring I believe that using PDM and I2S at the same time is NOT possible because they use the same pins (9 and 13 for PDM CLK/I2S BCLK and PDM DATA, respectively )
When loading the following code the Teensy 3.6 does NOT register any keys pressed and it seems to be stuck in the filtering process. Perhaps this is due to my lack of understanding of how to use the PDM libary. Any hints?
I have the feeling that this usage is NOT allowed.
2. Then, I removed the I2S device trying to get something from the PDM microphone, however the library indicates that the AudioInputPDM object has no functions. Where can the data be read/accessed or viewed? What is Port Out 0 (according to the Audio Connections in the image attached below)?
As you might see I am completely lost
I would like to kindly ask you for further guidance on how to use this microphone as the information on PDM microphones+Teensy is scarce and there a re NO EXAMPLES available.
Is it possible to test the PDM microphone using Teensy 3.6 as an Audio Device in my PC? Any other alternatives/resources?
Thank you in advance
Edit: added hyperlink to the microphone preamplifier (FAN3852) that I plan to use later on
confined and confused dzalf
As I mentioned on a previous post, I am working on a project involving a PDM microphone pre-amplifier and a I2S UDA1334 decoder.
For now, I would like to test the PDM processing part using an Adafruit PDM Microphone.
My main issue right now is the lack of resources and examples of the usage of the library. I am using a Teensy 3.6 board.
I cannot figure out how to get the signal from the microphone. There is no clear indication if it can only be used with the Audio adaptor board or if it possible to use a standalone Teensy.
Here is what I've done so far:
1. Using the audio design tool GUI I created the following sketch:
However, upon inspection of the wiring I believe that using PDM and I2S at the same time is NOT possible because they use the same pins (9 and 13 for PDM CLK/I2S BCLK and PDM DATA, respectively )
When loading the following code the Teensy 3.6 does NOT register any keys pressed and it seems to be stuck in the filtering process. Perhaps this is due to my lack of understanding of how to use the PDM libary. Any hints?
Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
#include <Bounce.h>
#define MUTE_SOUND HIGH
#define UNMUTE_SOUND LOW
// GUItool: begin automatically generated code
AudioInputPDM pdm1; //xy=242,248
AudioOutputI2S i2s1; //xy=559,257
AudioConnection patchCord1(pdm1, 0, i2s1, 0);
AudioConnection patchCord2(pdm1, 0, i2s1, 1);
// GUItool: end automatically generated code
// Bounce objects to read six pushbuttons (pins 0-5)
// I am only using two buttons as a test --> These will be used for increasing and decreasing a pointer
Bounce button0 = Bounce(30, 10);
Bounce button1 = Bounce(31, 10); // 5 ms debounce time
Bounce muteButton = Bounce(32, 10); // 5 ms debounce time
const int muteLED = 14;
const int mutePin = 25;
bool mutedFlag = false;
void setup() {
Serial.begin(115200);
Serial.println("********* Initialising Audio I2S Moudule: UDA1334 ******************");
Serial.println(" Asisgning pins...");
// Configure the pushbutton pins for pullups.
// Each button should connect from the pin to GND.
pinMode(30, INPUT_PULLUP);
pinMode(31, INPUT_PULLUP);
pinMode(32, INPUT_PULLUP);
pinMode(mutePin, OUTPUT);
pinMode(muteLED, OUTPUT);
// Audio connections require memory to work. For more
// detailed information, see the MemoryAndCpuUsage example
Serial.println(" Asisgning Audio Memory...");
AudioMemory(50);
digitalWrite(mutePin, UNMUTE_SOUND);
pdm1.begin();
}
void loop() {
pdm1.update();
button0.update();
button1.update();
muteButton.update();
if (button0.fallingEdge()) {
Serial.println(" Button 0 pressed...");
}
if (button1.fallingEdge()) {
Serial.println(" Button 1 pressed...");
}
if (muteButton.fallingEdge()) {
if (mutedFlag == false) {
digitalWriteFast(mutePin, MUTE_SOUND);
Serial.println(" Muted Sound!");
mutedFlag = true;
} else {
digitalWriteFast(mutePin, UNMUTE_SOUND);
Serial.println(" Unmuted Sound!");
mutedFlag = false;
}
}
}
I have the feeling that this usage is NOT allowed.
2. Then, I removed the I2S device trying to get something from the PDM microphone, however the library indicates that the AudioInputPDM object has no functions. Where can the data be read/accessed or viewed? What is Port Out 0 (according to the Audio Connections in the image attached below)?
As you might see I am completely lost
I would like to kindly ask you for further guidance on how to use this microphone as the information on PDM microphones+Teensy is scarce and there a re NO EXAMPLES available.
Is it possible to test the PDM microphone using Teensy 3.6 as an Audio Device in my PC? Any other alternatives/resources?
Thank you in advance
Edit: added hyperlink to the microphone preamplifier (FAN3852) that I plan to use later on
confined and confused dzalf