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

Arduino-Controlled RGB LED Strip and Water Pump Activation System

View and Edit Project In Cirkit DesignerImage of Arduino-Controlled RGB LED Strip and Water Pump Activation System

Circuit Documentation

Summary

This circuit is designed to control a 12V RGB LED strip and a mini diaphragm water pump based on input from a sound sensor. The RGB LED strip's color changes according to the filtered sound signal, and the relay activates the water pump when the sound signal exceeds a certain threshold. An Arduino UNO microcontroller is used to process the sound sensor signal and control the LED strip and relay. The circuit also includes power supply components and transistors to drive the LED strip and pump.

Component List

Transistors

Resistors

Power Supplies

Microcontroller

Sensors

Actuators

Relay

Wiring Details

TIP41C Transistors

Resistors (1k Ohm)

12V Power Supply

Arduino UNO

Sound Sensor

12V RGB LED Strip

Mini Diaphragm Water Pump

12V Single Channel Relay

DC Power Source

Documented Code

/*
 * This Arduino sketch controls an RGB LED strip and a relay with a motor
 * based on input from a sound sensor. The RGB LED strip changes colors
 * according to the filtered sound signal, and the relay activates the motor
 * when the sound signal exceeds a certain threshold.
 */

#define Rpin 11
#define Gpin 10
#define Bpin 9
#define relayPin 12
#define sensorPin A0
#define delayLEDS 3

float sensorValue = 0, filteredSignal = 0,
    filteredSignalValues[] = {3.4, 3.1, 2.7, 2.4, 2.1, 1.7, 1.3, 0.9, 0.4};

void setup() {
  Serial.begin(9600);
  pinMode(Rpin, OUTPUT);
  pinMode(Gpin, OUTPUT);
  pinMode(Bpin, OUTPUT);
  pinMode(relayPin, OUTPUT);
}

void loop() {
  MainFunction();
}

void MainFunction() {
  sensorValue = (float)analogRead(sensorPin) * (5.0 / 1024.0);
  FilterSignal(sensorValue);
  Serial.print(sensorValue);
  Serial.print(" ");
  Serial.println(filteredSignal);
  CompareSignalFiltered(filteredSignal);
}

void FilterSignal(float sensorSignal) {
  filteredSignal = (0.945 * filteredSignal) + (0.0549 * sensorSignal);
}

void CompareSignalFiltered(float filteredSignal) {
  if (filteredSignal > filteredSignalValues[0]) {
    RGBColor(0, 0, 255);
    Serial.println("Blue");
    digitalWrite(relayPin, HIGH);
  } else if (filteredSignal <= filteredSignalValues[0] &&
             filteredSignal > filteredSignalValues[1]) {
    RGBColor(0, 255, 255);
    Serial.println("Azure");
    digitalWrite(relayPin, LOW);
  } else if (filteredSignal <= filteredSignalValues[1] &&
             filteredSignal > filteredSignalValues[2]) {
    RGBColor(0, 127, 255);
    Serial.println("Cyan");
    digitalWrite(relayPin, LOW);
  } else if (filteredSignal <= filteredSignalValues[2] &&
             filteredSignal > filteredSignalValues[3]) {
    RGBColor(0, 255, 127);
    Serial.println("Aqua marine");
    digitalWrite(relayPin, LOW);
  } else if (filteredSignal <= filteredSignalValues[3] &&
             filteredSignal > filteredSignalValues[4]) {
    RGBColor(0, 255, 0);
    Serial.println("Green");
    digitalWrite(relayPin, LOW);
  } else if (filteredSignal <= filteredSignalValues[4] &&
             filteredSignal > filteredSignalValues[5]) {
    RGBColor(255, 255, 0);
    Serial.println("Yellow");
    digitalWrite(relayPin, LOW);
  } else if (filteredSignal <= filteredSignalValues[5] &&
             filteredSignal > filteredSignalValues[6]) {
    RGBColor(255, 0, 255);
    Serial.println("Magenta");
    digitalWrite(relayPin, LOW);
  } else if (filteredSignal <= filteredSignalValues[6] &&
             filteredSignal > filteredSignalValues[7]) {
    RGBColor(255, 0, 127);
    Serial.println("Rose");
    digitalWrite(relayPin, LOW);
  } else if (filteredSignal <= filteredSignalValues[7] &&
             filteredSignal > filteredSignalValues[8]) {
    RGBColor(255, 127, 0);
    Serial.println("Orange");
    digitalWrite(relayPin, LOW);
  } else if (filteredSignal <= filteredSignalValues[8]) {
    RGBColor(255, 0, 0);
    Serial.println("Red");
    digitalWrite(relayPin, LOW);
  } else {
    RGBColor(0, 0, 255);
    Serial.println("Default: Blue");
    digitalWrite(relayPin, LOW);
  }
}

void RGBColor(int Rcolor, int Gcolor, int Bcolor) {
  analogWrite(Rpin, Rcolor);
  analogWrite(Gpin, Gcolor);
  analogWrite(Bpin, Bcolor);
  delay(delayLEDS);
}

This code is designed to be uploaded to an Arduino UNO microcontroller. It reads the analog value from a sound sensor, filters the signal, and then uses the filtered value to determine the color of the RGB LED strip and whether to activate the relay for the water pump. The colors and relay state are adjusted based on predefined threshold values.