12F683 Light Dimmer Problem (SOLVED)


Closed Thread
Results 1 to 20 of 20

Hybrid View

  1. #1
    Join Date
    Jan 2008
    Location
    Pennsylvania
    Posts
    113

    Default 12F683 Light Dimmer Problem (SOLVED)

    Howdy.... I've been trying to get a light dimmer working now for about a week. I did a good bit of reading about using a triac and zero cross over detector prior to taking on this project but I'm stuck
    I believe I have all the correct code and can see on my scope things look good I'm including a picture.
    What we see here on the scope is the 120vac wave along with my trigger output based on getting triggered at the zero crossover point.

    Name:  scope.jpg
Views: 1569
Size:  31.1 KB

    I'm using INT on the 12F683 and on interrupt to detect the zero crossover from an H11AA1 and then triggering a pulse out for 1500 microseconds which you can see here. So far so good this looked great to me. I am feeding this pulse to an MOC3011M in turn using the MOC3011M to trigger the gate on a BT136/BT137 (I've tried both) however even though I am only feeding what looks like an "On" pulse for 1500 microseconds the bulb appears full on no matter what I do. The logic in the on interrupt routine is pretty basic for the time being.
    light=1
    pauseus 1500
    light=0

    I'm beginning to think that the triacs I have chosen. Any ideas what type of triac I should be using if someone out there has successfully gotten this to work. If anyone has any thoughts and/or would like to see my code and schematic if they think this will help I can upload those. I'm not sure if it is my programming or schematic since I am getting a good interrupt triggering pretty much dead on the zero crossing and in turn able to turn on an output for a period of time at that zero cross over point.
    Regards
    David

  2. #2
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    947


    Did you find this post helpful? Yes | No

    Default Re: 12F683 Light Dimmer Problem

    Try this way.

    1. The zero crossing is where the triac turns off.

    2. You need the period between 2 zero crossings to decide the time after the zero crossing you need to turn ON the triac

    3. Depending on the amount of power you need to output, you need to turn on the triac that much earlier than the zero crossing.

    The period is 10mS for a half period of 50Hz,
    if you need 50% power, you need to turn on your triac 5mS after the zero crossing.
    if you need 25% power, you will turn on the triac 10-2.5ms = 7.5mS after the zero crossing.
    for 10% power, you will turn on the triac 10-1mS = 9mS after the zero crossing.

    I hope I was able to communicate clearly without using a diagram.

    Cheers

  3. #3
    Join Date
    Jan 2008
    Location
    Pennsylvania
    Posts
    113


    Did you find this post helpful? Yes | No

    Default Re: 12F683 Light Dimmer Problem

    Chris, I believe I understand your explanation I picture the diagram perfectly in my head no need for it and it makes perfect sense now. Let me give that a go. I am running at 60hz so my half cycle time period would be 8.33mS
    So for half power I would turn on 4.16mS after zero crossing, 25% 6.25mS after zero crossing and 10% would be 7.49mS after zero crossing. Sound about right?
    Regards
    David

  4. #4


    Did you find this post helpful? Yes | No

    Default Re: 12F683 Light Dimmer Problem

    what are you using to vary the phase angle 0 to 8.3 ms after zero cross.... pot?

    are you also starting a timer at zero cross which triggers timer turnover interrupt that determines the delay 0 to 8.3ms for 0 to 100% phase?
    Last edited by amgen; - 3rd July 2020 at 01:02.

  5. #5
    Join Date
    Feb 2013
    Location
    Quebec, Canada
    Posts
    67


    Did you find this post helpful? Yes | No

    Default Re: 12F683 Light Dimmer Problem

    When a SCR is triggered it stays ON until the current drop to zero. TRIACs are 2 SCR doing a "69" to conduct both ways (AC).

  6. #6
    Join Date
    Jan 2008
    Location
    Pennsylvania
    Posts
    113


    Did you find this post helpful? Yes | No

    Default Re: 12F683 Light Dimmer Problem

    Hi guys got it to work. I am using an H11AA1 to detect the zero cross on the INT pin of the 12F673. From there I am using pauseus to hold the output pin off for x amount of microseconds. After the pause I turn on output pin which is driving an MOC3011 which in turn triggers the gate on the BT136. It is working quite well. I am not using a pot or anything to vary the delay. I want the light bulb to slowly brighten and then slowly dim for a lighthouse project.

    I will upload the program I did once I clean up all the commented code I left in there while I was working on this. (probably clean that up tomorrow) in the meantime here it is operating

  7. #7
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    947


    Did you find this post helpful? Yes | No

    Default Re: 12F683 Light Dimmer Problem

    Good work. Nice demo

  8. #8
    Join Date
    Jan 2008
    Location
    Pennsylvania
    Posts
    113


    Did you find this post helpful? Yes | No

    Default Re: 12F683 Light Dimmer Problem

    Thanks... sorry I called you Chris before I saw "Chris" instead of "Cheers" hahaha Anyway thanks.... I've got to clean up the code yet and draw up the schematic. Hopefully I will have some time later today to do that. Holiday weekend coming up so getting ready for that. I did add a little switch my father in law can switch and if he does the light will blink out "We love you dad" in morse code. I wanted it to say "Happy fathers day" but my wife vetoed that and said the latter. Bit late on fathers day I know but I got busy and had to order some of the components and they did not come in as fast as I needed them. I went back and reviewed some of the information I read about varying the phase and you are for sure right not sure how/why I got that backwards. Pretty cool little project does 60w lamp without getting warm using 1/2 watt resistors. I'm going to tweak those up to 1watt just in case. If you hold the 60w bulb on the on resistor gets just a tad warm but nothing you can't touch. 60w is going to be to bright for a little lighthouse but you never know with my father in law. I'll upload the code and schematic as soon as I have them done.

    P.S. the 12F683 was not that bad to work with getting the INT pin set up. Actually got it right the first time. I had been running at 8mhz but no need took it back down to default 4mhz. There was no need to go 8mhz and use any extra power on it. I'm trying to conserve all I can I want this to run with a https://www.mouser.com/ProductDetail/490-PBO-1-S5 by my calculations 200ma should be more than enough for this and the other components without getting anything warm. I did not put it on there yet but hopefully will get to that today and test it out. I need to make this simple for my father in law just plug and play without external wall wart.

    Regards
    David
    Last edited by DavyJones; - 3rd July 2020 at 12:10.

Similar Threads

  1. Light dimmer not working
    By Normnet in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 13th January 2013, 17:26
  2. Light dimmer problem
    By FromTheCockpit in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 9th July 2012, 12:36
  3. Replies: 12
    Last Post: - 15th May 2011, 23:06
  4. 12F683 GPIO.3 problem
    By ozarkshermit in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 30th October 2009, 08:43
  5. 50hz sync for light dimmer
    By tirithen in forum General
    Replies: 2
    Last Post: - 6th September 2008, 19:29

Members who have read this thread : 1

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts