Code Monkey home page Code Monkey logo

bleproof-collection's Introduction

BLEProof-collection

Collection of sample Bluetooth Low Energy applications for iOS, Android, ESP32 and Arduino Nano 33 IoT.

What they do

The apps implement basic BLE communication:

  • Central scans for Peripheral and connects to it
  • Central reads a value from Peripheral
  • Central writes a value to Peripheral
  • Peripheral notifies Central that a value has changed

Each BLE Central is compatible with each BLE Peripheral, because they use the same service and characteristics UUIDs.

Screenshots

Android BLE Central iOS BLE Peripheral
Screenshot Android Central Screenshot iOS Peripheral

ESP32 BLE Peripheral (Arduino Serial Monitor)

Screenshot of ESP32 BLEProofPeripheral

How to run

To run and see it working, you need 2 physical devices supporting Bluetooth Low Energy:

...and some development tools:

Supported devices

Platform Peripheral Central Notes
Android YES YES Android 5.0 and newer, including Android 12
iOS YES YES iOS 11.0 and newer
ESP32 YES YES
Arduino Nano 33 YES YES Tested on Arduino Nano 33 IoT, but should work on any board compatible with ArduinoBLE library

Table of UUIDs

Name UUID
Service 25AE1441-05D3-4C5B-8281-93D4E07420CF
Characteristic for read 25AE1442-05D3-4C5B-8281-93D4E07420CF
Characteristic for write 25AE1443-05D3-4C5B-8281-93D4E07420CF
Characteristic for indicate 25AE1444-05D3-4C5B-8281-93D4E07420CF

BLE Peripheral (all platforms)

Peripheral (also called Slave or Server) works similarly on all platforms:

  • Advertises a service with our UUID (see Table of UUIDs)
  • The service contains 3 characteristics:
    • for read - has only read permission (see Table of UUIDs)
    • for write - has only write permission (see Table of UUIDs)
    • for indication - supports only indications (see Table of UUIDs)
  • Allows the user to change the string value of the characteristic for read
  • Allows the user to change the string value of the characteristic for indicate
  • Allows the user to send an indication with updated string value to the connected Central

Note 1: technically characteristics can have any amount of permissions (read, write default, write without response, notify, indicate), but in this project each characteristic has only one permission for simplicity.

Note 2: indication is a notification with response - Peripheral notifies, Central confirms that notification received.

BLE Central (all platforms)

Central (also called Master or Client) works similarly on all platforms:

  • Scans for Peripherals which have a service with our UUID (see Table of UUIDs)
  • Connects to the first found Peripheral
  • Discovers services and characteristics of the connected Peripheral
  • Subscribes to indications of the "Characteristic for indicate" (see Table of UUIDs)
  • Allows the user to disconnect from Peripheral
  • Allows the user to read a characteristic value (string) from Peripheral
  • Allows the user to write a characteristic value (string) to Peripheral

Recommended resources

Android BLE (usually articles cover only BLE Central role):

Android BLE Peripheral role (less popular topic):

iOS:

BLE utility apps

LightBlue: for iOS, for Android

BLE Scanner: for iOS, for Android

bleproof-collection's People

Contributors

alexanderlavrushko avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.