AVR Zero Cross Detection and AC dimmer

Go To Last Post
60 posts / 0 new

Pages

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It may be 'working' but there are a few problems to sort out. You have no filtering on the zx signal, you have no inductor on the output of your triac and 10k seems way too high for the triac gate. Refer to the datasheet for the opto.

In terms of safety, you need to understand insulation and current carrying capacity. There are standards and tables for this. If you have looked at the pcb of a commercial product, the high and low voltages are clearly separated , normally by at least 6mm and there are slots cut into the pcb. The thickness of the pcb tracks determine how much current can flow without getting too hot. Fuses are to protect the wire, not the electronics. You also need to consider how hot your triac will get and the voltage rating of your components.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
//Posted: Aug 17, 2014 - 09:25 PM
int main(void) 
{ 
   DDRD = 1<<PD2;      // Set PD2 as input (Using for interupt INT0)  

You were already warned that this sets PD2(INT0) as output.
But you do not care.

Right is:

DDRD &= ~(1<<PD2); //clear bit DDRD.2
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Visovian wrote:

//Posted: Aug 17, 2014 - 09:25 PM
int main(void) 
{ 
   DDRD = 1<<PD2;      // Set PD2 as input (Using for interupt INT0)  

You were already warned that this sets PD2(INT0) as output.
But you do not care.

Right is:

DDRD &= ~(1<<PD2); //clear bit DDRD.2

but it is not working for me. i have also connected 1k pull-up to INT0 but still didn't work, it worked when i set ddrd high, it set pull-up internally what datasheet says. I dont know what to do?

Taher Kawantwala

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

tahertinu wrote:
it worked when i set ddrd high, it set pull-up internally what datasheet says.
That is not what the datasheet says.

 

To enable the pull-up, you configure the pin for input by writing '0' to the appropriate bit in DDRx, and writing a '1' to the appropriate bit in PORTx.

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"Read a lot.  Write a lot."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

Well, I have forgotten this:

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am not able to tun the int0 pin without pulling high internally

DDRD &= ~(1<<PD2);
PORTD |= (1<<PD2);   //pull-up internally.

please show me tha way without making internally pull up and working as a normal interrupt with INT0 for Zero crossing.

Taher Kawantwala

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Your pin configuration looks correct.

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

After almost 3 years I'm commenting on my own question here. In this 3 years i have learned so much in electronics and PCB Designing, still more to learn in future. I felt that i must give a conclusion to this question and close it. I have developed Dimmer circuit successfully for my Product. I have gone through so many iteration for that. the most recent circuit contains few components i.e. controller, Opto-couplers, resistors and Capacitors. Thanks everyone for the fruitful discussion here.

Taher Kawantwala

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OK. So how about showing the circuit diagram of your solution? Gratitude should not cost too much.

 

Ross McKenzie ValuSoft Melbourne Australia

Pages