Fluorescent Lighting

Interesting issue. I have some fluorescent lighting in my building and an array of about 9 switches. They all get switched off at the beginning and the end of the day. When I switch the lights on or off, I get spurious particle publishes from the buttons attached to my Photons. The buttons are using the internal pullup resistors.

Any ideas how to avoid or mitigate this issue?

Somebody mentioned using capacitors to help with a potential short-term voltage drop - but I guess that would only help if that’s the root cause of the issue, rather than the other option which is I guess electromagnetic interference? Out of my depth here. I also don’t know where specifically to put the capacitors.


@netpex, fluorescent fixture are notorious for RF and other interference. I would never recommend using internal pull-ups for buttons as they are quite “weak” being 40K ohms or so. I suggest an external 4.7K resistor coupled with a 0.1uF capacitor to GND to reduce noise on the GPIO. How long are the wires going to your buttons? How are you controlling the actual lights?


The capacitors go between Vin and ground. Be aware that if you use electrolytic caps that they are polarized meaning that you must match the + and - leads to Vin and ground respectively.

Unless you have a scope and an isolated power supply to do testing, it’s really just guesswork trying to troubleshoot this.

The particle datasheet references Analog’s AN-88 which brings up some issues about this topic.

Thanks, all. I should clarify as I now see it’s confusing from my write up that the fluorescent lights are nothing to do with my photon at all, beyond being connected to the same electricity supply (because they exist in the same building as my photons). The lights are not being switched or monitored by my photons but their being switched causes my photons to misfire!

As @peekay123 already mentioned fluorescent lights are notorious citizens on any building’s wiring. Especially when electrically sensitive devices are fed off of the same phase.

Since flourescent lights are highly inductive loads especially switching them off will cause some noise on the shared phase. And the ignition of these kinds of lights usually requires high voltages to ionise the gas which will also be “felt” by devices on that same phase.

Zero-cross detecting or soft start/soft off switches for FLs should prevent these issues at the source, but once you know about the implications you can also counteract the effect on the receiving side.

Are you able to discern a “misfire” from a power cycle?

i.e. does your setup loop output some type of message that differentiates powerup from a normal report cycle?

Sorry, I’m not sure what you mean or whether I’ve not been clear enough in my post. Basically the situation is I am trying to basically read a button state with a Photon. The Photon exists in the same building as some fluorescent lights which I’m not trying to control, interface with or read in any way. HOWEVER, when I switch on or off those electric lights, the Photon “thinks” buttons have been pressed which have not.

@ScruffR & @peekay123 - I’m powering my Photons by USB - would I have to power it directly from VIN to introduce capacitors etc to filter interference?

I don’t suppose there are off the Chinese shelf products I could buy to insert inline between the wall wart and my Photon to protect it from noise, are there? I am not good at reading circuit diagrams and this does sound quite complicated.

I think you misunderstand, to guard against EMI/spurious signals from reaching the Photon’s GPIO pin, then you add a capacitor from the GPIO to ground. If you want to guard against power supply brown-outs, then you would add a capacitor between Vin and Ground. As a rule of thumb, I always add a large electrolytic capacitor to Vin (usually a 470uF laying in my prototyping bin.) Do you have any debounce circuity on your button circuit right now? If so, you might just need to beef up the capacitance or change the type of capacitors for better performance. As @peekay123 stated, don’t use the pull-up resistors built into the Photon. Rather, add your own pull-ups with a lower resistance value. You should be using a circuit like this to debounce the switch in the first place:

Linked from: https://i.stack.imgur.com/Zv2Sa.png