sensing from a 12v light switch?

Hello I'm working on a simple Web server page monitoring light switches and temperature sensors to be sent to email. The problem I'm having is i need to sense when the light switch is on or off. sketches and libraries not a problem it i hardware. I want to sense the 12 light switch. I have many options from resistors ladder to relays, Sense I'm not really doing anything with current I'm wondering what would be the best thing to use to detect when the switch is on or off? And would i better to be adding some kind of Isolator to it to protect the arduino? Just trying to get some help on figuring out what hardware i would need.

p.S.S I totally forgot I'm using the arduino nano. This is the only thing i have available at the moment.


12v a/c or d/c?

If dc I think I would use an opto isolator

Holy cow i know i forgot something. Sorry i forgot about the ac/dc part. It is a dc light switch.


What voltage?
Have you considered as previously mentioned an opto-coupler to sense and isolate the light power?

Thanks.. Tom.. :slight_smile:

The light switch and light is 12v.

Do you care if the switch is on or if the light glows?

Of course i do. I need the light and to work lol

Of course i do. I need the light and to work lol

The reason I reckon herbschwarz asked was, that in your opening post you talk of monitoring the switch. If the switch is closed you would still have 12V at the bulb, even if the bulb is stuffed or absent.

So, seems you need to monitor the actual light emissions, not the state of the switch.

Hello I'm sorry. Let me rephrase that. What i mean is if a light is on or off from the switch is what i would like to monitor. What i mean by close or open sorry if i was confusing there because I'm use to says when something is open or closed like a relay. That is why i was asking if i should use a relay to trigger a arduino sense the relays i have are 12v. and sense there is no current going to the arduino only just triggering pin high or low i was wondering if that was the best way to go? But if i use that would i see need a opto isolator, Or would the relay be enough protection?


When the switch is closed (contact made) doesn't necessarily mean the connected light is on: it may be broken. That makes "monitoring the switch" and "monitoring the light" two different things.

If the light won't switch on at 1 mA of current, you can place an optocoupler with resistor in parallel to the switch. When the switch is open, current flows through the optocoupler (and the light bulb, of course). When the switch is closed, no current through the opto.

Note that if the light bulb is broken (and fails open) or removed, your switch will always read "closed" as there is no current flowing through the optocoupler in that case.

Instead of an opto-isolaator why not just sense if the light is actually on - with a photoresistor?