Interrupts question


Closed Thread
Results 1 to 12 of 12

Hybrid View

  1. #1
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default Re: Interrupts question

    Another thing that spring to mind, are you expecting a low to high pulse on PORTB.1 or a high to low pulse?

    If you expect a LOW to HIGH, then you should clear PORTB.1 at the beginning of your code, and set it it you expect a High to low one.

    It's always a good idea to set the idle state of any PORT pin as the initial state might be unknown.
    Last edited by Archangel; - 11th August 2011 at 02:59.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  2. #2
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default Re: Interrupts question

    But if you simply want to monitor the AC line, then you don't really need interrupts. I'll attach a circuit that (I think) does what you want. The output is LOW whenever there is AC present. The capacitor keeps it from going high during zero-crossings.

    And - it has isolation.Name:  ACMonitor.jpg
Views: 3396
Size:  31.0 KB


    The circuit works for both 110V and 220V.
    Charles Linquist

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default Re: Interrupts question

    I tend to replace R140 & R141 with a simple capacitor... Xc, seems to work really well.

    Using the secondary winding of your transformer and design the power supply accordingly may works, but I got some weirdness with some transformer brands. There's sometime a unpredictable phase delay between the main and the secondary... and it screw the zero crossing big time
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default Re: Interrupts question

    I'm in agreement that a .47uF cap works well, but you still have to have some sort of resistor in series (1K or so), otherwise really short risetimes will blow the LEDs. I use resistors here because they are smaller than a 400V cap.

    RE: Transformers - I needed to measure the "quality" of the AC line. I thought I would use a cheap transformer. The transformer would power both my PIC and provide the low-voltage isolated signal to the PICs A/D.
    I realized that the peaks would be chopped off by the bridge rectifier as the voltage rose a diode drop higher than the main storage capacitor, so I put a 150 ohm resistor in series with the diode to "soften the blow". The
    PIC didn't take much current, anyway, so the extra drop of the resistor wasn't a problem.
    But I was mistaken! Even with the current limit, the waveform coming from the transformer was horribly distorted. I wound up using a (TAMURA brand) transformer that was about 6X as big (in current ability) than I needed, and one that had TWO separate secondaries. One secondary ran the PIC, and I used the other to measure the line. The "unloaded" secondary fed a bridge rectifier that had only a 680 ohm resistor as a load. That worked.
    Charles Linquist

  5. #5
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default Re: Interrupts question

    Good point and tips there. I thought about the dual winding for my application but I needed it really small to fit in an existing installation (kind of reverse engineering job), none of the dual secondary winding tranformer I found locally were small enough, the transformerless solution was REALLY not an option and everything was for...yesterday (yeah it happen ) ... so in the end I added a TLP2098 (if my memory serves me well) i had in stock, problem solved.

    If I had a toroidal one on hand, I would have try to wind a seconday on the top for testing purpose, maybe it would have work... or really not hahaha.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  6. #6
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default Re: Interrupts question

    I couldn't use an opto for my particular application because I needed to know the peak voltages of the AC waveform, cycle-by-cycle.
    Charles Linquist

  7. #7
    Join Date
    Feb 2005
    Location
    brookfield, ct, usa
    Posts
    24


    Did you find this post helpful? Yes | No

    Default Re: Interrupts question

    Hi All, and apologies for not getting back to you all sooner (damned work!!)
    I hate to admit this, but a wire had gotten disconnected on my bread board - amazing how much better a PIC works when it has a five volt supply...
    My zero crossing detector works great, and I'm getting a nice clean pulse train to my triac optocoupler. Now to go back to the code to make my kitchen heater controller - I'm making a sous vide controller for a crockpot..
    Thanks again for all the help - before I tear hair out again I'll make sure to check my hardware first...
    Alec

  8. #8
    Join Date
    Feb 2005
    Location
    brookfield, ct, usa
    Posts
    24


    Did you find this post helpful? Yes | No

    Default Re: Interrupts question

    BTW - I'm using a PS205-1 AC input photocoupler. Works great with a 10k 1 watt resistor in the input.
    Alec

Members who have read this thread : 0

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