I have designed a PCB that allows me to turn a light on with a mechanical relay. The difference between your average implementation here is that I also wired the board up to a wall light switch which allows me to alternate the state of the light switch.

enter image description here

I managed to alternate the behavior of the light by using an SPDT relay and a 3-way switch (which is wired in U$3 below). The theory of operation is pretty simple. The HOT wire is connected on the relay's center pin and the current is either brought out of the NO or NC pin. The light switch is connected similar to the SPDT relay but in opposite (you can think of the switch as an SPDT relay). ie: The center pin P$2 is the output and the other 2 states bring the current from NC or NO out to TRIGGER. Thus flipping the light will alternate the current from NC to NO and the relay essentially can do the same to alternate the current.

The issue with the current design is that I'd like to get away from using a mechanical relay and move to solid state for all of the typical reasons (audibly noisy, low life, sparks, ...). How can I achieve the same goal using solid states?

SPDT Triacs virtually don't exist. I found a few designs for SPDT triacs using a few SPST triacs, but I wasn't exactly thrilled to see the large number of components and I'm a bit worried that I may lose any significant power gains I may have gotten from moving to solid state.

Are there any other clever ideas that anyone can think to achieve my high-level goals of XOR'ing the state of the light switch with a relay and a light switch?

  • \$\begingroup\$ You may get a lot more attention to your question if you took the time to provide a schematic of what you have done or at least intend to try. \$\endgroup\$ Jun 2, 2018 at 10:20
  • 1
    \$\begingroup\$ Use an SSR (solid state relay). \$\endgroup\$
    – Andy aka
    Jun 2, 2018 at 10:42
  • \$\begingroup\$ @MichaelKaras Good idea. I've added one. I also clarified what I think was a pretty confusing intro. \$\endgroup\$
    – ti_chris
    Jun 2, 2018 at 21:27
  • \$\begingroup\$ @Andyaka SPDT relays are virtually impossible to find. They don't tend to like to make those. It's all SPST. \$\endgroup\$
    – ti_chris
    Jun 2, 2018 at 21:28
  • 1
    \$\begingroup\$ You mean "SPDT solid-state relays are virtually impossible to find". \$\endgroup\$
    – Transistor
    Jun 2, 2018 at 21:37

2 Answers 2


I can't quite figure out what you are asking. I think it is, "How do I replace the relay at one end of my two-way lighting circuit with a solid-state solution?"


simulate this circuit – Schematic created using CircuitLab

Figure 1. (a) What you've got. (b) A double SSR solution.

You can avoid the need for two controller outputs to control the two SSRs as shown in Figure 2.

enter image description here

Figure 2. For single GPIO control wire the opto-isolator LEDs as shown.

When GPIO is low L1 will be lit. When GPIO is high L2 will be lit. Note that if GPIO is in tri-state that there may be enough current - even at 3.3 V - to turn on both.


I think you approach is similar in this discussion. I have posted this thing twice but none of the response really worked out my need. I finally came out with the option posted on the link. Simply, you can consider the following:

  1. Highest AC power for a line and type of load (inductive/ resitive?)
  2. Requirement for manual control: Do you need to have independent switch when MCU is failed?
  3. Overall cost for the entire solution: required as low as possible or it is okay for higher price?
  4. Ease of installation for final product: required highly and professional technician or amateur user?

Considering those above requirements, I can suggest you one solution that I am now using and have tested successfully:

  1. Requirement: Design a light switching solution for home upgrade
  • Maximum servicing AC current: <=4A repetitive;
  • Resitive load (upto 400W) and small inductive load (upto 200W);
  • Can be controled independently using capacitive button and MCU over Wifi;
  • Can be installed inside existing wall plate (38x90x50mm -H:L:W) without external component box;
  • Can service upto 6 switching channel for home light and number of switching channel can be flexible changed due to actual need (sometime required only 2 switches, some time can be 6 as maximum).
  1. Solution: Base on that need, I designed a the switch board with following specification: + MCU module: ESP8266-01S + PCF8574 (port expander) + plugable power module (220VAC 5VDC), PCB size is: 82x50mm. Link for the project is here. This board have 6 slots for relay plugging. And the Board was fully fitted in the normal Sino/Clipsal wall plate, no modification to the wall-plate is needed. Figure 1: MCU PCB - top view

Figure 2: MCU PCB- bottom view

3D view of the MCU board

This MCU board does have a simple socket to plug a small power module that can support 2 power module type Type 1 and Type 2 (jz-53e13). They are 1$ on Shoppee for Vietnam market. I reied to look for card edge option but cost for socket is too high, so better using 2x4 2.55 female header.

Figure 3: Power module view 3D

Figure 4: Cheap and tiny power module 220VAC 5VDC 700mA - Type 1

  • Relay module: This development is required due to small size to fit in the MCU board and the wall plate. Link for the relay design is here and the relay is looked as shown in Figure 5.

Figure 5: 3D view of the plugable relay

Design for the Relay is a bit complicated to allow it to be operated independently and can be followed here. You can consider replacing BT136D with T1610 or T1635 - 600 G that can accept higher serving AC current without heat-sink (1-4A). Triac can be MOC3041 (TH) or MOC3063 (SMD) with built in zero cross detection.

This relay should be accompanied with a TTP223 touch module and a small holder to replace the mechanical switch. I used a 3D printing model.

TTP223 holder

Holder for TTP223 touch module bottom view

  1. Costing: For MCU: 3.74 USD For relays: 1.08 USD per module

Costing for relays and MCU

So, that is... hope you will have things run as you expected.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.