Arduino Based AC DIMMER Using TRIAC
by Utsource in Circuits > Arduino
664 Views, 0 Favorites, 0 Comments
Arduino Based AC DIMMER Using TRIAC
So in this tutorial, we will learn about an AC lamp dimmer using Arduino and TRIAC. Here a TRIAC is used to switch the AC lamp, as this is a Power electronic fast switching device which is the best suited for these applications.
Things You Need
For this instructables we will need following things :
Arduino UNO
MCT2E optocoupler
MOC3021 optocoupler
BT136 TRIAC
(12-0)V, 500mA Step down transformer
1K,10K, 330ohm Resistors
10K Potentiometer
AC Holder with Lamp
AC wires
Jumpers
Schmatics
Code
Please copy the following code and upload it to the arduino Board :
int LAMP = 4;
int dim_val=0;
void setup()
{
pinMode(LAMP, OUTPUT);
attachInterrupt(digitalPinToInterrupt(2), zero_cross, CHANGE);
}
void zero_cross()
{
int dimming_time = (200*dim_val);
delayMicroseconds(dimming_time);
digitalWrite(LAMP, HIGH);
delayMicroseconds(10);
digitalWrite(LAMP, LOW);
}
void loop()
{
int data=analogRead(A0);
int data1 = map(data, 0, 1023,10,49);
dim_val=data1;
}