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

Arduino UNO Controlled 8-Channel Relay with 12V LED Indicators

View and Edit Project In Cirkit DesignerImage of Arduino UNO Controlled 8-Channel Relay with 12V LED Indicators

Circuit Documentation

Summary

This circuit involves an Arduino UNO microcontroller controlling an 8-channel relay module, which in turn controls multiple 12V Blue LEDs. The circuit is powered by a 12V 5A power supply. The Arduino UNO is programmed to randomly turn the relays on and off, and also to create a fading effect on an LED connected to a PWM pin.

Component List

  1. Arduino UNO

    • Description: A microcontroller board based on the ATmega328P.
    • Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
  2. 8 Channel Relay JD-VCC

    • Description: A relay module that allows control of high voltage devices with low voltage signals.
    • Pins: JD-VCC, VCC, GND, In8, In7, In6, In5, In4, In3, In2, In1, In1_NC, IN1_COM, IN1_NO, IN2_NC, IN2_COM, IN2_NO, IN3_NC, IN3_COM, IN3_NO, IN4_NC, IN4_COM, IN4_NO, IN5_NC, IN5_COM, IN5_NO, IN6_NC, IN6_COM, IN6_NO, IN7_NC, IN7_COM, IN7_NO, IN8_NC, IN8_COM, IN8_NO
  3. 12V Blue LED

    • Description: A blue LED that operates at 12V.
    • Pins: GND, VCC
  4. POWER SUPPLY 12V 5AMP

    • Description: A power supply that provides 12V DC at up to 5A.
    • Pins: 220V Positive Pole (AC), 220V Negative Pole (AC), GND, GND (DC), 12V-24V Output (DC)

Wiring Details

Arduino UNO

8 Channel Relay JD-VCC

12V Blue LED

POWER SUPPLY 12V 5AMP

Code Documentation

// Define the pins for the 8 relay channels
const int relayPins[] = {2, 3, 4, 5, 6, 7, 8, 9}; // Change pins as needed
const int numRelays = 8; // Total number of relays

// Define LED pin for fade effect
const int ledPin = 10;  // PWM pin to control LED brightness

void setup() {
  // Initialize relay pins as output
  for (int i = 0; i < numRelays; i++) {
    pinMode(relayPins[i], OUTPUT);
    digitalWrite(relayPins[i], LOW); // Make sure relays are off initially
  }

  // Initialize the LED pin as output
  pinMode(ledPin, OUTPUT);
}

void loop() {
  // Randomly turn relays on and off
  int relayIndex = random(0, numRelays);  // Random relay index (0 to 7)
  int state = random(0, 2);  // Random state (0 = OFF, 1 = ON)
  
  digitalWrite(relayPins[relayIndex], state == 1 ? HIGH : LOW);  // Turn relay on/off
  
  // Create a fading LED effect (smooth on and off)
  for (int brightness = 0; brightness <= 255; brightness