Best strategy to temporary disable wifi on Photon

I use a Photon to very accurately measure the timing of a analog largely amplified (opamp) signal. I noticed that the some spikes in the electronics cause distortion in the measurement. I suspect the spikes in the analog signal are caused by the current variations of the Photon during wifi communicating. Spikes happen only now and then. Altough this variation is very small, due to the large gain of the opamp, it causes distortions in the measurement. The Photon is decoupled by a large and small capacitor close to the Photon board, but the large gain of the chain of opamps amplifies every small spike.

I was thinking of disabling wifi during measurement and then re-enable it afterwards.

What would be the best strategy to do this?

I use interrrupts during measurement, so I cannot disable interrupts. But wifi.on() and .off() might work, as would Particle.connect() and .disconnect(). Would that be wise or does this method has a downside? Maybe there are some more alternatives?

Wifi.on/off() is the way to go. The other two won’t turn off the radio - only the connection to the Particle Cloud.

You can also disable the auto-connection on startup using https://docs.particle.io/reference/firmware/photon/#manual-mode.

2 Likes

Thanks @jenschr, it works! as soon as wifi is switched off, distortion is gone

1 Like