Remote Mains PWM


Closed Thread
Results 1 to 20 of 20
  1. #1
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697

    Default Remote Mains PWM

    Hi, Ive got a circuit that outputs a PWM signal. The PWM is synchronized with the AC sinewave and the signal is sent to a triac which controls a light that is plugged in elsewhere. The circuit cant seem to control the lights properly. If i simply turn them on and off then everything is fine but when using PWM the lights flash or dont turn on at all.

    Ive checked the circuit and ive checked the code. Everything seems to be fine but before wasting more time debugging it i want to check if what im doing is possible. The controller takes the sinewave input from the transformer that powers it. The controller and lights are plugged into different mains sockets but all in the same room of the house. Is it possible that the sinewave is offset at the different sockets? Normally i would supply the controller and lights from a single socket but its not possible in this case.

    Is it worth spending time checking out the circuit and code or will it simply not work in this way?

  2. #2
    Join Date
    Oct 2005
    Location
    Loveland CO USA
    Posts
    83


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by The Master View Post
    The controller and lights are plugged into different mains sockets but all in the same room of the house. Is it possible that the sinewave is offset at the different sockets?
    Likely there are two different phased in the same room. They should be 180 out. I thought 180 off will not upset a triac.

  3. #3
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    When you say "180" do you mean 180 degrees offset? That would normally be fine as the controller has 2 diodes and looks at the DC ripple and the triacs operate in AC anyway.

    By the way, all sockets in this room are on the same ringmain. The only difference is the length of wire between each socket and the consumer box

  4. #4
    Join Date
    Oct 2004
    Posts
    448


    Did you find this post helpful? Yes | No

    Default

    One issue I can see; if you are detecting the zero crossing referenced from the transfomer secondary, there is likely to be a slight phase difference.

    Also, is the objective of the circuit to adjust the intensity? If that is the case, why use PWM? That is likely cause a lot of trouble, and unlikely to work. All you need is a fixed pulse (say 200 uS); depending on how much after the zero crossing the pulse is given, the triac will control the bulb's intensity.

    Regards,

    Anand Dhuru

  5. #5
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    The phase difference from the transformer shouldnt cause a problem. Ive made circuits like these before but usually the circuit and the bulbs are powered using a single wire.

    The purpose of the PWM is so i can adjust the brightness of the lights from a PC

  6. #6
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,520


    Did you find this post helpful? Yes | No

    Default

    Hi,
    They should be 180 out. I thought 180 off will not upset a triac.

    I'm pretty sure there are three phases, shifted 120°, 230VAC between each phase and neutral and 400VAC from phase to phase in the UK. (At least that is what we have here) But please do correct me if I'm wrong!

    Anyway, if the outlet providing the reference (zero crossing) and the outlet actually providing the current to the load is not on the same phase it won't work properly because they are not "in phase" - obvioulsy.

    Can't you just, as a test, power the load from the same outlet as the control circuit just to see if it works or not.

    /Henrik.

  7. #7
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    I believe that is correct for 3-phase supplies. Our house runs on a single phase (only 2 wires into the entire house). All sockets are connected together on a ringmain.

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by The Master View Post
    Hi, Ive got a circuit that outputs a PWM signal. The PWM is synchronized with the AC sinewave and the signal is sent to a triac which controls a light that is plugged in elsewhere. The circuit cant seem to control the lights properly. If i simply turn them on and off then everything is fine but when using PWM the lights flash or dont turn on at all.
    ...snip....
    Is it worth spending time checking out the circuit and code or will it simply not work in this way?
    You cannot/shouldn't control a Triac via PWM. A triac once switched on, turns off only at the zero crossing. That could explain the fluttering instead of controlling. The proper approach would be phase-angle-firing the triac.

  9. #9
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    I am using "phase-angle-firing" but i just call it PWM since it is PWM that is synced with the zero crossing. Like i said, ive made these kind of circuits before. This circuit is actually based on the last one i made which still works perfectly (i even copied some of the code). The only difference is the last one had the triacs on the same PCB as the chip and transformer and this new circuit has the triacs seperate.

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


    Did you find this post helpful? Yes | No

    Default

    what kind of distance are we talking of between the driver and the triac? Are you seeing ground loop issues? False firing?

  11. #11
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    The controller and all of the lights are plugged into various sockets in the same room (its my kitchen so not very big).

    I dont think there should be any ground loop issues. I use opto isolators with each triac. The controller outputs about 5V into a wire that is about 3M long. That wire connectes through a diode and a resistor to the opto which then controls the triac.

    I dont get any false firing. When the controller says the lights are off then they stay off. If it turns them completely on then they stay on. I only see the problem when PWM is enabled. I even tried programming the PIC to set the state of the outputs to match the zero crossing and put the code in a tight loop. In this case i would expect all of the lights to be permenantly on (maybe very slightly dimmed) but they still flicker or dont turn on at all.

    Each output also has an LED. The LEDs are powered from the same transformer as the PIC and they appear to fade correctly

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


    Did you find this post helpful? Yes | No

    Default

    Can you put up a small sketch of what your setup looks like? It's a little hard to figure it out in text.

  13. #13
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Ive attached a basic diagram of the circuit. Everything on the left side of the line is the controller and everything on the right represents the seperate lights being controlled. The triacs are inside the light holders themselves. I have shown seperate AC inputs where things are plugged into seperate mains sockets. All of the mains sockets are in the same room on the same ringmain and are seperated by only a few metres of wire.

    Note: I dont have the symbol for a triac in this software so pretend the MOSFETs are triacs.
    Attached Images Attached Images  

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


    Did you find this post helpful? Yes | No

    Default

    I would remove the diodes from the inputs of the optos. Reason : when you turn off the drive to the opto from the pic, the input of the opto is now able to take in mains pickup due to the long wire run. This will cause it to trigger falsely. Give it a try. No diode.

    Other than that, I see no reason why your circuit will not work. I hope I'm not wrong

    Regards

  15. #15
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Im not having any trouble with false firing. This is the first time ive used the diodes in this kind of circuit. They are there to protect the optos incase the wires are connected incorrectly.

    If you cant see any other problems with it then ill assume i have a short or dry joint somewhere or the program isnt right. Ill have a look at them in a lot more detail. Thanks for your help.

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


    Did you find this post helpful? Yes | No

    Default

    You're welcome. Keep us posted with your results.

  17. #17
    Join Date
    Oct 2004
    Posts
    448


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by The Master View Post
    They are there to protect the optos incase the wires are connected incorrectly.
    With a 1K resistor in series with the pic output, I dont think you would damage the opto LED even if connected reverse. I'm not saying removing the diodes is a solution, just that I think they are redundant.

    Anand

  18. #18
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by ardhuru View Post
    With a 1K resistor in series with the pic output, I dont think you would damage the opto LED even if connected reverse. I'm not saying removing the diodes is a solution, just that I think they are redundant.

    Anand
    I thought that too. In previous circuits that use optos i once connected one the wrong way and it never worked after i corrected it. I dont know for sure that the reverse current caused it as i had never turned it on before wriring it the wrong way. It could easily have been damaged by overheating during soldering or it might have been a bad component when it arrived.

    The triacs/optos are inside the light holders and its very fiddly to replace them. I have thousands of diodes laying around and they cost almost nothing so its well worth including them just incase.

  19. #19
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,520


    Did you find this post helpful? Yes | No

    Default

    Hi,
    Figuring you have a MOC3020 opto-coupler the maximum reverse voltage according to the datasheet is 3V so it's possible it got damaged by connecting them backwards. But instead of having the diode in series like you have it now place it anti-parallell with the opto-coupler LED. Then it will clamp the reverse voltage to ~0.7V and the series resistor will limit the current.

    As you have it now..... Figuring 5V output from the PIC, 0.7V drop across your series diode, 1.15V drop across the LED we have 5-0.7-1.15=3.25V left across the 1k resistor. This yields a forward current thru the LED of 3.25mA. Although this should work as long as the "firing pulse" thru the LED is at least ~6us or so it just "feels" a bit low to me. Why not simply try with a 330ohm resistor or something?

    Now, if you have another optocoupler then obviosuly the above numbers may not be correct but it might be worth looking into it for your particular device then.

    /Henrik.

  20. #20
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    I dont remember exactly which optos im using. They have been in the lights since last year. I think they are MOC3020 or MOC3020X.

    You are right about it being a low voltage problem. The 1K resistors are fine. Ive used those in every mains PWM circuit ive made and they work fine. The resistors are also in the lights along with the diodes, optos and triacs. The problem is that for some reason i have more 1K resistors in the controller. I just tried shorting them out and the lights stopped flickering and started fading correctly.

    Ive been on and off this circuit for over a month now and it turns out to be something as simple as that :P

    Thanks a lot for helping me solve this!

Members who have read this thread : 1

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

Posting Permissions

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