<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[External wifi antenna on the gpy]]></title><description><![CDATA[<pre><code>from machine import Pin
from network import WLAN
print(WLAN.EXT_ANT, WLAN.INT_ANT)
Pin('P12', mode=Pin.OUT)(True)               # selects external antenna
print(WLAN.EXT_ANT, WLAN.INT_ANT)
Pin('P12', mode=Pin.OUT)(False)              # selects internal antenna
print(WLAN.EXT_ANT, WLAN.INT_ANT)
</code></pre>
<p dir="auto">produces</p>
<pre><code>&gt;&gt;&gt;
1 0
1 0
1 0
</code></pre>
<p dir="auto">anybody know how to swap to the external wifi antenna on the gpy?</p>
]]></description><link>https://forum.pycom.io/topic/4040/external-wifi-antenna-on-the-gpy</link><generator>RSS for Node</generator><lastBuildDate>Sun, 08 Mar 2026 20:42:50 GMT</lastBuildDate><atom:link href="https://forum.pycom.io/topic/4040.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 27 Nov 2018 04:59:01 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to External wifi antenna on the gpy on Tue, 27 Nov 2018 05:02:53 GMT]]></title><description><![CDATA[<pre><code>from machine import Pin
from network import WLAN
print(WLAN.EXT_ANT, WLAN.INT_ANT)
Pin('P12', mode=Pin.OUT)(True)               # selects external antenna
print(WLAN.EXT_ANT, WLAN.INT_ANT)
Pin('P12', mode=Pin.OUT)(False)              # selects internal antenna
print(WLAN.EXT_ANT, WLAN.INT_ANT)
</code></pre>
<p dir="auto">produces</p>
<pre><code>&gt;&gt;&gt;
1 0
1 0
1 0
</code></pre>
<p dir="auto">anybody know how to swap to the external wifi antenna on the gpy?</p>
]]></description><link>https://forum.pycom.io/post/23775</link><guid isPermaLink="true">https://forum.pycom.io/post/23775</guid><dc:creator><![CDATA[kjm]]></dc:creator><pubDate>Tue, 27 Nov 2018 05:02:53 GMT</pubDate></item><item><title><![CDATA[Reply to External wifi antenna on the gpy on Tue, 27 Nov 2018 07:06:12 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.pycom.io/uid/3449">@kjm</a> I'm still feeling my way around the GPY. I have tried a number of different options and still working on setting up the WLAN programmatically from stored/passed variables, but try these:<br />
For all of them use wlan.antenna() to read current state<br />
Precursor is to setup the wlan object:<br />
from network import WLAN<br />
wlan = WLAN()</p>
<ol>
<li>
<p dir="auto">wlan.antenna(0)  - uses the internal antenna</p>
</li>
<li>
<p dir="auto">wlan.antenna(WLAN.INT_ANT) - uses the internal antenna</p>
</li>
<li>
<p dir="auto">wlan.antenna(1)  - uses the external antenna</p>
</li>
<li>
<p dir="auto">wlan.antenna(WLAN.EXT_ANT) - uses the external antenna</p>
</li>
</ol>
<p dir="auto">I believe the Pin 12 command is used as an output to actually do the physical switching.</p>
<p dir="auto">These can be used on their own or with other options.</p>
<p dir="auto">Note:  I haven't found much information on the use of integers for the WLAN options, but if you use wlan.XXXXX() it returns an integer for most of them so that seems to me to be a simple way to set the WLAN as you want it. Still investigating this as I want to pass WLAN setup data from a config file if I can, but it is not simple to do apparently  :-)</p>
<p dir="auto">Other examples of using integers for WLAN settings are:<br />
MODE<br />
wlan.mode(1) sets it as WLAN.STA,  wlan.mode(2) sets it as WLAN.AP and wlan.mode(3) sets it as WLAN.STA_AP</p>
<p dir="auto">'auth' SEC parameter:<br />
(1) sets to WLAN.WEP,   (3) sets to WLAN.WPA2 etc.</p>
<p dir="auto">Note that SSID and Password info still needs to be in text of course.</p>
<p dir="auto">I'd be interested to find any additional information about setting WLAN  up using this method if anyone can point me to it?</p>
]]></description><link>https://forum.pycom.io/post/23777</link><guid isPermaLink="true">https://forum.pycom.io/post/23777</guid><dc:creator><![CDATA[Stevo52]]></dc:creator><pubDate>Tue, 27 Nov 2018 07:06:12 GMT</pubDate></item><item><title><![CDATA[Reply to External wifi antenna on the gpy on Tue, 27 Nov 2018 09:54:47 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.pycom.io/uid/3449">@kjm</a> said in <a href="/post/23775">External wifi antenna on the gpy</a>:</p>
<blockquote>
<p dir="auto">WLAN.EXT_ANT, WLAN.INT_ANT</p>
</blockquote>
<p dir="auto">These are constants which will not change if you switch the antenna. So the sequence should work:</p>
<pre><code>from machine import Pin
from network import WLAN
p=Pin('P12', mode=Pin.OUT)
wlan=WLAN()
wlan.antenna(WLAN.EXT_ANT)
</code></pre>
]]></description><link>https://forum.pycom.io/post/23778</link><guid isPermaLink="true">https://forum.pycom.io/post/23778</guid><dc:creator><![CDATA[robert-hh]]></dc:creator><pubDate>Tue, 27 Nov 2018 09:54:47 GMT</pubDate></item><item><title><![CDATA[Reply to External wifi antenna on the gpy on Wed, 28 Nov 2018 02:03:59 GMT]]></title><description><![CDATA[<p dir="auto">Thnx for the replies fellas but I'm not convinced anything is actually happening. While it is true that wlan.antenna(WLAN.EXT_ANT) &amp; Pin('P12', mode=Pin.OUT)(True) both send P12 to 3v there does not appear to be a cmd that confirms the switch to the ext antenna socket has occurred.  print(WLAN.EXT_ANT, WLAN.INT_ANT) always returns 1 0 suggesting the external antenna is off and the internal is on. My RF sniffer probe confirms this with all the wifi RF action at the internal antenna &amp; nothing at the socket.</p>
<p dir="auto">I've wasted over a week with this device and not much seems to work as advertised.</p>
]]></description><link>https://forum.pycom.io/post/23797</link><guid isPermaLink="true">https://forum.pycom.io/post/23797</guid><dc:creator><![CDATA[kjm]]></dc:creator><pubDate>Wed, 28 Nov 2018 02:03:59 GMT</pubDate></item><item><title><![CDATA[Reply to External wifi antenna on the gpy on Wed, 28 Nov 2018 03:10:44 GMT]]></title><description><![CDATA[<pre><code>from machine import Pin
from network import WLAN
wlan=WLAN()
p=Pin('P12', mode=Pin.OUT)  #this pin used for antenna switching
wlan.antenna(WLAN.INT_ANT); print(wlan.antenna())
wlan.antenna(WLAN.EXT_ANT); print(wlan.antenna())
</code></pre>
<p dir="auto">this seems to work because it returns</p>
<pre><code>0
1
</code></pre>
<p dir="auto">Interestingly</p>
<pre><code>from machine import Pin
from network import WLAN
wlan=WLAN()
p=Pin('P12', mode=Pin.OUT)(True); print(wlan.antenna()) 
p=Pin('P12', mode=Pin.OUT)(False); print(wlan.antenna())
</code></pre>
<p dir="auto">does who knows what because it returns</p>
<pre><code>2
2
</code></pre>
<p dir="auto">Which makes you wonder why it's still in the docs <a href="https://docs.pycom.io/firmwareapi/pycom/network/wlan.html" target="_blank" rel="noopener noreferrer nofollow">https://docs.pycom.io/firmwareapi/pycom/network/wlan.html</a></p>
]]></description><link>https://forum.pycom.io/post/23798</link><guid isPermaLink="true">https://forum.pycom.io/post/23798</guid><dc:creator><![CDATA[kjm]]></dc:creator><pubDate>Wed, 28 Nov 2018 03:10:44 GMT</pubDate></item><item><title><![CDATA[Reply to External wifi antenna on the gpy on Wed, 28 Nov 2018 06:20:38 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.pycom.io/uid/3449">@kjm</a> <code>wlan.antenna()</code> return the value of in internal variable with the name <code>antenna_type_selected</code>, which is not change when you just set the value of the GPIO pin from your Python script.</p>
]]></description><link>https://forum.pycom.io/post/23800</link><guid isPermaLink="true">https://forum.pycom.io/post/23800</guid><dc:creator><![CDATA[robert-hh]]></dc:creator><pubDate>Wed, 28 Nov 2018 06:20:38 GMT</pubDate></item></channel></rss>