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

Re-phrasing Bluetooth section #181

Merged
merged 1 commit into from
Oct 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bluetooth/apps-and-examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ lang: en

Bluetooth applications can run on a variety of devices, including but not limited to smart phones and tablets. You can also run Bluetooth enabled applications on devices such as a Raspberry Pi.

Below is a curated list of some Bluetooth applications you might like to read about and try for yourself with your micro:bit. Please contribute to this list if you know of any more. Many listed here are take from the [micro:bit Awesome list](https://github.com/carlosperate/awesome-microbit)
Below is a curated list of some Bluetooth applications you might like to read about and try for yourself on your micro:bit. Please contribute to this list if you know of any more. Many listed here are taken from the [micro:bit Awesome list](https://github.com/carlosperate/awesome-microbit)

## Applications, tools and examples

Expand Down
7 changes: 4 additions & 3 deletions bluetooth/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ Using Bluetooth, you can connect to other devices and send and receive data from

## micro:bit Bluetooth Features

Bluetooth features available on the micro:bit are defined in a [Bluetooth profile](/bluetooth/profile). The micro:bit supports one, custom developed profile.
Bluetooth features available on the micro:bit are defined in a [Bluetooth profile](/bluetooth/profile). The micro:bit supports one, custom-developed profile.

## Bluetooth and the micro:bit software

The [DAL/C++](https://lancaster-university.github.io/microbit-docs/ble/profile/#reference-documentation) lists the adopted and custom features available within the profile. [MakeCode](https://makecode.microbit.org/reference/bluetooth) contains a set of blocks to make use of the various micro:bit services.
The [DAL/C++ reference documentation](https://lancaster-university.github.io/microbit-docs/ble/profile/#reference-documentation) lists the adopted and custom features available within the profile. [MakeCode](https://makecode.microbit.org/reference/bluetooth) contains a set of blocks to make use of the various micro:bit services.

The processor also has a number of non-bluetooth proprietary modes of operation, on which we build the micro:bit radio protocol. This only works between micro:bits and is what is defined as 'Micro:bit Radio' in the DAL and 'radio' in MakeCode and MicroPython, as well as Mbed C++.
The processor also has several non-bluetooth, proprietary modes of operation upon which the micro:bit radio protocol is based. This protocol works only between micro:bits and is defined as 'Micro:bit Radio' in the DAL and 'radio' in MakeCode, MicroPython, and Mbed C++.

## Apps

Expand All @@ -42,3 +42,4 @@ Scratch.
## Further information

- [Bluetooth Specification](https://www.bluetooth.com/specifications/adopted-specifications)
- [DAL/C++ Bluetooth Reference Documentation](https://lancaster-university.github.io/microbit-docs/ble/profile/#reference-documentation)
27 changes: 14 additions & 13 deletions bluetooth/profile.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,36 @@ lang: en

## Overview

The micro:bit supports Bluetooth via a single BBC micro:bit profile which was custom developed for the device. This profile allows it to communicate with other BLE capable devices.
The micro:bit supports Bluetooth via a single, custom-developed, BBC micro:bit profile. This profile allows it to communicate with other BLE capable devices.

If you are looking for information about the 'radio' feature, it is a [proprietary protocol from Nordic and Lancaster University](https://lancaster-university.github.io/microbit-docs/ubit/radio/). This is not Bluetooth and the difference is described further in [this article on using the micro:bit wirelessly](https://support.microbit.org/support/solutions/articles/19000083637-using-the-micro-bit-wirelessly-)

## BBC micro:bit Bluetooth Profile

The BBC micro:bit [Bluetooth profile is defined in the DAL](https://lancaster-university.github.io/microbit-docs/ble/profile/)

You can flash a pre-compiled Hex files, to the micro:bit that enables bluetooth services.As Bluetooth is memory intensive, these are supplied as either 'without Magnetometer Service' or 'without DFU Service':
You can flash one of two pre-compiled Hex files to the micro:bit that enable bluetooth services. As Bluetooth is memory intensive, these are supplied as either 'without Magnetometer Service' or 'without DFU Service':

[Without magnetometer](/docs/bluetooth/assets/BLE_All_Services_DAL_2-1-1-No-Mag.hex)
[Without DFU](/docs/bluetooth/assets/BLE_All_Services_DAL_2-1-1-No-DFU.hex)
- [Without magnetometer](/docs/bluetooth/assets/BLE_All_Services_DAL_2-1-1-No-Mag.hex)
- [Without DFU](/docs/bluetooth/assets/BLE_All_Services_DAL_2-1-1-No-DFU.hex)

The DAL contains the [C++ source for the BLE service files](https://github.com/lancaster-university/microbit-samples/blob/master/source/examples/bluetooth-services/main.cpp)

There are also some example programs in the [microbit-samples](https://github.com/lancaster-university/microbit-samples) repository:

[bluetooth-eddystone-uid]https://github.com/lancaster-university/microbit-samples/tree/master/source/examples/bluetooth-eddystone-uid
[bluetooth-eddystone-url]https://github.com/lancaster-university/microbit-samples/tree/master/source/examples/bluetooth-eddystone-url
[bluetooth-uart]https://github.com/lancaster-university/microbit-samples/tree/master/source/examples/bluetooth-uart
- [bluetooth-eddystone-uid]https://github.com/lancaster-university/microbit-samples/tree/master/source/examples/bluetooth-eddystone-uid

- [bluetooth-eddystone-url]https://github.com/lancaster-university/microbit-samples/tree/master/source/examples/bluetooth-eddystone-url

- [bluetooth-uart]https://github.com/lancaster-university/microbit-samples/tree/master/source/examples/bluetooth-uart

The micro:bit has a Bluetooth 4.1 stack with Bluetooth Low Energy (BLE) and supports the [GAP Peripheral Role](https://bluetooth-developer.blogspot.com/2016/07/microbit-and-bluetooth-roles.html).

As per all Bluetooth, it operates in the ISM (Industrial Scientific Medical) band and this starts at **2.4GHz and ends at 2.41GHz**. BLE divides the frequency band into 50 x 2MHz bands of which 40 are used.
These are called **channels** and numbered **0 to 39**.
Channels 37, 38 and 39 are used for “advertising”.
It operates in the ISM (Industrial Scientific Medical) band, as per all Bluetooth devices. This starts at **2.4GHz and ends at 2.41GHz**. BLE divides the frequency band into 50 x 2MHz bands of which 40 are used. These are called **channels** and numbered **0 to 39**. Channels 37, 38 and 39 are used for "advertising".

When devices are connected, they use the other channels in a particular sequence controlled by a feature called **adaptive frequency hopping**.
This helps reduce the impact of congestion from other radio users.
When devices are connected, they use the other channels in a particular sequence controlled by a feature called **adaptive frequency hopping**. This helps reduce the impact of congestion from other radio users.

Data transfer rates will only be a few 100K per second at best and it very much depends on how your application uses the Bluetooth features; lots of small temperature containing packets would have a lower data transfer rate than using the UART service, as it depends on the proportion of system protocol information vs. application data.
Data transfer rates will only be a few hundred Kilobytes per second at best, and throughput depends on how your application uses the Bluetooth features. Throughput depends on the proportion of system protocol overheads to application data. Lots of small packets containing - for example - temperature data would have a lower data transfer rate than using the UART service.

There are some useful [advanced configuration options in the micro:bit runtime code](https://lancaster-university.github.io/microbit-docs/advanced/#compile-time-options-with-yotta)

Expand All @@ -60,3 +59,5 @@ We are seeking collaborators to help us define the new profile elements that exp
- [Original micro:bit "Out of the Box" experience](https://support.microbit.org/a/solutions/articles/19000021613), including some of the attributes in the Bluetooth Profile

- [Full profile with the display unused](https://lancaster-university.github.io/microbit-docs/resources/microbit-1_4_17_pwr0.zip). If you want to write to the display over bluetooth then you should use this file instead of the 'Out of the Box' hex, which uses the display.

- [micro:bit radio API documentation](https://lancaster-university.github.io/microbit-docs/ubit/radio/)