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

Arduino UNO Controlled Water Dispenser with Dual Pushbutton Relay Activation

View and Edit Project In Cirkit DesignerImage of Arduino UNO Controlled Water Dispenser with Dual Pushbutton Relay Activation

Circuit Documentation

Summary of the Circuit

This circuit is designed to control a dispensing system using an Arduino UNO microcontroller. The system includes two pushbuttons that trigger the dispensing of cold water and sparkling water. A relay module is used to switch AC loads that could represent the actual dispensing mechanism. The Arduino UNO reads the state of the pushbuttons and controls the relay module accordingly. The circuit also includes AC wires to connect the relay module to the AC loads.

Component List

Arduino UNO

Pushbutton (x2)

Relay Module 2 Channel

AC Wire (x2)

Comment (x2)

Wiring Details

Arduino UNO

Pushbutton

Relay Module 2 Channel

AC Wire

Documented Code

/*
 * This Arduino sketch controls a dispensing system with two buttons: 
 * one for cold water and one for sparkling water. When a button is 
 * pressed, the corresponding dispensing sequence is executed.
 */

const int buttonColdPin = 2; // Pin connected to Button Cold
const int buttonSparklingPin = 3; // Pin connected to Button Sparkling
const int pedalDispensePin = 4; // Pin controlling Pedal Dispense Harness
const int pedalSelectPin = 5; // Pin controlling Pedal Select Harness

void setup() {
  pinMode(buttonColdPin, INPUT_PULLUP);
  pinMode(buttonSparklingPin, INPUT_PULLUP);
  pinMode(pedalDispensePin, OUTPUT);
  pinMode(pedalSelectPin, OUTPUT);
  digitalWrite(pedalDispensePin, LOW);
  digitalWrite(pedalSelectPin, LOW);
}

void loop() {
  if (digitalRead(buttonColdPin) == LOW) {
    // Button Cold pressed
    digitalWrite(pedalDispensePin, HIGH);
    delay(1000); // 1 second
    digitalWrite(pedalDispensePin, LOW);
    delay(200); // 0.2 seconds
    digitalWrite(pedalDispensePin, HIGH);
    delay(3000); // 3 seconds
    digitalWrite(pedalDispensePin, LOW);
  }

  if (digitalRead(buttonSparklingPin) == LOW) {
    // Button Sparkling pressed
    digitalWrite(pedalDispensePin, HIGH);
    delay(1000); // 1 second
    digitalWrite(pedalDispensePin, LOW);
    delay(200); // 0.2 seconds
    digitalWrite(pedalSelectPin, HIGH);
    delay(200); // 0.2 seconds
    digitalWrite(pedalSelectPin, LOW);
    delay(200); // 0.2 seconds
    digitalWrite(pedalSelectPin, HIGH);
    delay(200); // 0.2 seconds
    digitalWrite(pedalSelectPin, LOW);
    digitalWrite(pedalDispensePin, HIGH);
    delay(3000); // 3 seconds
    digitalWrite(pedalDispensePin, LOW);
  }
}

Filename: sketch.ino

Description: The code defines the behavior of the Arduino UNO when interacting with the pushbuttons and relay module. It sets up the necessary pins as inputs or outputs and defines the logic to be executed when each button is pressed. The code uses digitalRead to check the state of the pushbuttons and digitalWrite to control the relay module. Delays are used to manage the timing of the dispensing sequence.