Sipy does not detect phone via Bluetooth



  • 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)



  • @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.



  • This post is deleted!


  • @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).



  • @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.



  • @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.


 

Hello World?

Pylife on Kickstarter - November 2018








Back Us On Kickstarter >

Pycom on Twitter