• AVR Freaks

AC line detection

Page: 12 > Showing page 1 of 2
Author
nidal
Super Member
  • Total Posts : 277
  • Reward points : 0
  • Joined: 2006/10/04 04:15:33
  • Location: 0
  • Status: offline
2007/01/23 11:56:59 (permalink)
0

AC line detection

Hi again
I am starting new project , that is : I have a 220v AC generator that feeds a shop, I want to detect normal AC line , incase if the normal AC line is off , I will send command to the generator to be turned ON.
The problem is , I need some ideas how to detect the AC line, I have one idea, that is using an AC relay , while the soleniod of the relay is connected to the AC line and the contact of the relay connected the pic to ground.incase the AC line is ON the relay will be closed and the PIC pin will be connected to ground , incase of AC line is OFF the relay will be open and the PIC pin will be pulled up to 5V, is that good practice?
any other ideas?
thank you
#1

24 Replies Related Threads

    DarioG
    Allmächtig.
    • Total Posts : 54081
    • Reward points : 0
    • Joined: 2006/02/25 08:58:22
    • Location: Oesterreich
    • Status: offline
    RE: AC line detection 2007/01/23 12:03:11 (permalink)
    0
    Hi, what you say can work. Only drawback is that a relay will always be "on", thus having some chances of failure over time (and also a little bit of power consumption).

    You could use a small transformer (say 5V), and feed this output into a PIC's pin via a resistor (or a rectifier bridge): you'll then be able to detect presence of 50 or 100Hz in software, and take appropriate action.

    If you don't mind having "less" isolation from the Mains, you could even use a bare 1MOhm resistor, straight from 220V to a PIC's input: it will work just the same.

    GENOVA :D :D ! GODO
    #2
    drh
    30+ years
    • Total Posts : 1054
    • Reward points : 0
    • Joined: 2004/07/12 11:43:22
    • Location: Hemet, Calif. USA
    • Status: offline
    RE: AC line detection 2007/01/23 13:07:49 (permalink)
    0
    Take a look at the Fairchild MID400.

    David
    #3
    sector
    Starting Member
    • Total Posts : 54
    • Reward points : 0
    • Joined: 2006/05/30 00:31:36
    • Status: offline
    RE: AC line detection 2007/01/23 13:38:07 (permalink)
    0
    Hi nidal,

    If I were you, I would consider DarioG's suggestion of interfacing to AC through a resistor.
    Microchip App Note AN521 describes the theory and the practical implementation, in a very clear and succinct way.

    Regards,
    S.
    #4
    chensong.chaw
    New Member
    • Total Posts : 13
    • Reward points : 0
    • Joined: 2007/01/17 02:29:55
    • Location: 0
    • Status: offline
    RE: AC line detection 2007/01/23 18:37:46 (permalink)
    0
    I can see that all the method work fine.
    Just a few question need to take note. wink
    1) If you use a relay (220Vac) why you need a pic to start a generator, which I think also AC?
    2) The 1M will be good too. It dont need other AC to step down. Note that most of the PIC can take this.
     
    chaw
    #5
    diegorestrepo
    Starting Member
    • Total Posts : 45
    • Reward points : 0
    • Joined: 2006/03/01 09:12:07
    • Location: Colombia
    • Status: offline
    RE: AC line detection 2007/01/24 06:44:10 (permalink)
    0
    ORIGINAL: chensong.chaw

    1) If you use a relay (220Vac) why you need a pic to start a generator, which I think also AC?


     
    If what wants to do is a transference control, because you need to start the generator immediately, but to deactivate it when normal energy AC is stable. In addition it needs to make the change between normal line AC and the generator, when voltage AC of the generator this stable one.
    #6
    paulbergsman
    Super Member
    • Total Posts : 1517
    • Reward points : 0
    • Joined: 2006/05/25 12:18:23
    • Location: Merion Station, Penna.
    • Status: offline
    RE: AC line detection 2007/01/24 06:56:36 (permalink)
    +2 (1)
    ORIGINAL: nidal

    Hi again
    I have one idea, that is using an AC relay , while the soleniod of the relay is connected to the AC line and the contact of the relay connected the pic to ground.incase the AC line is ON the relay will be closed and the PIC pin will be connected to ground , incase of AC line is OFF the relay will be open and the PIC pin will be pulled up to 5V, is that good practice?
    any other ideas?


    I would use a  Normally Closed relay.
    When the relay is "on", the pic gets no power.
    When the relay is "off", the pic gets power.

    I assume the PIC is battery powered.
    So, I would add a safety device.
    For better isolation, I would control a solid state relay with the mechanical relay.
    And then have the SSR secondary connect to the PIC.

    Remember, a solid state relay's output voltage is the maximum voltage.
    Most SSRs, with an output rated at 110 VAC, will work fine controlling a 12 volt, and many times 5 volt, AC circuit.

    Also, I would interface the PIC to the generator with a second solid state relay.


    post edited by paulbergsman - 2007/01/24 07:09:20

    Paul Bergsman, N3PSO


    For the most cost effective PIC prototyping board around:
    http://mysite.verizon.net/vzes94mj/picprototypingboard
    #7
    DSchabel
    Super Member
    • Total Posts : 1714
    • Reward points : 0
    • Joined: 2005/05/24 14:00:34
    • Location: Western NY State
    • Status: offline
    RE: AC line detection 2007/01/24 11:40:16 (permalink)
    0
    ORIGINAL: sector

    Hi nidal,

    If I were you, I would consider DarioG's suggestion of interfacing to AC through a resistor.
    Microchip App Note AN521 describes the theory and the practical implementation, in a very clear and succinct way.

    Regards,
    S.

    I wouldn't, at least not unless I was absolutely sure that you understood about electrical isolation from the mains and that this represents a serious electrocution threat. 
     
    The transformer idea seems good to me; just put a slight load on the output side and detect when the voltage has "gone away."  In fact, if you can get a 'wall-wort" DC power supply, the smallest you can find, to fit some type of connector to your mains, you can just detect the presence of this DC voltage. 
     
    Other than that, optically isolating the input would work fine; you just need to drop A LOT of power across a current-limiting resistor (remember, if you want to get 5-7mA, you'll waste about 220V * 0.007A = 1.54Watts. 
     
    So, the following circuit should work:
     
     

    Attached Image(s)

    #8
    yeaux
    Starting Member
    • Total Posts : 74
    • Reward points : 0
    • Joined: 2006/11/14 04:46:45
    • Status: offline
    RE: AC line detection 2007/01/24 18:03:14 (permalink)
    0
    I think personally it is a 'very bad idea' to bring in an unisolated line from the mains onto the board under any circumstance.
     
    this AN521 is eventually going to fry someone and Microchip is going to have to sell a *lot* more chips to satisfy that judgment.  I wish they would retract.
    #9
    DarioG
    Allmächtig.
    • Total Posts : 54081
    • Reward points : 0
    • Joined: 2006/02/25 08:58:22
    • Location: Oesterreich
    • Status: offline
    RE: AC line detection 2007/01/25 01:00:53 (permalink)
    0
    Well, most of light dimmers "embedded" into house wiring, are not isolated from mains, and do work (have been here for 20 years) with no troubles for user and loads...
    You just have to be careful that "the box" won't get opened/touched.

    GENOVA :D :D ! GODO
    #10
    DarioG
    Allmächtig.
    • Total Posts : 54081
    • Reward points : 0
    • Joined: 2006/02/25 08:58:22
    • Location: Oesterreich
    • Status: offline
    RE: AC line detection 2007/01/25 01:03:17 (permalink)
    0
    If you want to go "the optocoupler way", you could also use a capacitor in series (together with resistance).
    It will diminish voltage without dissipating power (due to its inner nature).

    GENOVA :D :D ! GODO
    #11
    bmac
    Senior Member
    • Total Posts : 143
    • Reward points : 0
    • Joined: 2005/03/22 07:34:40
    • Location: South Africa
    • Status: offline
    RE: AC line detection 2007/01/25 05:22:11 (permalink)
    0
    What I have done in a simular situation it worked like this:
     
    The unit works of 220Vac with battery backup for when the mains fail.
     
    I just monitor the charging voltage with a voltage divider to the battery to detect mains faluere.
    #12
    yeaux
    Starting Member
    • Total Posts : 74
    • Reward points : 0
    • Joined: 2006/11/14 04:46:45
    • Status: offline
    RE: AC line detection 2007/01/25 06:22:08 (permalink)
    0
    Dario: light dimmers "embedded" into house wiring

     
    i don't know Dario.. still sounds like a fast way to get your pacemaker reprogrammed.
     
    think i'd just spend a few pennies extra on an opamp and inductively couple.
     
     
    #13
    DarioG
    Allmächtig.
    • Total Posts : 54081
    • Reward points : 0
    • Joined: 2006/02/25 08:58:22
    • Location: Oesterreich
    • Status: offline
    RE: AC line detection 2007/01/25 06:45:16 (permalink)
    0
    ORIGINAL: yeaux
    Dario: light dimmers "embedded" into house wiring

    i don't know Dario.. still sounds like a fast way to get your pacemaker reprogrammed.


    Funny Smile
    Well, they actually are widespread in here. Just 3 wires, mains, & lamp control (other wire goes to mains too). User only sees a switch or a potentiometer: his distance from the live 220V is almost the same that it would be with a standard switch.

    Of course the object can fail: in which case it will burst inside the box into the wall... so... no harm anyway.

    Sure, if *we* are going to design something, and want to have different rules... let's use different approach!

    GENOVA :D :D ! GODO
    #14
    yeaux
    Starting Member
    • Total Posts : 74
    • Reward points : 0
    • Joined: 2006/11/14 04:46:45
    • Status: offline
    RE: AC line detection 2007/01/25 06:54:58 (permalink)
    0
    Dario:  they actually are widespread in here.

     
    ok.  if i ever get electricity here into the cave, i'll try one.
     
     
    #15
    DarioG
    Allmächtig.
    • Total Posts : 54081
    • Reward points : 0
    • Joined: 2006/02/25 08:58:22
    • Location: Oesterreich
    • Status: offline
    RE: AC line detection 2007/01/25 07:04:47 (permalink)
    0
    grin
    No, I mean that in Italy sometimes people buys the strangest things... just consider how many mobile phones we own... per person, including children wink

    GENOVA :D :D ! GODO
    #16
    janni
    Super Member
    • Total Posts : 398
    • Reward points : 0
    • Joined: 2006/04/11 08:25:54
    • Location: Wroclaw, Poland
    • Status: offline
    RE: AC line detection 2007/01/25 10:39:20 (permalink)
    0
    ORIGINAL: sector

    If I were you, I would consider DarioG's suggestion of interfacing to AC through a resistor.
    Microchip App Note AN521 describes the theory and the practical implementation, in a very clear and succinct way.

     
    And what you guys think about this opinion from Microchip knowledge base? http://support2.microchip.com/KBSearch/KB_Ticket.aspx?ID=Tt6UJ9A000SM5
     
    Clear warning against connecting any voltage outside Vss .. Vdd to inputs. I don't know how it is possible that the clamping diodes may survive only few microamps of continous current and at the same time form good ESD protection. I could agree that every static discharge will weaken them, but small continous current?
    #17
    ericgibbs
    Junior Member
    • Total Posts : 110
    • Reward points : 0
    • Joined: 2006/12/02 12:20:00
    • Location: Portsmouth U.K.
    • Status: offline
    RE: AC line detection 2007/01/25 11:56:20 (permalink)
    0
    hi nidal,
    Would it be correct to assume that you will have say, a rechargable battery powering your PIC pcb/etc, connected to a mains powered floating charger?.
    If so, then you can pick off from the 'charger' dc a resistor divider/zener voltage that could be used as a PIC input.
     
    I would always recommend, if you choose an alternative method , to have a low power mains isolated dc output, wall plug psu.
     
    As dario states, the capacitive mains coupled  to a bridge and fixed load resistor, is used in many domestic applications, BUT the units are
    normally enclosed. Examples are the domestic PIR/Light intruder systems, it drives an internal 24v relay to switch the light.
     
    Regards
    EricG
     
     
     
     
     
     
     
    #18
    Pepperysteve
    Super Member
    • Total Posts : 462
    • Reward points : 0
    • Joined: 2005/03/14 12:17:39
    • Location: Fresno,California
    • Status: offline
    RE: AC line detection 2007/01/25 12:49:32 (permalink)
    0
    HI nidal,

    Is there any disconnection between the AC line and the Generator, when the AC line is off and the Generator is running?

    2 concerns -

    1) don't want to supply power to the rest of the neighborhood.

    2) don't want generator dancing around the shop when AC line is restored.

    paulbergsman and bmac have hit on the other thing to consider- between the time of AC line loss and the Generator is brought on-line, there is no power to your detection circuit other than the stored chage in the DC power supply cap. The cap has to be large enough to operate the circuit, drive a relay until AC power is restored. Or use a backup battery as they have suggested.  Or perhaps use a latching relay to start the generator.

    I certainly second DSchabel's suggestion for an AC detection circuit.

    Steve

     


     
    #19
    drh
    30+ years
    • Total Posts : 1054
    • Reward points : 0
    • Joined: 2004/07/12 11:43:22
    • Location: Hemet, Calif. USA
    • Status: offline
    RE: AC line detection 2007/01/26 08:22:35 (permalink)
    0
    What about my suggestion for the MID400, an AC detection chip?

    David
    #20
    Page: 12 > Showing page 1 of 2
    Jump to:
    © 2019 APG vNext Commercial Version 4.5