1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

How to Detect Exceed AC Voltage

Discussion in 'Microcontrollers' started by Suraj143, Oct 28, 2008.

  1. Suraj143

    Suraj143 Active Member

    Joined:
    Jan 11, 2007
    Messages:
    1,586
    Likes:
    2
    Location:
    South Mald Isld
    My mains voltage is 230V AC/50Hz.

    I need to turn on a LED when main voltage goes to 240V.

    How to do that? What method should I use?
     
  2. Leftyretro

    Leftyretro New Member

    Joined:
    Mar 11, 2007
    Messages:
    1,420
    Likes:
    13
    Location:
    Hercules, California
    Look at:

    Electronic Design Welcome

    You would first have to rectify and filter your incoming AC as the application circuit is designed for monitoring DC voltages.
    Lefty
     
  3. Suraj143

    Suraj143 Active Member

    Joined:
    Jan 11, 2007
    Messages:
    1,586
    Likes:
    2
    Location:
    South Mald Isld
    Hello Lefty thanks for your help.

    I want to do this from a PIC with a minimum of hardware.

    That Application uses different chip which is unavailable.
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. Willbe

    Willbe New Member

    Joined:
    Aug 16, 2008
    Messages:
    1,236
    Likes:
    7
    Location:
    MD

    If a neon lamp fires at ~62v and wants less than 1mA passing through it, make a voltage divider across the 240v with an ~11k 4w and a ~4.3k 2w resistor and connect one end of the neon to the resistor junction and ground the other end.
    220vac gives about 60v across the neon, 240vac gives about 65v @ 1mA.
     
    Last edited: Oct 28, 2008
  6. Suraj143

    Suraj143 Active Member

    Joined:
    Jan 11, 2007
    Messages:
    1,586
    Likes:
    2
    Location:
    South Mald Isld
    You got it.Actually I want to detect 220VAC & 240VAC.

    When it 220VAC must turn on GREEN LED.
    When it 240VAC must turn on RED LED.

    I have done PIC ADC with DC voltages (0V-5V DC).But when it comes to 230VAC I don't know the theory how to scale the inputs & mehtod to use.
     
  7. Suraj143

    Suraj143 Active Member

    Joined:
    Jan 11, 2007
    Messages:
    1,586
    Likes:
    2
    Location:
    South Mald Isld
    Ok this is the method I'm going to use.

    I'll use a 230V/6V transformer & give AD input via a resister divider (divide by2).

    Code (text):

    230/6V      = 8.484 (smoothed DC)
            = 4.242V---216 (8 bit read val)

    240/6.26V   = 8.852 (smoothed DC)
            = 4.42V----225 (8 bit read val)

    220/5.7V    = 8.115 (smoothed DC)
            = 4.05V----206 (8 bit read val)
     
  8. mdorian

    mdorian Member

    Joined:
    Oct 17, 2008
    Messages:
    64
    Likes:
    0
    Location:
    Romania
    You will need a load or else the response for voltage dropping from 240 to 220 will be to slow.
    A faster way is to use the two comparators (most pics have two comparators) with two different reference voltages. Both comparators inputs the divided ac voltage. All you need is is to measure the time from first comparator going high and second comparator going high.
    AC.JPG
     
    Last edited: Oct 29, 2008
  9. Suraj143

    Suraj143 Active Member

    Joined:
    Jan 11, 2007
    Messages:
    1,586
    Likes:
    2
    Location:
    South Mald Isld
    Hi this project is to verify the mains voltage has gone up or low.

    Not going to connect any load.The voltage drop happening from the surrounding area or from the road transformers.Not from this project load.
     
  10. mdorian

    mdorian Member

    Joined:
    Oct 17, 2008
    Messages:
    64
    Likes:
    0
    Location:
    Romania
    Yes , but if you use a rectifier and a capacitor or something like that, when ac voltage drops from 240 to 220 the capacitor Will remain charged if you don't have a load for it .
     
    Last edited: Oct 29, 2008
  11. Suraj143

    Suraj143 Active Member

    Joined:
    Jan 11, 2007
    Messages:
    1,586
    Likes:
    2
    Location:
    South Mald Isld
    Hi mdorian

    Now I got what you mean.Your comparator thing is ok but its hard for me bcuz never used comparators before & also this 8 pin PIC have only one comparator I think (PIC12F675).

    About my method to make it speed what do I have to do?What load do I have to add?
     
  12. mdorian

    mdorian Member

    Joined:
    Oct 17, 2008
    Messages:
    64
    Likes:
    0
    Location:
    Romania
    Assume that you want a 10% error , you have 20 v between 220 and 240 so the error is less than 2V , your voltage smoothener must ensure that the voltage between two semi periods doesn't drop more than 2V. So the response time is 10ms*20v/2v = 100ms. I assumed that the ac freq is 50 Hz so a semi period is 10 ms. The things get worst if you don't have a with exactly like that (2v ripple voltage) , if you have a better smoothener (let's say 0,2v ripple voltage) you will have a response time of 10* 100ms = 1 s, if you don't use a good one (let's say 5v ripple voltage) you will have an error of 20v/5v ->25%
     
  13. Suraj143

    Suraj143 Active Member

    Joined:
    Jan 11, 2007
    Messages:
    1,586
    Likes:
    2
    Location:
    South Mald Isld
    Hi thanks for the explanation.

    So everything based on that smoothing capacitor.I should maintain 2V ripple.I cant use higher value capacitors because its extending the response time.

    What is this calculation "10ms*20v/2v = 100ms."

    Just now I noticed 6V transformer is not enough because for the 7805 its not enough.IF I use a 9V transformer after smoothed it will become more.So again I have to scale to AD input.

    Plenty of problems.
     
    Last edited: Oct 29, 2008
  14. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,240
    Likes:
    645
    Location:
    Ex Yorks' Hants UK
    ONLINE
    hi Suraj,
    Can you buy LM393's [dual comparator] at your location.?:)
     
  15. Suraj143

    Suraj143 Active Member

    Joined:
    Jan 11, 2007
    Messages:
    1,586
    Likes:
    2
    Location:
    South Mald Isld
    Yes eric gibbs I can buy.Also it must use with PIC12F675.
     
  16. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,240
    Likes:
    645
    Location:
    Ex Yorks' Hants UK
    ONLINE
    Understood.

    You say that you are short on PIC pins.?

    Use an external LM393 as a comparator to compare the mains low voltage against a reference voltage.
    The output of the comp would be low for less than 240V [this could drive a Green LED] and high for 240V or greater [drive Red LED].

    Or use the PIC to drive the LED's.

    Just poll the comp output.

    LM393 are not expensive.
     
    Last edited: Oct 29, 2008
  17. Suraj143

    Suraj143 Active Member

    Joined:
    Jan 11, 2007
    Messages:
    1,586
    Likes:
    2
    Location:
    South Mald Isld
    Hello eric gibbs that will be fine but I don't know how to calculate the comparator references & AC inputs to the comparator against 230V AC.
     
  18. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,240
    Likes:
    645
    Location:
    Ex Yorks' Hants UK
    ONLINE
    hi,
    If you decide to use that method, we will help with the sums.

    You could use the on PIC comparator if required.
     
  19. Suraj143

    Suraj143 Active Member

    Joined:
    Jan 11, 2007
    Messages:
    1,586
    Likes:
    2
    Location:
    South Mald Isld
    Hello eric gibbs I like to do with built in comparator in the PIC.I'm in a such a hurry to do this with a PIC.
     
  20. mdorian

    mdorian Member

    Joined:
    Oct 17, 2008
    Messages:
    64
    Likes:
    0
    Location:
    Romania
    The adc is fast enough to sample the ac voltage.
    you can use something something like that:
    variable MAXvoltage = 0
    start:
    if AdcResult> maxvoltage then maxvoltage = adcresult
    if adcresult > 0 then goto start

    compare maxvoltage with calculated value for 220v and 240v and set the LEDs accordingly

    wait for adcresult > 0
    maxvoltage = adcresult
    goto start
     
    Last edited: Oct 29, 2008
  21. mdorian

    mdorian Member

    Joined:
    Oct 17, 2008
    Messages:
    64
    Likes:
    0
    Location:
    Romania
    Is not a good idea to use the same transformer to power supply and measurement , it will distort the measurement.
     

Share This Page