Auto Antenna selection Photon

Hi All,

I was just doing some testing of the antenna selector.

What surprised me was WiFi.selectAntenna(ANT_AUTO) seemed to select the chip antenna when I had both a chip and external antenna connected.

My basis for believing this is how the selection was made is that I am reporting the RSSI for the device and the RSSI value was inline with the RSSI value I see when WiFi.selectAntenna(ANT_INTERNAL) is used a value something like -51.

WiFi.selectAntenna(ANT_EXTERNAL) tends to give me a value something like -43.

Does anyone know exactly know how WiFi.selectAntenna(ANT_AUTO) makes its selection?

Also is there a way to know which antenna was actually selected?

Interesting… AFAIK there is no way to know for sure which antenna is selected, and it should continue to switch between them continuously on ANT_AUTO, it does not settle on one or the other. The only way to know for sure is to set the antenna explicitly with ANT_INTERNAL or ANT_EXTERNAL.

Testing with firmware 5.01 revealed something interesting. ANT_INTERNAL and ANT_EXTERNAL behave as expected but default (no statment) vs ANT_AUTO behave differently. Default makes the antenna selection on startup and does not switch depending on best signal. ANT_AUTO will auto switch between internal and external depending on signal strength. I could tell which antenna was selected by monitoring the signal strength and covering the external antenna with my hand to see if it switched.

That is because ANT_AUTO is not default - ANT_INTERNAL is (for quite a few releases already now).

And that’s also slightly misleading

After you have used WiFi.selectAntenna() once, there is no “default” anymore - the last selection will be the new “default” when you don’t add that statement in your code.

Not buy my testing, default uses my external antenna and keeps using it when I degrade the signal by covering it with my hand.Sounds like default tests signal strength then issues ANT_INTERNAL or ANT_EXTERNAL as appropriate.

Seen my edit above?

As said “default” as such is misleading.
If you mean “default” as what the setting is when you get your Photon out of the box the very first time (and it’s not an old stock with ancient system on it) then it is ANT_INTERNAL (and used to be ANT_AUTO in ancient times).

But if you use “default” as what is if not explicitly stated, then it still will be as you set it last.

We call this “it’s a sticky setting”

More testing… Agreed, ANT_INTERNAL and ANT_EXTERNAL are “sticky” but ANT_AUTO is not really. After selecting then commenting out the ANT_AUTO it goes back to what I called default where it picks best antenna on startup and will not switch on signal degradation. EDIT… Sorry got that wrong ANT_AUTO is not sticky at all. It goes back to the previous ANT_INTERNAL or ANT_EXTERNAL. So I guess I can never get back to the default not that it matters.

That came about in connection with the transition from out-the-box default ANT_AUTO to ANT_INTERNAL (sometime between 0.4.1 and 0.4.4) since ANT_AUTO didn’t play well with SoftAP where the Photon hasn’t got any reference signal to judge which antenna would be the best choice.
So for safety reasons ANT_AUTO will not kick in if not explicitly stated - but this might want an explicit statement in the docs.

Again, what do you mean by “default” here?
If you want to go back to out-the-box default use WiFi.selectAntenna(ANT_INTERNAL)

Before I used any ANT statements, it would use the EXT ANT. Then again…I can’t be sure. Will have to test an another Photon that I have never used ANT commands on.

Sorry, I’d doubt that.
Either you had a rather early Photon with the “dodgy” AUTO-default which luckily made a good choice for you or someone had “tampered” with your Photon before you got your hands on it.

Do you by any chance remember when you got these devices? And where from?

Had the cellophane wrapper on it.

May have been my not understading “sticky” at first. Will test with a fresh one tomorrow.
But thats good to know that it will not use ext. ant. by default.

I hope these are CAN$ on that site :wink:

19 USD vs 23 USD is still a difference

Yes. $29.95 CAD is not a great price, could order from US for better deal but they have a store in Ottawa and I’m lazy!

1 Like

@ron7136, I have a spare photon I can give you And I live in Ottawa! :wink:

1 Like

Thanks, but I have 6 more that have never had an ANT command.

Confirmed! using internal antenna by default. After ANT_AUTO command device I had an external ANT on went from -78 to -70. Another surprise was that wrapping a piece of tinfoil around it made a better signal! (-69) WTF! It was a cylinder open at the top and bottom. Will play more with that aspect tonight. Thanks for putting up with my bull. :flushed: