Dimmer and correct circuit

I just wanted to ask whether or not this is a good circuit for an MCU controlled triac dimmer. I am very unsure about the optimum values for R2 and R3. Right now they are very high, so I think you could actually short the load pins without problems. I consider adding a thermal fuse as well, but where would I place it, and what value should it have? Are there any other obvious issues here or something that I should improve upon? Mains here are 230 AC 60 Hz.

Those 250k resistors are in the wrong place. They should connect to an opto that provides the zero crossing signal.

Lots of working circuits on Google. Frequency is not really important for the circuit (it is for your programming of course), voltage is for proper current limiting for your zero detector.

Without zero crossing the best you can do is on/off.

That said, if you don't know what you're doing don't mess with line voltages. It can cause fire, explosions, and death by electrocution. There are lots of light dimmer modules out there that you can buy and just connect to your Arduino. Much safer that way (you still have to be careful to not touch the dimmer when in use, best to place it in an enclosure).

The opto is on the drawing (MOC3020). It has an inbuilt zero crossing circuit. As for the voltage you mentioned; i know that, hence R1 before the opto.

the datasheet doesn't mention this. So I don't think it does, and even if it did, you didn't connect it back to your Arduino. Without zero crossing signal your Arduino doesn't know when to fire the opto (and with it the triac).

I see. I can switch it with a MOC3041. As far as I understand, the zero-crossing circuitry inside the MOC3041 only activates the internal triac on zero-crossing. So, if a signal goes in, it won't activate the triac before the signal crosses. Or am I wrong?

You're wrong. Completely.

Even if it worked like that, you would have NO control whatsoever.

This is how it's done.

PelleS:
I just wanted to ask whether or not this is a good circuit for an MCU controlled triac dimmer. I am very unsure about the optimum values for R2 and R3. Right now they are very high, so I think you could actually short the load pins without problems. I consider adding a thermal fuse as well, but where would I place it, and what value should it have? Are there any other obvious issues here or something that I should improve upon? Mains here are 230 AC 60 Hz.

Your triac is across the AC mains, it will explode with considerable violence and take several fuses with it.

MarkT:
Your triac is across the AC mains, it will explode with considerable violence and take several fuses with it.

On almost all circuits I've seen on triac dimmers, they have been wired like this (like here: https://www.instructables.com/id/Arduino-controlled-light-dimmer-The-circuit/). And I've done several spice simulations. I must have seriously misunderstood then.

Edit: I've probably been a little quick with the connectors to the mains and load on the right, I think. I might have gotten them switched. Can this be the issue? Just been struggling a little with placing them because I'm learninig the software. So, if that might be the reason, please let me know.

I attached an image of my circuit in LTspice. The load is R4. If this is not about the same circuitry, then I just made a mistake in the other software.

Edit: ofc a resistor in series with the load (forgot to add in LTspice).

circuit 2.png

PelleS:
On almost all circuits I've seen on triac dimmers, they have been wired like this (like here: https://www.instructables.com/id/Arduino-controlled-light-dimmer-The-circuit/). And I've done several spice simulations. I must have seriously misunderstood then.

The circuit in that post looks good at a first glance.

It has little resemblance to your circuit. Do note the second optocoupler for a start (for the zero crossing) and how the triac is wired very differently.

wvmarle:
The circuit in that post looks good at a first glance.

It has little resemblance to your circuit. Do note the second optocoupler for a start (for the zero crossing) and how the triac is wired very differently.

I can only see one optocoupler at any circuit in that article.

According to LTspice, there is just about 1.2 mA peak current through the triac in the second circuit I posted. I don't think that is too much, or is it?

That's because you have a 300k resistor where your load should go. A halfway decent triac can do a few amps at least.

wvmarle:
That's because you have a 300k resistor where your load should go. A halfway decent triac can do a few amps at least.

Will the circuit be correct if I increase the resistor to the opto? 20k, for instance?

No.

Did you actually read (and make sure you understand the circuit in) the tutorial I linked to? Or one of the thousands of other tutorials about the subject...

wvmarle:
No.

Did you actually read (and make sure you understand the circuit in) the tutorial I linked to? Or one of the thousands of other tutorials about the subject...

Yes, I read it very thoroughly. I didn't mean to offend you. I am sorry.

Your circuits don't make sense. It's not even a copy of what's posted in that tutorial.
That particular resistor is where normally your load would be.

wvmarle:
Your circuits don't make sense. It's not even a copy of what's posted in that tutorial.
That particular resistor is where normally your load would be.

Maybe we are talking about different things. The resistor that's where the load would be, I put it there in order to simulate the load in LTspice. So it is the load.

Could someone please take a look at the image I attached. Without the ZC, what is the difference between this and the circuit in the page I linked to? I really can't see it. Maybe I'm just too stupid for this.

Hi,
What load do you want to switch with the Triac?

Thanks.. Tom.. :slight_smile: