Démarrer
Câblage vers l’ESP32
| Broche du capteur | Broche ESP32 | Statut | Rôle |
|---|---|---|---|
| GND | GND | Requis | Sol |
| +V | 3.3V or 5V | Requis | Alimentation |
| D0 | GPIO15 | Optionnel | Entrée numérique (n'importe quel GPIO) |
| A0 | GPIO34 | Optionnel | Entrée analogique (broche ADC) |

Code
Aucune bibliothèque à installer.
int analogPin = A0; // Analog output of the sensor
int digitalPin = 7; // Digital output of the sensor
int ledPin = 13; // Onboard LED
void setup() {
pinMode(analogPin, INPUT);
pinMode(digitalPin, INPUT);
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
Serial.println("KY-037 Sound Detection Module Test");
}
void loop() {
int analogValue = analogRead(analogPin);
int digitalValue = digitalRead(digitalPin);
if (digitalValue == HIGH) {
digitalWrite(ledPin, HIGH); // Turn ON the LED when sound is detected
} else {
digitalWrite(ledPin, LOW); // Turn OFF the LED when no sound is detected
}
Serial.print("Analog Value: ");
Serial.println(analogValue);
delay(1000);
}
Brochage
Caractéristiques
Le KY-037 est un module de détection sonore haute sensibilité doté d'un microphone à condensateur électret et d'un comparateur LM393. Il offre des sorties analogiques et numériques, ce qui le rend adapté à diverses applications de détection sonore, notamment les projets à commande vocale et la surveillance du niveau sonore.
| Caractéristique | Valeur |
|---|---|
| Dimensions | 15mm x 36mm |
| Operating Voltage | 3.3V to 5V |
| Current Consumption | ~0.5 mA |
| Microphone Sensitivity | -42 ±3 dB |

