Electrical Engineering Asked on October 29, 2021
I’ve designed a triac based dimmer circuit. It is working just fine except the bulb is flickering on dimming (working fine with full brightness). Bulb I am using is filament based and dims perfectly from other dimmers. I am attaching schematic of my circuit and code. The strange thing that I am noticing is that the flickering stops as soon as I put my finger on atmega’s ground or Vcc pin. On touching these anywhere on the circuit, flickering stops immediately. Circuit contains standalone Atmega 328p au circuit along with dimming circuit. I’ve placed 0.1uf ceramic caps between both Vcc and ground. Also a 100uf electrolytic cap between Vcc and Ground from incoming supply.
Code that I’ve used is this, and I am pretty sure that code is okay because it is working fine with the dimmer circuit that I’ve bought from market.
#include <TimerOne.h>
volatile int i=0;
volatile boolean zero_cross=0;
int AC_pin = 3;
int dim = 064; // half brightness
int inc=1;
int freqStep = 75;
void setup() {
pinMode(AC_pin, OUTPUT);
attachInterrupt(0, zero_cross_detect, RISING);
Timer1.initialize(freqStep);
Timer1.attachInterrupt(dim_check, freqStep);
}
void zero_cross_detect() {
zero_cross = true;
i=0;
digitalWrite(AC_pin, LOW);
}
void dim_check() {
if(zero_cross == true) {
if(i>=dim) {
digitalWrite(AC_pin, HIGH);
i=0;
zero_cross = false;
}
else {
i++;
}
}
}
void loop() {
}
Please let me know the solution for same.
Is that a coil, connected to ATmega's D3 pin?! Why is there this 0.1 uF capacitor at MOC3021 input?
This coil and the 0.1 uF capacitor make a LC circuit, that delays the moment when the optocoupler conducts, and so it delays the moment when the TRIAC will light the bulb.
Even if it is just a 470 ohm resistor, this resistor delays the charging of 0.1 capacitor, and that delays the triggering of the TRIAC, too. The value of 470 ohm for this resistor could be reduced, too.
Take this 0.1 uF capacitor out of optocoupler's input, and use a resistor with the valua about 220 ohm or 330 ohm for connecting ATMega's D3 pin to MOC3021 input, and everything will be ok.
Answered by mguima on October 29, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP