pygatt icon indicating copy to clipboard operation
pygatt copied to clipboard

A little help for the confused ? :)

Open cinoaz opened this issue 7 years ago • 4 comments

I'm new to Python, new to BLE, I'm swimming in an ocean. I'm learning but it just seems a bit too much shotgun approach. Maybe someone can help with a series of links on how to get started.

  1. Does a standard Bluetooth adapter on my Windows 10 laptop work with Pygatt or do I need a specific USB device?
  2. Are there a series of links, videos, or whatever to help me learn Pygatt? I have done programming in the past but not so much "From scratch". I usually start from a known working point and add/remove/update from there. I'm not adverse to learning, given tho I'm closer to 50...then say 40....but this BLE interface is new and anything new is daunting.
  3. I'm using the Eclipse IDE, installed Python 3.6, added Pygatt libraries and verified import and everything works. I can query device on my laptop but when I try to connect to an external device, say to my Cell phone (Android Phone, captured Bluetooth address from (Phone->About) I get error messages indicating cannot open device to send.
  4. Again, no problem doing the legwork, I just have no idea what path, where that path is, to start to learn...

Any guidance is appreciated !

cinoaz avatar Dec 13 '18 18:12 cinoaz

  1. see response to Issue #203
  2. Just the homepage of the repo. I had to make a few source code changes as described in some of the issues.
  3. Your phone is typically a central, not a peripheral, device. It is usually not advertising. You need some kind of peripheral BLE device like a FitBit or BLE development board. I am connecting to a Nordic nRF52832 built into the Adafruit Feather nRF52 Bluefruit. I am using the Nordic UART Service so I can implement a wireless serial port connection.

wstreyer avatar Dec 13 '18 19:12 wstreyer

Thanks @wstreyer! We recently merged another sample program that might help you get started, but if you are brand new to BLE you probably want to dig around for general resources on the web. I won't claim that pygatt is good for beginners.

peplin avatar Mar 30 '19 21:03 peplin

@wstreyer can I connect my laptop (central) and android device (peripheral) using pygatt. Asking this because you said:

Your phone is typically a central, not a peripheral, device. It is usually not advertising.

If I make an app on android that will be advertising, and then I'd be able to do the scan and connection using pygatt?

WarishaAli avatar Apr 02 '20 12:04 WarishaAli

@WarishaAli In theory, yes. If you're using Windows 10 you'll need the ble112 dongle to use your PC as a central and connect to your peripheral.

As @wstreyer said, usually the phone is used as a central device. I haven't seen many examples of using a phone as a BLE server. If you're planning to use your phone to communicate with your laptop through BLE, I think there are better and easier ways to do this. For example, using traditional Bluetooth or WiFi.

If you just want to learn BLE it is worth investing in a small BLE device that you can easily program as a peripheral and then connect through pygatt. For instance, esp32 has a ble library and it's an inexpensive piece of hardware.

That being said, I think that could be the best starting point to learn BLE, creating your own peripheral on a small piece of hardware like the esp32. Good luck!

CLDiego avatar Apr 02 '20 12:04 CLDiego