Shop OBEX P1 Docs P2 Docs Learn Events
AC sensing curcuit — Parallax Forums

AC sensing curcuit

Mike2545Mike2545 Posts: 433
edited 2009-01-13 23:22 in General Discussion
I am attempting to build a circuit that will be able to tell a Stamp if an AC device (relay, light bulb, or any other 120v item) is on. Anyone have some thoughts on this?

Comments

  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2009-01-11 01:21
    You could use a 4N25 Optic Sensor

    The photo below is the way you would hook it to your Basic Stamp

    You Must use the right Resister for 120 Volts the value show en is for 24 volts

    The only reason the + and - are there is if you use it on DC voltage you must have the polarity correct or it will
    not work

    ·

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ··Thanks for any·idea.gif·that you may have and all of your time finding them

    ·
    ·
    ·
    ·
    Sam

    Post Edited (sam_sam_sam) : 1/11/2009 1:45:02 AM GMT
    1696 x 944 - 95K
  • Mike2545Mike2545 Posts: 433
    edited 2009-01-11 01:31
    sam_sam-sam,

    If you note I am looking to sense 120 Volts AC the jpeg you posted looks a lot like one for DC. But I like the fact you didn't suggest a relay. I know the 'button' command will de-bounce the contacts but I am also looking maybe to run this through TTL at some point and it would be better if it were a 'clean' signal.

    Mike2545
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2009-01-11 01:34
    You can use this for AC voltage as well as DC voltage· you just have to use the right resister on the Input side

    which is on the left side of the Chip

    The ouput side that hook to the Basic Stamp is going to be the same

    Your resister would be 1200000 ohms for 120 volts instead of 24000 ohms for 24 volts


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ··Thanks for any·idea.gif·that you may have and all of your time finding them

    ·
    ·
    ·
    ·
    Sam

    Post Edited (sam_sam_sam) : 1/11/2009 1:41:37 AM GMT
  • Mike2545Mike2545 Posts: 433
    edited 2009-01-11 01:40
    sam_sam_sam,

    Won't the led cycle at 60Hz? Surely TTL could pick up that chatter. I'm going pass on that design, maybe someone else has a different idea.

    Mike2545
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2009-01-11 01:45
    That will not matter as long as you keep the milliamp below 10

    the range is 5 to 10 as long as you follow this you will be alright

    I use this all the time with no problem at all

    ·You could also use one of these as well

    · H11AA1· Optocouplers Bi-Directional Input

    Here is where the data sheet is

    http://www.fairchildsemi.com/ds/H1%2FH11AA1-M.pdf

    When you use this optic sensor

    use have to use 2 resisters one on each input pin

    600000

    In you code you would use IN_· pin# that you are using

    Not the button Command

    Here is an example of a routine that I have used before

    Pick_ONE:


    DO
    IF IN14 = 0 THEN
    ·· GOSUB Power_ON
    ELSE
    ·· GOSUB Power_OFF
    ENDIF

    LOOP

    I know the 'button' command will de-bounce the contacts but

    ·I am also looking maybe to run this through TTL at some point and it would be better if it were a 'clean' signal.

    If this a problem then you just put 10 mfd cap on the input pins but then you will need to use a rectifier

    then yor resisters then the cap

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ··Thanks for any·idea.gif·that you may have and all of your time finding them

    ·
    ·
    ·
    ·
    Sam

    Post Edited (sam_sam_sam) : 1/11/2009 2:12:17 AM GMT
  • Mike2545Mike2545 Posts: 433
    edited 2009-01-11 02:04
    Well, the opto coupler design is nice and so I thought about how capacitors act like resistors with AC. Look at this one and see what you think. More surgical. less shotgun.

    Mike2545


    (Some of sam_sam_sam's posts removed) you had to be there. It was colorful)

    Post Edited (Mike2545) : 1/11/2009 3:30:05 AM GMT
  • Mike2545Mike2545 Posts: 433
    edited 2009-01-11 02:16
    sam_sam_sam,

    No its in the correct place. Mock it up, you'll see.

    Mike2545
  • Mike2545Mike2545 Posts: 433
    edited 2009-01-11 02:29
    Right, it won't work after the other diode. Like I said, 'mock it up'.
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2009-01-11 02:41
    I am sorry· smile.gif




    I learn something today· I have never seen it used that way before

    http://www.allaboutcircuits.com/vol_3/chpt_3/11.html



    · attachment.php?attachmentid=74015


    Zener diode clipper:

    The zener breakdown voltage for the diodes is set at 10 V by the diode model parameter “bv=10” in the spice net list in Figure above. This causes the zeners to clip at about 10 V. The back-to-back diodes clip both peaks. For a positive half-cycle, the top zener is reverse biased, breaking down at the zener voltage of 10 V. The lower zener drops approximately 0.7 V since it is forward biased. Thus, a more accurate clipping level is 10+0.7=10.7V. Similar negative half-cycle clipping occurs a -10.7 V. <!--split for double ref-->(Figure below) shows the clipping level at a little over ±10 V.

    23034.png

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ··Thanks for any·idea.gif·that you may have and all of your time finding them

    ·
    ·
    ·
    ·
    Sam

    Post Edited (sam_sam_sam) : 1/11/2009 2:47:16 AM GMT
    354 x 166 - 4K
  • Mike2545Mike2545 Posts: 433
    edited 2009-01-11 02:49
    I'm glad cooler heads prevailed, and with the circuit I drew, you can pick the capacitor to match the load. Just follow the math in the page and you can get the right one every time.

    Mike2545
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2009-01-11 02:54
    Do you have a web page for how to what cap will give what millamps out put

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ··Thanks for any·idea.gif·that you may have and all of your time finding them

    ·
    ·
    ·
    ·
    Sam
  • Mike2545Mike2545 Posts: 433
    edited 2009-01-11 03:06
    No just scroll down on the pdf I attached and see the formula Xc= 1/2piFC

    Whereas to get Xc you take 120v-5v=115v 115v/.012(ma)=9583 ohms (this is Xc)
    So 1/2piFXc =C where F is frequency (60 Hz) that's .00006 in this case

    You should get 3.6118327

    The answer for 12 ma is...1/3.6118327 or .27 Mf

    Be sure to use capacitors rated for 180 V AC like Mylar. Get them from Mouser
  • LeonLeon Posts: 7,620
    edited 2009-01-11 13:02
    Where I used to work we needed an input to our system if a 48V AC supply was on. I used a bridge rectifier and an opto-coupler. it worked very well.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
  • Ben KirkpatrickBen Kirkpatrick Posts: 7
    edited 2009-01-13 19:55
    What about passive sensing of AC ?·· Something like a small coil place near the cord or around the cord with some resistors and a diode to condition the signal?· It seems like this was brought up before and there was some problem with it...

    I like the idea of not breaking into the circuit though.· It keeps your insurance and the fire-inspector happy.
  • LeonLeon Posts: 7,620
    edited 2009-01-13 20:07
    That was the advantage of my solution using the bridge rectifier, it needed to be easily attached and removed. It was used with our people-counting system to count and log the people waiting at a pedestrian crossing, for a local authority.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
  • Mike2545Mike2545 Posts: 433
    edited 2009-01-13 23:22
    There may be some passive ways to determine if something is on, say a light bulb, you could detect heat or light to determine the on/off state. Maybe a vibration sensor for telling whether a motor is running and things like that.

    The formula Xc=1/2piFC is based on Reactance. Its a proven formula (type in in your browser) and widely available. You can even run static loads with this practice. The ideas put forth by sam_sam_sam on the subject will surely get you in trouble down the line. I can't think of an easier, safer, less expensive way to accomplish this.

    I'm sorry about the hand drawn sketch I posted.

    Mike
Sign In or Register to comment.