How to know if a normally closed switch is opened (switch is part of 24vac circuit)

So I need to know if S2 in the diagram below opens. I know that I don’t really want to wire it up to the photon like this, since that would, I imagine, kill it. But is there a simple way to do what I’m needing?

ps. I have googled, but I can’t find an answer, or might not know if I did :).

You could use a full-wave bridge rectifier, a capacitor and a resistor divider. Something like this:

image

Use the middle “tap” (between the resistors) on the diagram as your on/off sense output. Choose the values that make the most sense to you. The values I chose would burn 1mA constantly when the power source is on. This does not provide isolation or protection from voltage spikes.

@johnwest80, what is S2 in relation to S1? Also, is S2 an existing switch or you are in a position to specify it?

If you are looking to measure if S2 is open or closed regardless of the position of S1 then you cannot reliably measure either the voltage or the current through or across S2. One trick is to make S2 a douple-pole switch with one pole in the 24VAC circuit and the other in a low-voltage (3.3v or 5v) circuit connected to the Photon.

If using an existing switch is the only option then you would need to measure the current or the voltage on the equipment side of the switch. How much current does the load draw?

I see @ninjatill posted another solution which assumes you have access to the AC voltage across the load. With S2 open, there is no return path for the current so there is no voltage produced by the circuit he illustrated. This can work.

Another possible solution is a photo-coupler across S2 which would be OFF when S2 is closed and ON when it is OPEN. If a DC photocoupler is used then the output would be single-phase pulses on the output which could be rectified. An AC photocoupler would produce a positive pulse for each phase and would produce a cleaner DC output when rectified.

6 Likes

Indeed, you would wire the bridge rectifier in parallel with the equipment. I didn’t account for S2 because the overall setup wasn’t quite clear to me. S2 could be wired in series with the AC source in my diagram… but then S1 and S2 would both have to be closed in order to sense an “on” state.

1 Like

Wire a 24v relay in series with your power and monitor the NO, COM relay contacts instead.

2 Likes

You could use 2 relays which would be driven by each switch and run your main circuit power through the contacts on the relays (as long as your equipment does not take more current than the rating of the relay) then on a separate way on each relay give a input on d0 and d2 that way you could detect switch 1 and switch 2

I thought about the relay. However, 24v isn’t always on. I need to know if S2 is open or closed, regardless of whether S1 is open or closed (24v or not). Looking at the first couple answers, I’m thinking that this is above my pay grade :).

@johnwest80, in my response I had asked if S2 is an existing switch or one that you are defining yourself? Can you answer this please. Also, what type of switch is S2 (button, toggle, etc)?

1 Like

S2 is an existing switch. It’s just a simple on-off switch.

Use a double pole single throw switch so that you’re running your 24 volts through one side of it and the other side would just be dry contacts.

What kind of switch?
How does it look when switched on or off?
Can you modify it?
Can you replace it?

All electrical options monitoring the supply voltage are out of question due to S1 and hence you need some workaround closely tied to the physical properties of the switch.

That’s just it. I can’t change anything in the circuit. So I guess I’m out of luck, without some really complicated solution. I appreciate all the feedback to get me to this point. At least I feel comfortable that I didn’t overlook something!

And what about mechanically? e.g. adding a beam break detector, a photo transistor, …

Hence the other two questions

1 Like

As ScruffR said: “you need some workaround closely tied to the physical properties of the switch”

Can you post a pic of S2 ?
There may be an easy way to physically sense the presence of the switch in (1) of it’s (2) positions.

If S2 is closed would S1 be closed and also would the equipment be using current. You could use a Current transformer like what they use on smart meters to detect if current was flowing (If they make dc ones. I’m not sure?) You could read the value and if it drops assume S2 is open?

That was already ruled-out

1 Like

There is a way to do this. What you need to achieve is a ‘floating’ sense current through the switch, that is not affected by the 24VAC supply/current, and vice versa. Whether it’s worth doing is up to you.

I’ve used this before to drive a telco test circuit electronically using an opto-coupled current source like the TLP190B (http://www.farnell.com/datasheets/2007715.pdf). This can inject current through your switch, which you could sense with another opto-coupler, with its output controlling the Photon data line. It would need a few additional components to protect from AC voltage when the switch is open. Also the TLP190 only emits a tiny current. With a bit of brute force (ie. highish LED drive current and a <100% duty cycle to stay within SOA), enough to barely illuminate an optocoupler LED, so you’d need to use a high-gain device like the TLP127 (http://www.farnell.com/datasheets/1944154.pdf). It’s a non-trivial solution. I can sketch it up if you’re interested.