Digital, omnidirectional condenser microphone
Digital, omnidirectional condenser microphone
20 Hz to 20 kHz
-40 dB 3 dB
2.2 k
| Signal-to-Noise Ratio | 80 dB |
5V, <100mA
0C to 50C
-20C to 70C
14mm (diameter) x 6mm (height)
Applications
| The Raspberry Pi USB2.0 Mini Microphone is ideal for a variety of IoT projects and applications, including |
Voice assistants and AI-powered devices
Audio-based home automation systems
IoT-enabled conferencing systems
Robotics and autonomous systems
Environmental monitoring and sensing applications
Education and prototyping projects
Conclusion
The Raspberry Pi USB2.0 Mini Microphone is a compact, versatile, and reliable audio input device that is specifically designed for use with Raspberry Pi boards. Its high-quality audio capabilities, low power consumption, and plug-and-play functionality make it an excellent choice for a wide range of IoT projects and applications.
Raspberry Pi USB2.0 Mini Microphone DocumentationOverviewThe Raspberry Pi USB2.0 Mini Microphone is a compact, high-quality audio input device designed for use with Raspberry Pi single-board computers. This microphone module connects via USB and is compatible with Raspberry Pi OS, Windows, and macOS. It's ideal for a wide range of applications, including voice assistants, home automation, and audio recording projects.Technical SpecificationsUSB 2.0 interface
16-bit, 48 kHz audio recording
Omnidirectional microphone capsule
3.5mm microphone diameter
Dimensions: 14mm x 10mm x 4mm
Weight: 2g
Operating voltage: 5V
Current consumption: <100mASetting up the MicrophoneTo use the Raspberry Pi USB2.0 Mini Microphone, simply connect it to a free USB port on your Raspberry Pi. Make sure to install the necessary audio drivers and configure the microphone as the default audio input device.Code Examples### Example 1: Audio Recording with Python (Raspbian OS)This example demonstrates how to use the microphone to record audio using Python on Raspbian OS:
```python
import pyaudio
import wave# Open the microphone stream
FORMAT = pyaudio.paInt16
CHANNELS = 1
RATE = 48000
CHUNK = 1024
WAVE_OUTPUT_FILENAME = "output.wav"audio = pyaudio.PyAudio()
stream = audio.open(format=FORMAT, channels=CHANNELS,
rate=RATE, input=True,
frames_per_buffer=CHUNK)print("recording...")
frames = []# Record audio for 5 seconds
for i in range(0, int(RATE / CHUNK 5)):
data = stream.read(CHUNK)
frames.append(data)print("finished recording")# Close the microphone stream
stream.stop_stream()
stream.close()
audio.terminate()# Save the recorded audio to a WAV file
waveFile = wave.open(WAVE_OUTPUT_FILENAME, "wb")
waveFile.setnchannels(CHANNELS)
waveFile.setsampwidth(audio.get_sample_size(FORMAT))
waveFile.setframerate(RATE)
waveFile.writeframes(b"".join(frames))
waveFile.close()
```
### Example 2: Speech Recognition with Google Cloud Speech-to-Text (Python)This example demonstrates how to use the microphone to capture audio and send it to the Google Cloud Speech-to-Text API for speech recognition:
```python
import pyaudio
import speech_recognition as sr# Create a speech recognition object
r = sr.Recognizer()# Open the microphone stream
with sr.Microphone() as source:
print("Say something!")
audio = r.record(source, duration=5)# Send the audio to Google Cloud Speech-to-Text API
try:
print("Google Cloud Speech-to-Text API result:")
print(r.recognize_google_cloud(audio, language="en-US"))
except sr.UnknownValueError:
print("Google Cloud Speech-to-Text API could not understand your audio")
except sr.RequestError as e:
print("Error requesting Google Cloud Speech-to-Text API: {0}".format(e))
```
Note: Make sure to install the necessary Python libraries, including `pyaudio` and `speech_recognition`, using `pip` or your preferred package manager.### Example 3: Real-time Audio Processing with ALSA (C++ - Raspbian OS)This example demonstrates how to use the microphone to capture audio and process it in real-time using ALSA (Advanced Linux Sound Architecture) on Raspbian OS:
```c
#include <alsa/asoundlib.h>
#include <iostream>int main() {
// Open the microphone stream
snd_pcm_t _capture_handle;
snd_pcm_open(&capture_handle, "default", SND_PCM_STREAM_CAPTURE, 0);
snd_pcm_set_format(capture_handle, SND_PCM_FORMAT_S16_LE);
snd_pcm_set_channels(capture_handle, 1);
snd_pcm_set_rate(capture_handle, 48000);// Create a buffer to store the captured audio
char buffer[1024];// Start capturing audio
snd_pcm_start(capture_handle);while (true) {
// Read audio from the microphone
snd_pcm_readi(capture_handle, buffer, 1024);// Process the captured audio (e.g., apply filters, detect voice activity)
// ...// Print the captured audio (for demonstration purposes)
std::cout.write(buffer, 1024);
}// Close the microphone stream
snd_pcm_close(capture_handle);
return 0;
}
```
Note: Make sure to compile the code with the ALSA development package installed on your Raspberry Pi.These examples demonstrate the basic usage of the Raspberry Pi USB2.0 Mini Microphone in various contexts. You can adapt and expand upon these examples to suit your specific project requirements.