Detect 240V with a PIC


Closed Thread
Results 1 to 40 of 49

Hybrid View

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


    Did you find this post helpful? Yes | No

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


    Did you find this post helpful? Yes | No

    Default

    Hi, my 10M resistors arrived today. Just before i blow myself up (or even worse another PIC :P) i wanna be sure what im doing. Ive looked in the datasheet for my PIC and the only mention of "clamp" is input/output clamp current which is 20mA. Does that mean it has those clamping diodes or is that something else?

    To connect it up am i right in thinking that the neutral wire connects to VSS and the live wire connects through the resistor into an input pin and thats all there is to it?

  3. #3
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by The Master View Post
    Just before i blow myself up
    Exactly how much before?

    Seriously...I was just thinking...and about something safe too.
    Couldn't you wrap a few turns of wire around the power line and look for a bit of voltage induced into that wire? Run that thru a diode and read that wire with the PIC?

    Sounds a lot safer than what you are planning on attempting now anyways...

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


    Did you find this post helpful? Yes | No

    Default

    Wouldnt that need a load on the end of the wire? The wire goes from the smoke machine then straight into the circuit

  5. #5
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by The Master View Post
    Wouldnt that need a load on the end of the wire? The wire goes from the smoke machine then straight into the circuit
    Never tried it...but...if my thinking is right...
    A coil of wire around the power cord itself (around, not touching...), a high value resistor in series with the coil, one side of the resistor to ground, one side of the resistor to the PIC pin. The resistor should show a voltage across it if there is current flowing thru the power cord. You'll probably have to put a diode inline with the PIC pin and maybe a small R/C network behind that to filter out the 50hz half-wave and get a decent reading at the PIC.
    Unless my thinking is really jacked up (entirely possible), it should work... Not sure how many turns you'd need, might be 10, might be 1K...

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


    Did you find this post helpful? Yes | No

    Default

    That sounds a little complicated. Anything upto 1000 turns :O Ive got to do this 3 times too. I think the 50Hz part will be a problem with every method.

    It would be best if i could do the opto way. Problem is i think i need something daft like 20W resistors for it

  7. #7
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    You said something about a ready light? There is half of the opto-coupler. A photo diode is the other half.
    Dave
    Always wear safety glasses while programming.

  8. #8
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by The Master View Post
    That sounds a little complicated. Anything upto 1000 turns :O Ive got to do this 3 times too. I think the 50Hz part will be a problem with every method.

    It would be best if i could do the opto way. Problem is i think i need something daft like 20W resistors for it
    Shouldn't take a 1000 turns to do what I'm thinking. I would think maybe 10 or 20 would handle it just fine. 50hz shouldn't be a problem either.
    All you're doing is making a 'transformer' of a sort, tapping into the expanding/contracting alternating magnetic field that naturally surrounds a wire that is carrying a current, inducing a current into that coil, and developing a small voltage across a high value resistor which is the load for that coil.

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by The Master View Post
    Hi, my 10M resistors arrived today. Just before i blow myself up (or even worse another PIC :P) i wanna be sure what im doing. Ive looked in the datasheet for my PIC and the only mention of "clamp" is input/output clamp current which is 20mA. Does that mean it has those clamping diodes or is that something else?
    What PIC? What pin? The datasheets have diagrams of all the inputs showing the clamping diodes. For example, the 12F683 datasheet section 4.2.5 PIN DESCRIPTIONS AND DIAGRAMS has block diagrams of each pin. All but GP3 have clamping diodes to Vdd & Vss. GP3 only has one to Vss. Every datasheet I've ever seen has a similar section. You can also look at Microchip AN236 to see how they detect ZC in an X-10 application.

    If you are concerned about the high voltage then your best bet is to use a wall transformer type of DC power supply. It will give you an isolated DC output of whatever voltage you wish.

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