Friday, June 21, 2019

64: Adding a WIFI Antenna to a Photon

I've been having trouble with Photons remaining connected to the cloud. This in a place where an iPhone is ok (1/2 bars). So I started recording signal strength with this line of code:

  int wf = WiFi.RSSI();

Note that if you don't assign the value to an int first it will be treated as unsigned in an sprintf function "%d". Bug!

Anyway, the signal values returned run like this: (good to poor strength range: 1 to –127)
  • -10 -- strong/right next to the modem,
  • up to -60 -- reliable signal,
  • up to -75 -- so-so,
  • over that -- unreliable.

According to Particle Docs, these STARTUP calls control antenna choices:

  //STARTUP(WiFi.selectAntenna(ANT_INTERNAL)); // selects the CHIP antenna, default?
 //STARTUP(WiFi.selectAntenna(ANT_EXTERNAL)); // selects the u.FL antenna
 //STARTUP(WiFi.selectAntenna(ANT_AUTO)); // only works with antenna attached?

Note those statements are all commented out because they seem ineffective. But the good news is that adding a simple/cheap antenna does work* -- to the tune of improving signal strength by 10 to 15.

Another Particle complaint: the Docs generally fail to specify default return values.

_________
* The tiny snap-on connector can be frustrating.