Connect with us

easier way for a 5Vdc mcu to check a 120Vac switch

Discussion in 'General Electronics Discussion' started by vitroblue, Jan 3, 2013.

Scroll to continue with content
  1. vitroblue

    vitroblue

    4
    0
    Jan 2, 2013
    what would be the cheapest way for my 5Vdc mcu to check if a 120Vac switch is open or closed?
    is there any way i can avoid a transformer and a rectifier bridge? i'm not gonna drag current... and i cannot change the switch
    i thought of zeners, transistors, resitor voltage divisors...
    but i'd like to protect my mcu, so is it wise to use an optocoupler?

    can anyone gimme some suggestions?

    thanks
     
  2. pwdixon

    pwdixon

    52
    0
    Oct 14, 2012
    If the switch has two sets of contacts perhaps you could use the non-mains side of the switch.

    You could use an opto-coupler to isolate the mains from your processor just have to be careful/clever about thermal management.
     
  3. Harald Kapp

    Harald Kapp Moderator Moderator

    11,151
    2,545
    Nov 17, 2011
    An optocoupler is the safe way due to its isolation.
    Assuming your optocoupler requires 5mA, you need a series resistor of 120V/5mA=24kOhm. Note that voltage and current are effective (RMS) values. Your peak voltage will be 170 V, your peak current 7mA. You will need a diode antiparallel to the optocoupler's diode to protect the LED from reverse voltage.
    The series resistor will dissipate P=I^2*R=0.6W.

    Here is a page that explains LED operation from mains. The capacitor used there reduces the power dissipation by acting as a reactive resistance.

    Note that your µC will see a square waveform including logic LOW levels even if the switch is on. This is due to the sinusoidal waveform of the mains AC. You need to filter the signal (e.g. look for edges within one mains interval 16ms...20ms, depending on your mains frequency).

    Harald
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-