The Adafruit I2S Microphone SPH0645 is a compact, high-quality digital microphone that uses the I2S (Inter-IC Sound) interface for transmitting audio data. Unlike traditional analog microphones, this digital microphone eliminates the need for analog-to-digital conversion, providing a cleaner and more accurate audio signal. Its small form factor and low power consumption make it ideal for a wide range of audio capture applications.
The following table outlines the key technical details of the Adafruit I2S Microphone SPH0645:
Parameter | Value |
---|---|
Operating Voltage | 1.8V to 3.3V |
Current Consumption | ~1.4 mA |
Interface | I2S (Inter-IC Sound) |
Sampling Frequency | 32 kHz to 96 kHz |
Bit Depth | 24-bit |
Signal-to-Noise Ratio | 65 dB |
Sensitivity | -26 dBFS ±3 dB |
Dimensions | 10.2mm x 10.2mm x 1.3mm |
The SPH0645 microphone has four pins, as described in the table below:
Pin Name | Description |
---|---|
VIN | Power input (1.8V to 3.3V). Connect to the 3.3V pin of your microcontroller. |
GND | Ground. Connect to the ground of your circuit. |
LRCLK | Left/Right clock. Determines whether the microphone outputs left or right data. |
DOUT | Data output. Outputs the I2S audio data stream. |
The SPH0645 microphone communicates using the I2S protocol, which requires a microcontroller with I2S support. Below is a step-by-step guide to connect and use the microphone:
Wiring the Microphone:
Configuring the Microcontroller:
I2S.h
for ESP32).Sample Code for ESP32: Below is an example code snippet to capture audio data from the SPH0645 microphone using an ESP32:
#include <I2S.h> // Include the I2S library for ESP32
// I2S configuration
const int I2S_WS = 25; // Word Select (LRCLK) pin
const int I2S_SD = 26; // Serial Data (DOUT) pin
const int I2S_SCK = 27; // Serial Clock (BCLK) pin
void setup() {
Serial.begin(115200); // Initialize serial communication for debugging
// Configure I2S with the appropriate pins and settings
if (!I2S.begin(I2S_PHILIPS_MODE, 16000, 32)) {
Serial.println("Failed to initialize I2S!");
while (1); // Halt execution if I2S initialization fails
}
I2S.setPins(I2S_SCK, I2S_WS, I2S_SD); // Set I2S pins
Serial.println("I2S Microphone Initialized!");
}
void loop() {
int32_t sample = 0; // Variable to store audio sample
// Read audio data from the microphone
if (I2S.read(&sample, sizeof(sample)) > 0) {
Serial.println(sample); // Print the audio sample to the serial monitor
}
}
Note: Replace the pin numbers with the actual GPIO pins used in your setup.
Issue | Possible Cause | Solution |
---|---|---|
No audio data is being received. | Incorrect wiring or pin configuration. | Double-check the wiring and ensure the pins are connected correctly. |
Distorted or noisy audio output. | Incorrect I2S clock frequency. | Verify that the I2S clock is set to a supported frequency (e.g., 32 kHz). |
Microphone not powering on. | Insufficient or unstable power supply. | Ensure the VIN pin is connected to a stable 3.3V power source. |
Audio data is not synchronized. | LRCLK pin not properly configured. | Ensure the LRCLK pin is connected and configured correctly in the code. |
Can I use the SPH0645 with an Arduino UNO?
What is the maximum sampling rate supported by the SPH0645?
Can I use multiple SPH0645 microphones in a single project?
How do I process the audio data from the microphone?
This documentation provides a comprehensive guide to using the Adafruit I2S Microphone SPH0645. Whether you're a beginner or an experienced user, this guide will help you integrate the microphone into your projects with ease.