Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    wifi antenna default

    Scheduled Pinned Locked Moved Discussion
    6 Posts 2 Posters 89 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K Offline
      kjm
      last edited by

      https://docs.pycom.io/firmwareapi/pycom/network/wlan/ says pycom modules default to the internal antenna for wifi but when I run

      from network import WLAN
      wlan=WLAN(mode=WLAN.STA)
      print('antenna', wlan.antenna())
      

      I get

      antenna 2
      

      since 0=internal & 1=external, 2 seems a tad ambiguous. I'm wondering if I need to run

      Pin('P12', mode=Pin.OUT); wlan.antenna(WLAN.INT_ANT)
      

      just to be sure?

      1 Reply Last reply Reply Quote 0
      • G Offline
        Gijs
        last edited by

        That is quite odd, as when I run the same code on my device:

        >>> from network import WLAN
        >>> wlan=WLAN(mode=WLAN.STA)
        >>> print('antenna', wlan.antenna())
        antenna 0
        

        Refering to the internal antenna. Which firmware version are you running and are you perhaps using pybytes on boot?

        Gijs

        K 1 Reply Last reply Reply Quote 0
        • K Offline
          kjm @Gijs
          last edited by kjm

          @Gijs tried it on 3 different devices

          (sysname='LoPy4', nodename='LoPy4', release='1.20.0.rc13', version='v1.9.4-94bb382 on 2019-08-22', machine='LoPy4 with ESP32', lorawan='1.0.2', sigfox='1.0.1')
          (sysname='LoPy4', nodename='LoPy4', release='1.18.2.r1', version='v1.8.6-849-e0fb68e on 2018-11-26', machine='LoPy4 with ESP32', lorawan='1.0.2', sigfox='1.0.1')
          (sysname='GPy', nodename='GPy', release='1.20.1.r1', version='15b6d69 on 2019-11-02', machine='GPy with ESP32')
          

          all give 2 as the result, no pybytes.

          1 Reply Last reply Reply Quote 0
          • G Offline
            Gijs
            last edited by

            Okay I looked into it in more detail and was able to reproduce it (I accidentally set it in a previous applications, and did not power off in between)

            so, antenna = 2 refers to ANTENNA_TYPE_MANUAL if you did not use its keyword argument in wlan= WLAN() or wlan.init(...) or the function wlan.antenna(..), meaning you can select the antenna manually by setting pin P12. In most cases, this defaults to the use of the internal antenna, as P12 is not asserted by default. To be sure, you should set the antenna type, but it is not necessary

            Gijs

            K 1 Reply Last reply Reply Quote 1
            • K Offline
              kjm @Gijs
              last edited by

              @Gijs understood, thnx

              1 Reply Last reply Reply Quote 0
              • G Offline
                Gijs
                last edited by

                I will add an entry to the documentation and a micropython constant for MAN_ANT to make this more clear, thanks!

                1 Reply Last reply Reply Quote 0

                Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                With your input, this post could be even better 💗

                Register Login
                • 1 / 1
                • First post
                  Last post

                Pycom on Twitter

                Pycom