Hesam Moshiri
Published © CC BY-NC-SA

How to Build an Isolated Digital AC Dimmer Using Arduino

We always face the situations that we want to have full control (dimming) over an AC load such as a lamp, a motor, vacuum cleaner, etc.

BeginnerFull instructions provided6,226
How to Build an Isolated Digital AC Dimmer Using Arduino

Things used in this project

Hardware components

MOC3021
×1
BT138
×1
TLP521-1
×1

Story

Read more

Schematics

fig2-how-to-build-an-isolated-digital-ac-dimmer-using-arduino_EZzXAgRRHk.jpg

Code

Arduino code

C/C++
const byte ZCP = 2;
const unsigned int dim = 5000;

void setup() {

  pinMode(ZCP, INPUT);
  pinMode(10, OUTPUT);
  digitalWrite(10, LOW);
 
}

void loop() {

  if (digitalRead(ZCP) == HIGH)
    Zero_Cross();

}

void Zero_Cross() {

  digitalWrite(10, LOW);
  delayMicroseconds(dim);
  digitalWrite(10, HIGH);
  
}

Credits

Hesam Moshiri

Hesam Moshiri

18 projects • 9 followers

Comments