Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BLE Beacon example #616

Open
Avamander opened this issue Aug 20, 2020 · 7 comments
Open

BLE Beacon example #616

Avamander opened this issue Aug 20, 2020 · 7 comments

Comments

@Avamander
Copy link
Member

It would be nice to have a BLE beacon example using this library.

Here's a technical description of how it can be done: http://dmitry.gr/index.php?r=05.Projects&proj=11.%20Bluetooth%20LE%20fakery

@TMRh20
Copy link
Member

TMRh20 commented Aug 20, 2020

Are you familiar with https://github.com/floe/BTLE ?

The code looks pretty similar to the link you posted, but most of the hard stuff is done in the library, so the user API is relatively simple. Its based on this library, so if we wanted to adapt an example, I think it should be relatively easy.

@Avamander
Copy link
Member Author

Hmm, I wasn't familiar with it.

I guess a really minimal example and a link to the BTLE library would be the best solution. Just to show what can be done and how to potentially do it even nicer.

@TMRh20
Copy link
Member

TMRh20 commented Aug 21, 2020

That sounds reasonable, show how to configure the radio and do it manually while linking the BTLE lib. I was intending to get into the existing examples recently for some review/cleanup, but got stuck digging into issues and fixing bugs instead. (Pretty happy with the results tho) I prob won't be able to help much on this for a while.

@2bndy5
Copy link
Member

2bndy5 commented Sep 17, 2020

there are several proof-of-concept examples. Although I keep coming back to this blog post (a little more visual) which includes a link to the source code on github that was used in the post. However, that code doesn't use this library as a dependency, rather it uses a minimal structure to control the nRF24L01 with an Arduino. In the way of adding an example to this library as an "official" proof-of-concept, were you thinking about an advertising example or a listening example (or both)?

@2bndy5
Copy link
Member

2bndy5 commented Sep 18, 2020

I know this is a little off-topic, but TBH I'd be more interested to see a Gazelle-based implementation that might act as a OTA bridge to the micro-bit (or other nRF5xxx-based devices), specifically an example towards the makecode.com's radio blocks. However that is a different issue and may require a separate repo due to the pairing & link layer differences

@2bndy5
Copy link
Member

2bndy5 commented Sep 29, 2020

I've been adding this concept to my CircuitPython library and I noticed that the BTLE library that @TMRh20 mentioned does not offer broadcasting the "TX power level" (GAP assigned number 0x0A) which only occupies 3 bytes (including pa_level value) and could be used by BLE scanning applications to determine the relative proximity ("perceived pa_level" - "broadcasted pa_level") to the broadcasting nRF24L01. It might be cool to work this into the example for this library.

So far I've managed to max out the FIFO when transmitting the device name as "nRF24L01", the "TX power level", and a battery charge (as integer percentage). It should be noted that iPhones should respond to PDU types 0x40 & 0x42, but Androids only respond to PDU type 0x42. Literally any other device will pick up advertisements using either PDU type (Windows PC, MAC desktop, & Chromebook verified).

@2bndy5
Copy link
Member

2bndy5 commented Oct 20, 2020

@Avamander would you be ok if we just add a link to the BTLE library in the docs (somewhere)? Because there are issues with certain iPhones that I would like to avoid on this repo. Also, that library does more than I would be willing to support (nudge to the #658 about quantity harder to maintain), namely receiving BLE payloads (which involves trying to de-whiten, swap bits, & decipher from BLE data structures).

@2bndy5 2bndy5 self-assigned this Oct 27, 2020
@2bndy5 2bndy5 removed their assignment Dec 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants