Detect 240V with a PIC


Closed Thread
Results 1 to 40 of 49

Hybrid View

  1. #1
    Join Date
    Dec 2005
    Posts
    1,073


    Did you find this post helpful? Yes | No

    Default

    Most PIC pins have clamping diodes so (assuming you are using a pin with these diodes) you can connect it directly using a 10M resistor to limit the current.

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


    Did you find this post helpful? Yes | No

    Default

    Thats good. I need to order some more stuff from Rapid soon so ill add some of those resistors to the order. As its 240V i think i will still use an isolator just to be on the safe side.

    Thanx

  3. #3
    Join Date
    Dec 2005
    Posts
    1,073


    Did you find this post helpful? Yes | No

    Default

    In that case you won't need 10M resistors. Here's a circuit you can modify for your app...

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Question Are those LEDs actually LEDs or what?

    Quote Originally Posted by dhouston View Post
    Look at the LEDs on page 77 of that document
    Must've been an off day for the editors...

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


    Did you find this post helpful? Yes | No

    Default

    The circuit diagram in the PDF looks good. Nice and simple.

    How do i know what value resistors to use? Do i stick with 130K as shown in the diagram? I would have thought it varies for each type of optoisolator. I tried to calculate it based on the maths from a site macrakit linked to Designing LED lighting. I worked out that for my opto isolator the resistors should be 3K975. I think ive gone wrong somewhere because i wouldnt have thought it would vary that much. Im using a MOC3020M.

    I take it the diode is just to stop reverse voltage going into the optoisolator. Would it work the same if it was in series with it?

    I think im missing some of the document. skimask mentioned page 77 but all i see is a single page with a short writeup and a link to a PDF file. I dont see any kind of navigation for multiple pages either

  6. #6
    Join Date
    Dec 2005
    Posts
    1,073


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by The Master View Post
    How do i know what value resistors to use?
    Look at the datasheet for your optoisolator - there's an Absolute Maximum Ratings section with an entry for Continuous Forward Current. Ignoring the forward voltage drop of the LED, you need about 4000 ohms total for 60mA @ 240V. The lower values in the example probably factor in the forward voltage drop. In this case, you want the current to be near the max to improve the coupling. If using the PIC pin directly you can limit the current to much lower levels, hence the larger resistor I recommended.

    I take it the diode is just to stop reverse voltage going into the optoisolator. Would it work the same if it was in series with it?
    I would stay with the example or use an optoisolator designed for AC.

    I think im missing some of the document. skimask mentioned page 77 but all i see is a single page with a short writeup and a link to a PDF file. I dont see any kind of navigation for multiple pages either
    I don't see it either.

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


    Did you find this post helpful? Yes | No

    Default

    About 4,000 ohms is what i got. 3,975 taking into account the voltage drop of the opto. The confusion is because the example shows 130K resistors. Together thats 260,000 ohms. I work that out to be a voltage drop of 15,600 (i think)

  8. #8
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by The Master View Post
    The circuit diagram in the PDF looks good. Nice and simple.
    Nice....except it'll never work!!!

    I think im missing some of the document. skimask mentioned page 77 but all i see is a single page with a short writeup and a link to a PDF file. I dont see any kind of navigation for multiple pages either
    That page 77 doesn't have Page 77 marked on it, but it is between page 76 and page 78.

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


    Did you find this post helpful? Yes | No

    Default

    Why wont that circuit work?

    I dont get the page 77 thing. I only see 3 paragraphs on that page.

    Maybe i should just go with the direct to PIC chip idea. The only problem i have there is that i will be fiddling with this a lot and i have a habit of forgetting to turn the power off first (Ouch :P)

Similar Threads

  1. SMS via pic
    By kenandere in forum GSM
    Replies: 15
    Last Post: - 10th March 2010, 10:00
  2. Detecting 240V with a PIC (Part2)
    By The Master in forum Off Topic
    Replies: 7
    Last Post: - 18th March 2009, 19:10
  3. pic to pic ir link versus wired link : help please anyone
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 30th May 2008, 21:01
  4. Serial Pic to Pic using HSER
    By Chadhammer in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 11th March 2005, 23:14
  5. pic detect amperage
    By jetpr in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 11th February 2005, 05:02

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