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

Arduino-Controlled 12V Fan with Relay Automation

View and Edit Project In Cirkit DesignerImage of Arduino-Controlled 12V Fan with Relay Automation

Circuit Documentation

Summary

This circuit is designed to control a 12V fan using a relay and an Arduino Mini (Rev5). The fan is turned on every 10 seconds for a duration of 2 seconds. The relay is controlled by the Arduino, which is powered by a 5V adapter. The 12V fan and relay are powered by a 12V adapter. An AC supply powers both the 12V and 5V adapters.

Component List

  1. 12V Relay

    • Pins: NO, COM, NC, DC+, DC-, IN
    • Description: A relay used to control the 12V fan.
    • Purpose: To switch the 12V fan on and off based on the Arduino's control signal.
  2. 40 Fan 12V

    • Pins: +12V, -12V
    • Description: A 12V fan.
    • Purpose: To provide cooling.
  3. 5V Adapter

    • Pins: AC In 1, AC In 2, 5V, GND
    • Description: A 5V power adapter.
    • Purpose: To power the Arduino Mini (Rev5).
  4. AC Supply

    • Pins: +ve, -ve
    • Description: An AC power supply.
    • Purpose: To provide AC power to the 5V and 12V adapters.
  5. 12V Adapter

    • Pins: VCC, GND
    • Description: A 12V power adapter.
    • Purpose: To power the 12V relay and fan.
  6. Arduino Mini (Rev5)

    • Pins: D0/TX, D1/RX, RESET, GND, D2, D3 PWM, D4, D5 PWM, D6 PWM, D7, D8, D9 PWM, VCC, 5V, A3, A2, A1, A0, D13, D12, D11 PWM, D10 PWM, A6, A4, A7, A5, TX, RX
    • Description: A microcontroller board.
    • Purpose: To control the relay based on a programmed schedule.

Wiring Details

12V Relay

40 Fan 12V

5V Adapter

AC Supply

12V Adapter

Arduino Mini (Rev5)

Code Documentation

/*
 * This Arduino Sketch controls a 12V fan using a relay. The fan is turned on
 * every 10 seconds for a duration of 2 seconds. The relay is connected to
 * pin D2 of the Arduino Mini (Rev5).
 */

const int relayPin = 2; // Pin connected to the relay IN pin

void setup() {
  // Initialize the relay pin as an output
  pinMode(relayPin, OUTPUT);
  // Ensure the relay is off initially
  digitalWrite(relayPin, LOW);
}

void loop() {
  // Turn the relay on (fan on)
  digitalWrite(relayPin, HIGH);
  delay(2000); // Wait for 2 seconds
  // Turn the relay off (fan off)
  digitalWrite(relayPin, LOW);
  delay(10000); // Wait for 10 seconds
}

This code initializes the relay pin as an output and ensures the relay is off initially. In the main loop, the relay is turned on for 2 seconds to power the fan and then turned off for 10 seconds, creating a periodic on-off cycle for the fan.