Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino UNO Controlled Sound-Activated Water Pump

View and Edit Project In Cirkit DesignerImage of Arduino UNO Controlled Sound-Activated Water Pump

Circuit Documentation

Summary of the Circuit

This circuit is designed to activate a 5V mini water pump when a sound is detected by the KY-037 Microphone sensor. The Arduino UNO serves as the central controller, reading the digital output from the microphone sensor and controlling the 5V relay, which in turn powers the water pump. The system is powered by the 5V output from the Arduino UNO, which is shared with the microphone sensor and the relay module.

Component List

Arduino UNO

KY-037 Microphone

5V Relay

5V Mini Water Pump

Wiring Details

Arduino UNO

KY-037 Microphone

5V Relay

5V Mini Water Pump

Documented Code

// sketch.ino
const int soundSensorPin = 2;  // Pin connected to the sound sensor
const int pumpRelayPin = 7;    // Pin connected to the relay controlling the water pump
int sensorThreshold = 500;     // Adjust this threshold based on your sensor sensitivity

void setup() {
  pinMode(soundSensorPin, INPUT);
  pinMode(pumpRelayPin, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  int soundValue = digitalRead(soundSensorPin); // Read sound sensor value

  if (soundValue == HIGH) {  // If sound is detected (mobile alarm rings)
    digitalWrite(pumpRelayPin, HIGH);  // Activate water sprinkler
    Serial.println("Sound detected! Sprinkler activated.");
  } else {
    digitalWrite(pumpRelayPin, LOW);   // Turn off the sprinkler if no sound is detected
  }

  delay(1000);  // Adjust delay as needed
}

Note: The sensorThreshold variable is defined but not used in the provided code. The digital output from the KY-037 Microphone is directly read and used to control the relay. If the analog output is to be used, the sensorThreshold would be relevant for comparing the analog sensor value.