Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[PIC] AC on/off control with triac directly with mcu without opto

Status
Not open for further replies.

saramah

Member level 3
Member level 3
Joined
Apr 25, 2018
Messages
64
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Activity points
689
i need code for ac on/off control without opto to detect zc and and to control triac for on/off in xc8 pic16f628a
can ny body let me kno with some code how do i implement that....
tnx
 

Hi,

Do you know how to switch a microcontroller port pin HIGH and LOW?
* If yes: That's it.
* If no: I recommend to learn it.

Klaus
 

Driving a PIC pin high or low is all it takes but be aware of the problems of isolation and gate polarity. Without an opto-isolator, or maybe a pulse transformer, you have to connect the PIC VSS directly to one side of the AC. That makes it almost impossible to interface to anything else unless it too is tied to one of the AC lines. It can be extremely dangerous if there is any chance of human contact with the PIC or you try to interface to anything else. The other advantage of an opto is if you use one with ZCD (MOC304x for example) you don't have to worry about zero crossing, it does it for you.

Brian.
 

Capture.PNG
This has been seen a AN of Microchip.
Would u tell me how do i go forward, how maintain Gate polarity if u get me details.
tnx for advice
 

Hi,

Now it is different:
* before you talk about ON/OFF control
* now it is "dim" and "bright"

What do you mean with "maintain Gate polarity"?

The function is as simple as can be:
* Port pin = HIGH --> triac will trigger
* Port pin = LOW --> triac will release

Give (the link to) the document you refer to.

Klaus
 

Actually would like FIRST with the ckt above with MCU16f628A in liew of MCU12c508>> to control ON/OFF(single button) using 230v/50hz.
What I have understand, as document ckt is operating at 120/60hz, so value of resistor for zc need to be change>>but what would be that for my operating volt, calculation is expected??
After that if i able to success, then go forward for next>>ie, dimmer and operation will like one for BRT and for DIM button and this two only operate if above "single button" is ON.

lINK IS HERE:
https://ww1.microchip.com/downloads/en/AppNotes/40171a.pdf

req ur help please ??
tnx
 

The resistor at GP4 isn't critical, all it does is limit the current to the PIC internal clamp diodes to a safe level. I would suggest if you use 230V that you increase it to 30M but using three 10M resistors in series as a single resistor may not be rated to high enough voltage.

You can use any PIC, the software changes are negligible but the different AC frequency means you have to select a different delay so the triac fires slightly longer after zero crossing. The dimming is achieved by firing through the whole AC cycle or through part of it only. It will be dimmer as the firing point is later after zero crossing so any values calculated for a 16mS (60Hz) AC will need to be bigger for 20mS (50Hz) cycle periods. The delay calculation will depend on the clock speed of the 16F628A.

Brian.
 

But why getting burnt..
As per my opinion calculated current 8uA to the pin as extracted by ohms low, i=240/30M = 8uA, and power rating (8*8*30) uWatt. SO, 1/4 watt of 30M is sufficient. But Why getting burnt on power up??
Thnx
 

Hi,

Hard to follow your thoughts:
* First you want code --> then you refer to a AN that includes code
* then you want ON/OFF control --> then it seems you want dimming
* Then you say something that got burnt.... but you don´t show it.

--> I can only gues that you talk about R3. (but maybe the microcntroller burnt or the triac or anything else... --> give useful and complete infromations)
* The AN discusses about it´s function and rating
* if you keep on the AN the resistor will not burn.
* If your resistor burns, then it´s not the probelm of the schematic and not the problem of the AN
--> the problem is your circuit.. Thus you have to show us your circuit, if you need help. (photo of your circuit, datasheets of the used resistor...)

***
as already explained:
as a single resistor may not be rated to high enough voltage
.. but you talk about power rating...

Klaus
 

What is burning?

Your calculation is correct, the current is actually 7.667uA and the resistor only dissipates 1.763mW if you assume the RMS voltage as 230V. The problem is that most 1/4W resistors are not rated to high voltage, some are rated to less then 50V and few are rated to as much as 230V. Bear in mind that 230V RMS has a peak voltage of 325V and the resistor(s) have to be rated at a higher voltage than that. Using three standard 1/4W resistors in series should be safe.

Brian.
 

tnx.
could u please send me a link where i can get 400v/250v resistor. I have googled but not able to right one. they are not mentioning any voltage level..
Tnx.
 

Hi,

they are not mentioning any voltage level.
Every resistor datasheet mentiones the voltage.

Klaus
 

If in doubt, do as I suggested earlier and use several resistors in series. If you make each one 10M and use three in series, each will only have 1/3 of the voltage across it. Klaus is quite right though, all respectable suppliers will tell you the rated voltage. For axial resistors it is typically 250V and for SMD it ranges from about 50 to 200V but note that those are MAXIMUM voltages before damage and you need to rate against the peak AC voltages, not the RMS ones in your design. That means you should aim for at least 1.42 times the RMS voltage to be sure and then add a safety margin as well.

Brian.
 

Test attached dimmer simulation and tell whether that is what you need.

Any button long press for 3 or more seconds and release = Triac ON/OFF
INC button short press (less than 3 sec) = Firing Angle Increment
DEC button short press (less than 3 sec) = Firing Angle Decrement

I forgot to add MOV. Add am MOV across the mains input. 275 Vrms type.
 

Attachments

  • Dimmer Test Files.rar
    47.6 KB · Views: 156
  • SS1.png
    SS1.png
    126.3 KB · Views: 223
Last edited:

    dattlara76

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top