شحن مجاني للأوردرات فوق
1000 ج
رمضان كريم
Auto-Gain Control Electret Mic Amplifier for Arduino Projects
The MAX9814 is a complete microphone amplifier with automatic gain control (AGC), featuring low-noise amplification and adjustable gain settings. This module provides clean audio signal conditioning for Arduino sound detection, voice recognition, and audio recording applications.
High-quality electret microphone
Adjustable AGC for varying input levels
1.5μV input noise (typical)
0.4mA shutdown current
| Supply Voltage | 2.7V – 5.5V (3.3V or 5V compatible) |
|---|---|
| Gain Range | 40dB, 50dB, 60dB (selectable) |
| Frequency Response | 20Hz – 20kHz |
| Output Type | Analog (AC-coupled) |
| Current Consumption | 3.5mA (typical at 5V) |
| AGC Attack/Release | Adjustable via external capacitor |
| Pin | Label | Description | Arduino Connection |
|---|---|---|---|
| 1 | VDD | Power (2.7-5.5V) | 5V |
| 2 | GND | Ground | GND |
| 3 | OUT | Audio Output | A0 (Analog Input) |
| 4 | GAIN | Gain Selection | See gain selection table |
| 5 | AR | AGC Release Control | Optional capacitor to GND |
| GAIN Pin Connection | Gain | Use Case |
|---|---|---|
| Left open | 60dB | Quiet environments |
| Connected to GND | 50dB | Normal voice levels |
| Connected to VDD | 40dB | Loud environments |
// MAX9814 Connections: // VDD → 5V // GND → GND // OUT → A0 (Analog Input) // GAIN → (See gain selection table) // AR → (Optional 1μF capacitor to GND) // For best results: // - Keep microphone away from noise sources // - Use shielded audio cable for long connections
const int micPin = A0;
void setup() {
Serial.begin(9600);
}
void loop() {
int soundValue = analogRead(micPin);
// Remove DC offset (approx. VCC/2)
int adjustedValue = abs(soundValue - 512);
Serial.print("Sound Level: ");
Serial.println(adjustedValue);
// Simple threshold detection
if(adjustedValue > 50) {
Serial.println("Sound detected!");
}
delay(50);
}
// FFT analysis with Arduino
#include "arduinoFFT.h"
arduinoFFT FFT;
#define SAMPLES 128
double vReal[SAMPLES];
double vImag[SAMPLES];
void setup() {
// Sample audio at consistent intervals
}
void loop() {
for(int i=0; i
// Add capacitor to AR pin for:
// - Smaller value: Faster AGC response
// - Larger value: Slower AGC response
// Typical values: 1μF to 10μF
// Example wiring:
// AR pin → 4.7μF capacitor → GND
// (Better for music with dynamic range)
// Detect sudden loud sounds
unsigned long lastClap = 0;
const int clapTimeout = 500;
void loop() {
int peak = 0;
for(int i=0; i<10; i++) {
int val = abs(analogRead(micPin) - 512);
if(val > peak) peak = val;
delay(1);
}
if(peak > 100 && millis() > lastClap + clapTimeout) {
lastClap = millis();
Serial.println("Clap detected!");
}
}
// Record to SD card
#include
File audioFile;
void setup() {
SD.begin(4); // CS on pin 4
audioFile = SD.open("audio.raw", FILE_WRITE);
}
void loop() {
int sample = analogRead(micPin);
audioFile.write(sample >> 2); // 8-bit conversion
delayMicroseconds(125); // 8kHz sampling
}
No account yet?
Create an Account
Recent Comments