INMP441 MEMS High Precision Omnidirectional Microphone Module I2S Documentation
The INMP441 MEMS High Precision Omnidirectional Microphone Module I2S is a high-quality digital microphone module designed for a wide range of applications, including voice assistants, smart home devices, and industrial automation. This module features a high-sensitivity MEMS microphone element and a 24-bit I2S audio interface, providing an exceptional signal-to-noise ratio (SNR) and high-fidelity audio output.
Microphone Element: INMP441 MEMS Omnidirectional
Audio Interface: 24-bit I2S
Sampling Frequency: Up to 96 kHz
Sensitivity: 38 dBFS/Pa (max)
Signal-to-Noise Ratio (SNR): 65 dB (min)
Power Supply: 1.8 V to 3.6 V
Operating Temperature: -40C to 85C
### Example 1: Arduino Read Audio Data and Print to Serial Monitor
This example demonstrates how to read audio data from the INMP441 microphone module and print it to the serial monitor using an Arduino board.
#define I2S_BCK 13 // I2S bit clock pin
#define I2S_WS 14 // I2S word select pin
#define I2S_SD 15 // I2S serial data pin
void setup() {
Serial.begin(115200);
Wire.begin();
}
void loop() {
int16_t left_channel, right_channel;
uint8_t i2s_data[4];
// Read 32-bit I2S data (2 bytes per channel)
Wire.beginTransmission(0x1A);
Wire.write(0x00);
Wire.endTransmission();
Wire.requestFrom(0x1A, 4);
i2s_data[0] = Wire.read();
i2s_data[1] = Wire.read();
i2s_data[2] = Wire.read();
i2s_data[3] = Wire.read();
// Convert I2S data to 16-bit audio samples
left_channel = (i2s_data[1] << 8) | i2s_data[0];
right_channel = (i2s_data[3] << 8) | i2s_data[2];
// Print audio data to serial monitor
Serial.print("Left Channel: ");
Serial.print(left_channel);
Serial.print(", Right Channel: ");
Serial.println(right_channel);
delay(50); // 50 ms sampling period
}
```
### Example 2: Raspberry Pi Record Audio Using PCM (Pulse Code Modulation) Interface
This example demonstrates how to record audio using the INMP441 microphone module and the PCM interface on a Raspberry Pi.
```python
import pyaudio
import wave
# Open PyAudio instance
p = pyaudio.PyAudio()
# Open PCM stream
stream = p.open(format=pyaudio.paInt16,
channels=2,
rate=48000,
input=True,
frames_per_buffer=1024)
print("Recording...")
frames = []
# Record audio for 5 seconds
for i in range(0, int(48000 / 1024 5)):
data = stream.read(1024)
frames.append(data)
print("Finished recording")
# Stop and close PCM stream
stream.stop_stream()
stream.close()
p.terminate()
# Save audio data to WAV file
wf = wave.open("output.wav", "wb")
wf.setnchannels(2)
wf.setsampwidth(2)
wf.setframerate(48000)
wf.writeframes(b''.join(frames))
wf.close()
```
Note: These code examples are for demonstration purposes only and may require modifications to suit your specific application. Ensure you have the necessary dependencies and libraries installed for your development environment.