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

Arduino Uno Controlled Fan System with Servo and LCD Display

View and Edit Project In Cirkit DesignerImage of Arduino Uno Controlled Fan System with Servo and LCD Display

Circuit Documentation

Summary

This circuit is designed to control a fan using an Arduino Uno R3. The fan is connected to a 12V relay, which is controlled by the Arduino. Additionally, a servo motor is used to rotate the fan, and an LCD display is used to show the status of the fan. An HC-SR04 ultrasonic sensor is also included in the circuit for distance measurement.

Component List

  1. Arduino Uno R3

    • Description: Microcontroller board based on the ATmega328P.
    • Pins: USB Port, Power Jack, Not Connected, IOREF, RESET, 3.3V, 5V, GND, VIN, A0, A1, A2, A3, A4/SDA, A5/SCL, SCL, SDA, AREF, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
  2. Servo

    • Description: A servo motor used for precise control of angular position.
    • Pins: gnd, vcc, pulse
  3. HC-SR04 Ultrasonic Sensor

    • Description: Ultrasonic sensor for distance measurement.
    • Pins: VCC, TRIG, ECHO, GND
  4. 220V Fan

    • Description: A fan that operates on 220V.
    • Pins: N, L
  5. LCD 20x4 I2C

    • Description: 20x4 character LCD display with I2C interface.
    • Pins: GND, 5v, SCA, SCL
  6. Power Transformer (220V to 24V)

    • Description: Transformer to step down 220V AC to 24V AC.
    • Pins: 2 - Primary, 1 - Primary, 3 - Secondary, 4 - Secondary
  7. 12V Relay

    • Description: Relay module to control high voltage devices.
    • Pins: NO, COM, NC, IN, DC-, DC+
  8. Fuse

    • Description: Electrical fuse for circuit protection.
    • Pins: Terminal 1, Terminal 2
  9. Power 220V

    • Description: 220V power supply.
    • Pins: hot wire, neutral wire

Wiring Details

Arduino Uno R3

Servo

HC-SR04 Ultrasonic Sensor

220V Fan

LCD 20x4 I2C

Power Transformer (220V to 24V)

12V Relay

Fuse

Power 220V

Code Documentation

/*
 * This Arduino Sketch controls a servo motor to rotate a fan for 5 minutes.
 * The fan is connected to a 12V relay, which is controlled by the Arduino.
 * The servo motor is connected to pin 6 of the Arduino.
 * The relay is connected to the fan and the power transformer.
 * The LCD displays the status of the fan.
 */

#include <Servo.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

Servo myServo;
LiquidCrystal_I2C lcd(0x27, 20, 4);

const int relayPin = 6;
const int fanDuration = 5 * 60 * 1000; // 5 minutes in milliseconds

void setup() {
  // Initialize the servo
  myServo.attach(6);
  myServo.write(0); // Start from the right side

  // Initialize the relay pin
  pinMode(relayPin, OUTPUT);
  digitalWrite(relayPin, LOW); // Ensure relay is off

  // Initialize the LCD
  lcd.begin(20, 4); // Provide the number of columns and rows
  lcd.backlight();
  lcd.setCursor(0, 0);
  lcd.print("Fan Control System");
  lcd.setCursor(0, 1);
  lcd.print("Fan will run for 5 min");

  // Wait for 2 seconds before starting
  delay(2000);

  // Start the fan
  digitalWrite(relayPin, HIGH);
  myServo.write(90); // Rotate to the center position
  lcd.setCursor(0, 2);
  lcd.print("Fan is running...");

  // Run the fan for the specified duration
  delay(fanDuration);

  // Stop the fan
  digitalWrite(relayPin, LOW);
  myServo.write(0); // Return to the right side
  lcd.setCursor(0, 3);
  lcd.print("Fan stopped.");
}

void loop() {
  // Nothing to do here
}

This code initializes the servo motor, relay, and LCD display. It then starts the fan by activating the relay and rotating the servo motor to the center position. The LCD displays the status of the fan. After running the fan for 5 minutes, the relay is deactivated, and the servo motor returns to its initial position. The loop function is empty as there is no need for continuous execution.