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

RAHAMANSA's picture

Offline

Joined: Sep 15, 2017

Replies: 9
[SOLVED] AC load control TRIAC directly with MCU without MOC Driver
September 11, 2018 - 6:49pm

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

Aswinth Raj's picture

Offline

Joined: Aug 16, 2016

Replies: 778
Driving AC without Isolation is not recommended
September 11, 2018 - 7:15pm

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/

RAHAMANSA's picture

Offline

Joined: Sep 15, 2017

Replies: 9
hi sir,
September 11, 2018 - 9:48pm

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

 

Aswinth Raj's picture

Offline

Joined: Aug 16, 2016

Replies: 778
Simple and Crude Zero Cross detector using Microcontroller
September 12, 2018 - 10:10am

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. 

 

John_Kripto's picture

Offline

Joined: Aug 11, 2018

Replies: 7
Use Op-Amp comparator for Zero Cross Detection
September 12, 2018 - 10:15am

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

Aswinth Raj's picture

Offline

Joined: Aug 16, 2016

Replies: 778
Op-Amp requires power circuit
September 12, 2018 - 10:19am

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.

John_Kripto's picture

Offline

Joined: Aug 11, 2018

Replies: 7
The PIC requires a power circuit as well
September 12, 2018 - 10:23am

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 

RAHAMANSA's picture

Offline

Joined: Sep 15, 2017

Replies: 9
yes Raj, it is half bridge
September 12, 2018 - 1:36pm

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

 

 

Aswinth Raj's picture

Offline

Joined: Aug 16, 2016

Replies: 778
Interesting circuit
September 13, 2018 - 11:08am

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 

RAHAMANSA's picture

Offline

Joined: Sep 15, 2017

Replies: 9
Hi Raj sir, Sorry in delay to
September 15, 2018 - 2:41pm

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..

 

Jayant's picture

Offline

Joined: May 19, 2015

Replies: 166
Topic Solved
September 18, 2018 - 11:57am

Hi SA,

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

 

Thanks

Topic locked