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

Arduino-Controlled Sound-Activated Water System

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

Circuit Documentation

Summary

This circuit is designed to control a water sink system using an Arduino Uno R3 microcontroller, a sound sensor, and a 12V single-channel relay. The system activates the water flow when a specific sound command, presumably "nyalakan air," is detected by the sound sensor. The sound sensor's digital output is connected to the Arduino, which in turn controls the relay to manage the water flow.

Component List

Sound Sensor

Arduino Uno R3

12V Single Channel Relay

Wiring Details

Sound Sensor

Arduino Uno R3

12V Single Channel Relay

Documented Code

Sound Sensor Code (Arduino Uno R3)

/*
 * This Arduino sketch is designed for a water sink system. The system turns on
 * the water when it hears the command 'nyalakan air'. The sound sensor is
 * connected to the Arduino, and the relay controlling the water flow is also
 * connected to the Arduino. The sound sensor's digital output is connected to
 * pin 2 of the Arduino, and the relay's input is connected to pin 3 of the
 * Arduino.
 */

const int soundSensorPin = 2; // Pin connected to the sound sensor's digital out
const int relayPin = 3;       // Pin connected to the relay's input

void setup() {
  pinMode(soundSensorPin, INPUT); // Set sound sensor pin as input
  pinMode(relayPin, OUTPUT);      // Set relay pin as output
  digitalWrite(relayPin, LOW);    // Ensure relay is off initially
}

void loop() {
  int soundState = digitalRead(soundSensorPin); // Read sound sensor state
  if (soundState == HIGH) { // If sound sensor detects sound
    digitalWrite(relayPin, HIGH); // Turn on the relay (water on)
  } else {
    digitalWrite(relayPin, LOW);  // Turn off the relay (water off)
  }
}

Arduino Uno R3 Default Code

void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:

}

(Note: The default code for the Arduino Uno R3 does not perform any specific function and is provided for completeness. The actual functionality is implemented in the Sound Sensor Code section.)