Pwm with zero crossing detector

Discussion in 'Embedded Systems and Microcontrollers' started by nathomas, May 17, 2011.

  1. nathomas

    Thread Starter Member

    Mar 3, 2011
    82
    0
    I have a PIC18f13k50 and I need to control my heating element using the PIC. I understood that I can use an optocoupler and a triac. I am using a zero crossing detector MOC3061 and a triac. My question is whether I can use PWM to control the optocoupler? I understand that zero crossing is good for a resistive heating element. The heating element is a 110V AC. around 2A. If I cannot use the PWM to control the heater, any opinions on how I could use the PIC with the heater. Thanks.
     
  2. R!f@@

    AAC Fanatic!

    Apr 2, 2009
    8,754
    760
    PWM and triac does not work, meaning PWM cannot control AC, it works only for DC.

    You have to code it to control phase angle.

    Google it, there are plenty
     
    Last edited: May 18, 2011
  3. nathomas

    Thread Starter Member

    Mar 3, 2011
    82
    0
    When you say control phase angle, do you mean that I have to trigger the optocoupler and the triac after I realise the zero crossing of the ac power? So I have to produce pulse waves according to the zero crossing and then i can decide when I need to give a high output, ie if I should trigger every alternate zero crossing or every five zero crossings? Is my understanding right?
     
  4. R!f@@

    AAC Fanatic!

    Apr 2, 2009
    8,754
    760
    If you have a zero crossing opto then you do not have to worry about triac dive side

    All you have to do is turn on and off the Optocoupler.
    You have to sample the AC voltage angle by the pic and decide when to turn and turn off the opto to control the actual power transferred to the load.

    Read this to get a better idea on phase angle chopping.

    Actually you have no Idea on AC power control do u?
     
  5. nathomas

    Thread Starter Member

    Mar 3, 2011
    82
    0
    thanks..well its been a while..learnt it a long time ago...havent touched these things in like 6 yrs now..
     
  6. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,392
    1,605
    How precise do you need to control the heater? I have a very nice kitchen counter grill that the entire controller for the heating element consists of a bi-metallic strip and an eccentric cam as the temperature sensor and set-point adjustment. No electronics at all.

    What I mean is can you accept turning the power on for 5 seconds and off for 5 seconds when you want 50% of max power? Lots simpler then making a phase angle control.

    I used a very similar PIC as a DMX lighting dimmer, but as I connected the circuit in many ways to the AC line I'd violate the TOS to describe it here. Too bad.
     
  7. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    You can buy a "sold state relay" that has inbuilt zero-crossing switching, and can be controlled from a 5v logic signal (which is isolated from the mains).

    Then you can use a low freq PWM (a couple of Hz) from the PIC to control the solid state relay.
     
  8. nathomas

    Thread Starter Member

    Mar 3, 2011
    82
    0
    The controller has to be precise. I would need the controller to keep the temperature steady and that is why i am thinking of a pwm and PIC. i am using an rtd to measure the temperature. plus i need a digital display.
     
  9. Alberto

    Active Member

    Nov 7, 2008
    169
    36
    Since it is your intention to use a zero-crossing optodevice then you can use a low frequency PWM to drive your optotriac. Tray with 1hz and if necessary lower it till you achìeve the precision you need. A PID control is recommended if you need high precision.

    Cheers

    Alberto
     
  10. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,392
    1,605
    "Precise" in not a precise term. An acceptable error range expressed in percent or degrees is.

    The rate you change the power does not affect the precision of the setting. It does affect the instantaneous temperature; a shorter period in an on/off control has a lower variation between "just turned on" and "just turned off." Note that a cycle by cycle phase angle control is the fastest period PWM you can achieve, but may be an over design.

    Unless you have a very tiny mass to be controlled by a very powerful heater a simple on/off scheme should work.
     
  11. nathomas

    Thread Starter Member

    Mar 3, 2011
    82
    0
    My apologies for not being clear. I need a +-1degC precision for the heater. So will an on/off control do? And I have to control the heat of a medium sized manifold.
     
  12. nathomas

    Thread Starter Member

    Mar 3, 2011
    82
    0
    Thanks Alberto. Will try it and let you know the outcome.
     
  13. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    Those figures are quite reasonable for a 110v 2A heater element provided it has some decent thermal mass (like a hotplate, iron, frypan etc).

    I would just get the PIC to do on/off setpoint control and the zero-cross solid state relay will turn the heater on and off. If you get the sensor as close to the heater as possible it will probably cycle over a couple of seconds or less and the thermal mass of the plate will smooth that to generally much less than 1'C thermal ripple at the top of the plate.
     
    nathomas likes this.
Loading...