I have a small circuit designed to switch on the lights in my room using a wifi-enabled microcontroller Particle Photon. The circuit is based on an opto-triac and TRIAC setup where the microcontroller triggers opto which triggers the TRIAC to switch on or off.

I installed 4 of them in my house, 1 in my living room and 1 in my bedroom (both incandescent bulbs) , 1 in the kitchen and one in the bathroom (both use neon based flourescent lamps).

I also have a push button wired to the Microcontroller to enable physical switching for the lamps along side the wifi.

The problem When i switch on the lights in the kitchen, the lights in the bathroom and my bedroom go up as well.

Notes : 1. My boards are connected to a cloud service by Particle, where i can monitor (remotely from a laptop) if a voltage was applied to a certain pin. 2.Every board of mine has a powersupply (5V 1A) output the powers the board. This power supply takes in Mains (220V AC and Neutral directly from the wall) 3. My board takes in 5V from the supply and is connected to the Mains, and Lamp to switch on/off

Trials and Conclusions 1. I thought it was a software issue, so i disconnected the internet from the boards and tried it again, again it happened, therefore this has to be a HW problem. 2. I immediately went to think that the neon is somehow cause some back-emf or something and messing up my gear, i disconnected the power supply and powered my board through a portable mobile charger , still happened again, the lights in the other rooms went on. 3. I disconnected my board from the wall (Yes , my board is now completely wireless), just to see if the pins would be triggered (i can see this through my web service). and YES, when i switch on lights in the kitchen, my WIRELESS board in the bathroom registers a voltage on my pin. Now keep in mind i deliberatley set my (now) wireless board very close to the naked wires in the wall that trigger the lamp, when i take it farther away, it doesn't register that voltage.

One possibility now ... Electromagnetic Interference.

Q1. Is my assesment correct? Q2. How to resolve this issue?

This is my circuit : enter image description here

This is the current setup, it's completely sloppy and potentially unsafe i know but i'm a professional at this , no worries enter image description here

The blinking thing is the microcontroller on my board, the green board is the power supply.

I know this is rather complicated , any questions required to answer this i'm fully prepared to provide details. ANY HELP IS GREATLY APPRECIATED.

  • 2
    \$\begingroup\$ Much more likely that you've mixed up your mains loops - in a professional way, of course. Looking at the mess hanging out of that wall box I'm not surprised. We can't answer without a complete mains wiring schematic and if you take the time to draw that you'll probably find the problem. \$\endgroup\$
    – Transistor
    Mar 12, 2016 at 17:46
  • \$\begingroup\$ Hey, thanks for the reply. 2 facts : 1. This ONLY happens when I turn on the neon lights, it doesn't happen when I physically switch the lights in the bedroom. Fact 2, like I mentioned, the board u see now , I disconnected it completely from the wall, powered it via USB, and when I switched on the lights in the bathroom, the board u see in the photo (while completely disconnected from wires in the wall) registered a voltage on pin D2. \$\endgroup\$ Mar 12, 2016 at 18:43
  • \$\begingroup\$ For emphasis, NEON lights points to an emi issue, specially that the boards in the other rooms are IN PROXIMITY to the wall wires but Disconnected. Also can u elaborate on what you mean by main loops mixed? I can provide a theoretical demonstration in a picture on how the wiring is done \$\endgroup\$ Mar 12, 2016 at 18:45
  • 1
    \$\begingroup\$ Look into snubbers. Too little information has been shared, but it is best practice to prevent EMI at the source. Apart from that it can be a good practice to make your device less susceptible with a snubber too. \$\endgroup\$
    – jippie
    Mar 12, 2016 at 18:48
  • \$\begingroup\$ If the pin TORELAY is floating, do you still have problems? \$\endgroup\$ Mar 12, 2016 at 18:50

1 Answer 1


You are using a interesting configuration for TRIAC, but it is potentially unsafe for the component (TRIAC). My suggestion is to change the TRIACRES configuration as the bellow example.

enter image description here

Important: depending of TRIAC model, you need to use a SNUBBER circuitry to reduce the "false" positive on TRIAC GATE.

I learning a lot about TRIACs on the last 2 (two) months and I can honestly say to you: many of the samples in the internet are empirical experiments. It's important to calculate all the things in your circuitry before use any of this examples.

The picture above is from a Datasheet from Texas Instrument about MOC3020.

In most of the cases, you need to use the TRIAC MAX PEAK CURRENT in Gate port, because when you trigger in 90º Angle in a 110V Nominal AC, you have an equation like:

V = 110 * sqrt(2) = 154
I = ?
R = 180 Ohms

I = V / R = 0.85A --> it is a lot more than most of TRIAC Gates (about 50mA), but not exceeded the PEAK (around 2 or 4A for 20uS). To trigger you need only 10uS with 0.85A in 90º Angle at 110v Nominal -- in other words, 180R it's perfectly reasonable.

The Wattage of this resistors are important too. Including the package of you use (i.e. 0805, 1206 or PTH). If you use PTH --> 1/4W it's ok. But if you use a SMD you need to verify the Voltage of each Package. Probably for 110 Nominal, the most safe is 1206 -- 200VAC support.

If you have any doubt, please let me know. OK? And sorry about my english.


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.