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

    Sipy does not detect phone via Bluetooth

    Scheduled Pinned Locked Moved SiPy
    bluetoothscansipy
    6 Posts 2 Posters 835 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.
    • B Offline
      brossingo
      last edited by

      Hey everyone,
      I am new with Pycom and working with a Sipy board, using Atom as IDE. I am trying to do something very classic which consists in pairing my Sipy device with my phone (which is an iPhone 6) via Bluetooth. This is the documentation I carefully relied on (https://docs.pycom.io/firmwareapi/pycom/network/bluetooth). However, when I scan and print the ''addresses'' found, no one corresponds to my own phone's MAC address. I did the same with another phone (Android this time) and I might have results, but none of them matches again. I actually get random MAC addresses which change every time I run my code and I have no idea where they come from. When I still try to connect, it says ''connection refused''. I also read somewhere that the phones have to have BLE and not simple Bluetooth only, which I checked. So I would like to know what I did wrong (you can find my code below) and maybe if you could tell me where the random addresses come from.
      Thanks for helping

      import network
      from network import Bluetooth
      import ubinascii
      import time

      bluetooth=Bluetooth()
      #bluetooth.init()
      bluetooth.start_scan(-1)
      time.sleep(0.5)
      adv=bluetooth.get_adv()
      while True:
      print(adv.mac)
      print(ubinascii.hexlify(adv.mac))
      time.sleep(0.5)

      E 1 Reply Last reply Reply Quote 0
      • E Offline
        Eric73 @brossingo
        last edited by

        @brossingo It seem that actually pycom bluetooth stack is for BLE only. Your phone seem to advertise in Bluetooth (not BLE version).
        You can download (on play store for and android phone, for apple i dont know) "nrf connect" from nordic semi conductor (a BLE chip manufacturer) , with this tool you can advertise BLE with your phone (if your phone is able to do this) and be seen by your pycom device (have a look to MAC adress you advertise with this tool, you can use a different one than your phone mac base adress).

        Other things, the code you provide only scan for BLE advertiser one time as your bluetooth.get_adv() is outside the while loop and doesn't test if adv is not None.

        1 Reply Last reply Reply Quote 1
        • B Offline
          brossingo
          last edited by

          @Eric73 thanks for the answer. I downloaded the software as suggested and now I can detect my SiPy board with my phone and vice versa. However, when I try to connect my SiPy board to my phone via Bluetooth, the connection is always refused and I do not even have a message indicating that my device is trying to connect with my phone.

          E 1 Reply Last reply Reply Quote 0
          • E Offline
            Eric73 @brossingo
            last edited by

            @brossingo So ,in brief , your phone settings is connectable in nrf tool->advertiser and you use bluetooth.connect() in your python code that's rigth ?
            What is the return value of of bluetooth.connect() ?
            In BLE you don't have pin code to exchange so no popup on android phone i suppose when connection is set (btw i never try this way of communication) and perhaps your communication is set silently (on sipy side if bluetooth.connect() return then the link is up).

            B 2 Replies Last reply Reply Quote 0
            • B Offline
              brossingo @Eric73
              last edited by

              This post is deleted!
              1 Reply Last reply Reply Quote 0
              • B Offline
                brossingo @Eric73
                last edited by

                @eric73 thanks again. Indeed I was expecting like a popup or message or anything. I just did bluetooth.connect(mac_addr) ad if connected, print something. And it turns out to that the connection was indeed established but silently yes.

                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