# Encode and decode SPDT switch over single wire

I'm trying to devise a way to connect a device to a SPDT switch using only one wire. Specifically, I want to connect a wall switch to some kind of smart home thingy, and I only have a single switching wire and a neutral lead at the site of the switch.

One obvious way of encoding this would be to have one side of the switch connect via a resistor, and the other one directly. The other side would then see either no resistance, some kind of resistance I get to pick, and infinite resistance.

simulate this circuit – Schematic created using CircuitLab

Basically, what to put in the box?

My limited knowledge suggests that I am going to at least need two transistors to pull the wires down to ground. I could then fiddle around with resistors in such a way that when R1 is connected to the box, one of them turns on, and when it's directly connected to ground, the other transistor turns on. But: how to get the first transistor to switch off in this case?

• your "neutral" is mains neutral ot a low voltage DC common? what power sources are available at the ?? box? Is it two position SPDT or three position centre off? does the neuitral go to the ?? box? Sep 30 '20 at 7:27
• you only need to detect the switch in one position ... if it is not detected in one position, then it is in the other Sep 30 '20 at 8:09
• @Jasen it's mains neutral. At the box I will have mains live, 230V in this case, and also neutral. And yeah the SPDT will need to have centre off, so I do need to detect both positions :( Sep 30 '20 at 8:25
• PSA: Don't draw neutral as GND. Neutral is a hot wire that needs to be drawn as part of the circuit. Ground also exists and is a real thing, but the various world electrical codes require no current be carried on it. It's a fault-catcher not a backplane. . Sep 30 '20 at 18:33
• Thanks :) I am obviously not an electrical engineer! I mainly wanted to illustrate my question with a doodle, and the "draw schematic" button seemed to serve my needs. Only, now my doodle pretends to be a circuit, and it is clearly not! :D Oct 1 '20 at 6:19