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

Protection circuit for microcontroller

Discussion in 'Microcontrollers' started by Parth86, Mar 1, 2018.

  1. Parth86

    Parth86 Member

    Joined:
    Dec 25, 2011
    Messages:
    626
    Likes:
    6
    Location:
    Banglore India
    Is it possible to read 230 v AC signal using microcontroller without use of transformer. microontroller work only with 5V DC . If we give voltage more than 5V to the input of microcontroller, it will get damage permanently.

    Is it possible to read 230 v AC using any microcontr? How to read 230 AC signal without transformer ?
     
  2. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,710
    Likes:
    421
    Location:
    Brisbane Australia
    You can feed it into many μC pins via very high value resistors - typically 10MΩ. The pin needs protection diodes which are incorporated in pic pins but can be added if not incorporated. The signal on the pin is a 50/60Hz square wave that goes fron -0.7 to 5.7V.

    Mike.
    Google Pic zero crossing app note for more info.
    Edit, http://ww1.microchip.com/downloads/en/AppNotes/00521c.pdf
     
    • Like Like x 1
  3. Parth86

    Parth86 Member

    Joined:
    Dec 25, 2011
    Messages:
    626
    Likes:
    6
    Location:
    Banglore India
    Thanks Pommie We use resistor for voltage drop. Are you sure that this will work because working with AC is vary dangerous. Will the controller be safe
     
  4. dave miyares

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    2
    Likes:
    -10


     
  5. tumbleweed

    tumbleweed Active Member

    Joined:
    Jan 25, 2007
    Messages:
    135
    Likes:
    36
    In general, that can be a bad idea.

    For some of the reasons why check out microchip TB3009 http://ww1.microchip.com/downloads/en/AppNotes/93009A.pdf
    and TB3013 http://ww1.microchip.com/downloads/en/AppNotes/93013a.pdf

     
  6. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,619
    Likes:
    697
    Location:
    Derbyshire, UK
    ONLINE
    You're worrying needlessly, Microchip also have many application notes suggesting exactly this technique - the 'potential' problems the notes you posted suggested are just that, only 'potential', and VERY, VERY unlikely as well.
     
  7. tumbleweed

    tumbleweed Active Member

    Joined:
    Jan 25, 2007
    Messages:
    135
    Likes:
    36
    That doesn't make it a good idea.

    From microchip TB3013...
    Personally, I like to avoid the 'potential VERY, VERY unlikely' problems. You're free to do as you wish.
     
  8. dave miyares

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    2
    Likes:
    -10


     
  9. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,710
    Likes:
    421
    Location:
    Brisbane Australia
    I simply answered the question and even supplied an application note about it.

    Mike.
     
  10. dknguyen

    dknguyen Well-Known Member

    Joined:
    May 6, 2006
    Messages:
    7,545
    Likes:
    161
    You can use the same method with an optocoupler between the clamp and mcu if youre worried. Only works for zero crossing though. Not if youre trying to measure the value with an adc through a resistive divider because you know...optocoupler.

    I ALWAYS add on external clamp diodes and never rely on the internal ESD diodes for anything. Instead of a clamp diode to the positive rail and another to the negative rail, I like to use two antiparallel diodes to ground so the voltage is clamped at +/-0.7V in both directions and feeding it to a comparator. That keeps the input far from the rails. Seems safer to me than clamping it to just above above the rail but doing that lets you not need a comparator. And of course add a digital isolator like an opto if you're paranoid...which I am, so I do
     
    Last edited: Mar 1, 2018
  11. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    5,198
    Likes:
    159
    Location:
    morristown,tn
    It's not going to kill nothing the clamping diode are good enough to handle curent. It's so low it's not even a mill amp.
    I do it even one better I feed it to a npn that get's you a nice cross.

    Here a video where I first tested with a transformer I then set it up to do the same thing with line voltage.
    It worked great.
     
  12. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    5,198
    Likes:
    159
    Location:
    morristown,tn
    This kind of shows you that a 10 m Ohm would be more then good LOl
    This kind of like them you tube there telling peolpe how bad something is when there is a lack of understanding you tie the ground and read to the high side of the AC and its 240 volts.
    I seen one show they said 240 volts was on the usb It's not It was at 5 volts .

    The only way you have a problem is if you could plug it in backward But that can be fixed with the right plugs. you want grounds on the ground side.

    Back to this the diodes will clamp it at 5 volts to the uC rail so with a uC you'll not get 3 mA
    The meter was hooked to the hot side of the AC and reading taken to the ground of a 5 volt supply
    VDD and GND



    Just be careful Parth if you try this out make sure you hook it all up right before you power up.
     
    Last edited: Mar 2, 2018
  13. tumbleweed

    tumbleweed Active Member

    Joined:
    Jan 25, 2007
    Messages:
    135
    Likes:
    36
    Some excerpts from Microchip TB3013. Do with this what you will.
     
  14. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,619
    Likes:
    697
    Location:
    Derbyshire, UK
    ONLINE
    You mean picking and choosing bits to quote, with no context at all :D
     
  15. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    5,198
    Likes:
    159
    Location:
    morristown,tn
    Its each his own really
    Buddy setups kind of like reading the battery with Adc pin it be the same no mater what voltage the battery is at.

    Got have a voltage reference
     
    Last edited: Mar 2, 2018
  16. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    5,198
    Likes:
    159
    Location:
    morristown,tn
    Here I played with it a bit more the first video is 120 I'm toggling a led with it.
    The second one I'm delaying it for 100mS after carossing .


     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice