[SOLVED] AC load control TRIAC directly with MCU without MOC Driver

Submitted by RAHAMANSA on Tue, 09/11/2018 - 18:49

HI,

all ur description aswell as topics are awesome.....nice...veryy

would u please let me kno how to controll ac 230v/50hz to turn on and off and dimming light bulb with triac bt136(D/E series). but without using any MOC to detect ZC and moc pin o/p portion.

pl suggest i am using 16f628a mcu

tnx

sa

Hi,

Why do want to drive a TRIAC without an MOC or any other isolation on the first hand? It really dangerous. That being said...

 

To Dim a light bulb in AC you cannot turn on and turn it off randomly or limit the current through it. You can to do something called Phase cutting or Phase control which as you might know requires you to detect the zero crossing section. Normally this is done through an MOC but for some reason if you are searching for alternative 

You can use an Op-Amp like 741 in comparator mode to detect zero, how ever this requires you to set-down the AC main voltage. You can also use dedicated Zero-cross detectors like 4N25.

 If you want to try something more interesting then have a look at Pulse skip modulation which does not require you to have a Zero Crossing detector at all. Reading the following link might help you understand better 

https://www.instructables.com/id/Arduino-controlled-light-dimmer-The-circuit/

  Joined August 16, 2016      998
Tuesday at 12:29 AM

hi sir,

Thnks for your support for the guidance.

Actually I have successfully implement on/off  and dim control with 16f628a with moc3021 and EL817, but due to space issues i need to truncate these mocs.

And I have seen some commercial product that where,

ZC-is detected with a resistor only and directly connected to mcu pin.

And sensitive gate triac(e): Gate at mcu o/p without opto.

to control on/off and dimming.

So could you suggest..

tnx

 

  Joined September 15, 2017      9
Friday at 10:08 PM

Yes there are some simple way to detect Zero crossing using a Microcontroller. But I think you should convert your AC wave into DC for all those methods. The commercial product that you are talking about did it have a half or full wave bridge rectifier? If yes then the following would have been the case

They should have used the external interrupt of the PIC to continuously monitor for zero voltage. The external pin should be connected to a rectified DC voltage through a potential divider or a transistor resistor arrangement. 

 

  Joined August 16, 2016      998
Tuesday at 12:29 AM

If you are not having enough space on your PCB for multiple MOCs. Then you can replace all the MOC with a single Op-Amp package like the LM324 and use the 4Op-Amps inside it as a comparator.

You can find details on how to use comparator for Zero Cross Detection here. http://www.ti.com/lit/an/snoa999/snoa999.pdf

Using a resistor of potential divider directly as suggest by aswinth is not a safe approach. An Isolation is always safe between your AC and Microcontroller part

  Joined August 11, 2018      35
Saturday at 01:52 PM

Hi John,

Yes I do accept that an isolation would be nice, but the OP requires to reduce the number of components on his circuit.

Also the Op-Amp comparator circuit cannot be used since the Op-Amp itself requires a Power circuit. Which will further increase the number of components on the circuit.

  Joined August 16, 2016      998
Tuesday at 12:29 AM

Hi Aswinth,

Yes, the op-amp requires a power circuit. But since the OP is using pic16F628A microcontroller, he should have already added a rectification and regulator circuit in his design to power the PIC with 5V. 

So it would not take more changes to power the op-amp as well 

  Joined August 11, 2018      35
Saturday at 01:52 PM

yes Raj, it is half bridge and can be referred that product like PICREF-4 https://www.edaboard.com/showthread.php?90468-(PICREF-4)-PICDIM-Lamp-Dimmer-for-the-PIC12C508 in page 10. hwre GP4 is used as zc connected directly with ac hot thru a resistor and triac G directly with GP2 thru a resistor only. 

I need implement this with 16f628a instead of 12c508.

As the details of written code is not obvious and not clear all to me so how do i start that...

tnx

 

 

  Joined September 15, 2017      9
Friday at 10:08 PM

Hi Rahman,

First thanks for sharing that interesting circuit. Almost all the details you need are given in the PDF here

http://ww1.microchip.com/downloads/en/AppNotes/40171a.pdf, Where are you getting confused. I am posting the circuit diagram again below for reference.

Capture.PNG

 

I am not sure if you are using the complete circuit or just a part of it. But let me assume that you are trying out the complete circuit. The following are the things that you must consider

1. The power supply is designed for 120V AC to 5V, so make sure you modify it for 220V AC also I am not sure how much current it can source so check if your circuit can live with that 

2. The AC hot wire is connected through 20M Resistor to a GPIO pin with ESD protection. Make sure your PIC also has a pin with ESD protection. Else create you own circuit 

1_0.PNG

As you see here the GPIO pin has ESD protection internally if you PIC does not support this then make your own circuit. Connecting it to a External interrupt pin will make it more easier in my opinion 

3. Use this external interrupt pin and program your PIC to detect for changes, if you are able to detect the zero crossing properly you should me able to roughly calculate the frequency this will make you confident with controlling the TRIAC. Once zero crossing is detect the rest should be easy.

 

Warning: BE very careful when working with this circuit. An Input AC fuse is recommended also use an Auto transformer to work and test your idea with lower voltages before actually working with Mains supply 

  Joined August 16, 2016      998
Tuesday at 12:29 AM

Hi Raj sir, Sorry in delay to responce...

Very thax for your good explanationsss...

I will be trying complete ckt with my MCU first for ON/OFF and then DIMMER

Yes ,there in 16f628a has RB0/INT Pin for External intp. with diodes protection.

---

I will be using that 2 button for ON/OFF and 600E SENSITIVE TRIAC with the modification of code written in data sheet.

For that  Please let me know, 1) how do I calculate timer value with  frequency 50hz to enter at main after configured of timer at 8BIT/ PS64.

Tnx..

 

  Joined September 15, 2017      9
Friday at 10:08 PM

Hi SA,

I am closing this thread since the issue is solved. Please post your other questions as a new topic.

 

Thanks

  Joined May 19, 2015      213
Tuesday at 03:45 PM