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

Arduino UNO-Based AC Light Dimmer with Potentiometer Control and LCD Display

View and Edit Project In Cirkit DesignerImage of Arduino UNO-Based AC Light Dimmer with Potentiometer Control and LCD Display

Circuit Documentation

Summary

This circuit is a light dimmer that controls the brightness of an AC bulb using a TRIAC. The brightness is adjusted via a potentiometer. The circuit includes an optocoupler for isolation and a zero-crossing detector for phase control. An Arduino UNO microcontroller is used to manage the control logic, and an I2C LCD is used to display the brightness level.

Component List

  1. Arduino UNO

    • Description: Microcontroller board based on the ATmega328P.
    • Pins: SDA, AREF, GND, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, A5, A4, A3, A2, A1, A0, Vin, 5V, 3.3V, RESET, IOREF, SCL
  2. BT139 600

    • Description: TRIAC used for switching AC loads.
    • Pins: MT1, MT2, GATE
  3. 1N4007 Rectifier Diode

    • Description: General-purpose rectifier diode.
    • Pins: Cathode, Anode
  4. Resistor (100 Ohms)

    • Description: Resistor with a resistance of 100 Ohms.
    • Pins: pin1, pin2
  5. Resistor (10k Ohms)

    • Description: Resistor with a resistance of 10k Ohms.
    • Pins: pin1, pin2
  6. Potentiometer

    • Description: Variable resistor used to adjust the brightness.
    • Pins: GND, Output, VCC
  7. Ceramic Capacitor (100pF)

    • Description: Capacitor with a capacitance of 100pF.
    • Pins: pin0, pin1
  8. Ceramic Capacitor (10pF)

    • Description: Capacitor with a capacitance of 10pF.
    • Pins: pin0, pin1
  9. AC Bulb

    • Description: AC bulb used as the load.
    • Pins: P, N
  10. Optocoupler

    • Description: Provides electrical isolation between the microcontroller and the TRIAC.
    • Pins: Anode, Cathode, Collector, Emitter
  11. AC Wall Plug Point

    • Description: Provides AC power to the circuit.
    • Pins: E, N, L
  12. 16x2 I2C LCD

    • Description: LCD display for showing the brightness level.
    • Pins: GND, VCC, SDA, SCL

Wiring Details

Arduino UNO

BT139 600

1N4007 Rectifier Diode

Resistor (100 Ohms)

Resistor (10k Ohms)

Potentiometer

Ceramic Capacitor (100pF)

Ceramic Capacitor (10pF)

AC Bulb

Optocoupler

AC Wall Plug Point

16x2 I2C LCD

Code Documentation

/*
 * LIGHT DIMMER
 * This Arduino sketch controls the brightness of an AC bulb using a TRIAC.
 * The brightness is adjusted via a potentiometer. The circuit includes an
 * optocoupler for isolation and a zero-crossing detector for phase control.
 */

// Pin Definitions
#define TRIAC_PIN 13          // TRIAC trigger pin
#define ZC_PIN 2              // Zero-crossing detection pin
#define POT_PIN A0            // Potentiometer pin for control
#define LCD_SDA A4            // I2C LCD SDA pin
#define LCD_SCL A5            // I2C LCD SCL pin

// Variables
volatile int zeroCross = 0;
int firingDelay = 0;         // Delay to control phase angle
int dimming = 0;             // Dimming level (0-100)

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

// Initialize the LCD
LiquidCrystal_I2C lcd(0x27, 16, 2);

void setup() {
  pinMode(TRIAC_PIN, OUTPUT);
  pinMode(ZC_PIN, INPUT);
  attachInterrupt(digitalPinToInterrupt(ZC_PIN), zeroCrossingISR, RISING);
  
  Serial.begin(9600);        // Debugging
  lcd.begin();
  lcd.backlight();
  lcd.setCursor(0, 0);
  lcd.print("Light Dimmer");
}

void loop() {
  // Read potentiometer value and map it to a firing delay
  int potValue = analogRead(POT_PIN);
  dimming = map(potValue, 0, 1023, 100, 0);  // Map to 0-100% brightness

  // Calculate delay based on dimming level
  firingDelay = (100 - dimming) * 65;  // Scale for 50Hz (use 78 for 60Hz)

  // Display dimming level on LCD
  lcd.setCursor(0, 1);
  lcd.print("Brightness: ");
  lcd.print(dimming);
  lcd.print("%");

  delay(100);  // Smooth dimming
}

// Interrupt Service Routine (ISR) for zero-crossing detection
void zeroCrossingISR() {
  zeroCross = 1;
  delayMicroseconds(firingDelay);  // Delay to control firing angle
  digitalWrite(TRIAC_PIN, HIGH);
  delayMicroseconds(10);           // Short pulse to trigger TRIAC
  digitalWrite(TRIAC_PIN, LOW);
}

This code controls the brightness of an AC bulb using a TRIAC. The brightness is adjusted via a potentiometer, and the current brightness level is displayed on an I2C LCD. The zero-crossing detection is used to control the phase angle for dimming the light.