• Stars
    star
    323
  • Rank 130,051 (Top 3 %)
  • Language
    C
  • License
    Other
  • Created almost 10 years ago
  • Updated about 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

nRF OpenMesh (formerly nRF51-ble-broadcast-mesh)

Bluetooth Low Energy based rebroadcasting mesh implementation on the nRF5x called nRF OpenMesh. Works with SoftDevice S110 v8.x (for nRF51) and S132 v3.0.0 (for nRF52) with Timeslot API, and the nRF51 SDK8.1 and the nRF5x SDK 12.0.0 Offers an API for implementing your own mesh enabled application, operating concurrently with regular BLE applications.

Usage

In addition to two provided examples, there is a template project under nRF51/examples/. This may be used as a basis for your own applications, or you could choose to do it yourself from scratch. In theory, the framework should be compatible with most SoftDevice based projects, but some restrictions to hardware and software modules apply, see Resource allocation for details. The framework adds a Mesh GATT service to the SoftDevice GATT server which contain all mesh-global states. This service may be accessed by external nodes, just as any other GATT service, through a connection established via the SoftDevice. See section GATT service for details about structure and access.

Serial interface

The framework also has support for external control via SPI or UART. The serial interface is based on the nRF8001 SPI interface, with different opcodes. An application controller framework using SPI is available under application_controller, with an Arduino example to get you started. Note that the application controller requires the ble-sdk-arduino framework. This allows you to operate an Arduino along with an nRF51 dev kit in the mesh, making it easier to create mesh applications. Each nRF51 example project has a separate target (named "nRF51822 xxAA serial") that incorporates the serial interface with the rest of the project.

Getting started

The framework requires nRF51 SDK 8.1 and nRF5 SDK 12.0.0, and can be built with both Keil uVision and GCC-arm-none-eabi.

The example projects utilizes the non-pack version of the SDK, available at Nordic Semiconductor’s developer portal. Clone this repo into <SDK8-folder>/examples/<Project-folder> for nRF51 and into <SDK12-folder>/examples/<Project-folder> for nRF52

This will ensure that all references to the SDK are correctly placed, so that you don’t have to change all references to the SDK in the project files. If you still want to clone the repo into a different folder than suggested, you need to change the location of all the files under the Lib group in Keil uVision, in addition to the include paths under the menu Target options → C/C++ → Include Paths (or in the project-local makefiles for GCC).

Integrating with existing applications

The framework is built to be compatible with most existing SDK example projects, and as of v0.6.9, it is also compatible with the SDK module APP_TIMER right out of the box. In order to be compatible with the APP_TIMER module, the framework makes use of the Quadrature Decoder hardware interrupt handler for asynchronous processing. Applications which already use this hardware module must be altered to use a different interrupt for mesh processing. All async-behavior is contained in the event_handler.c file.

We’ve written a short guide to include it in existing projects with as few changes to existing code as possible. The guide uses the ble_app_proximity example from the SDK as reference, and shows a step by step approach to overcoming typical problems with integration:

Basic concepts

A rebroadcasting mesh network works by flooding all messages to all nodes in the network through broadcasts. Each time a device receives a broadcast message from some other device in the mesh, it repeats the message, or rebroadcasts it, letting its neighbors hear the new message. The neighbors rebroadcast the message to their neighbors, and the process is repeated until all devices in the mesh have received the message. This lets wireless devices talk to each other without being within direct radio range, as devices between them help relaying the messages.

The Rebroadcasting Mesh framework (hereby referred to as "the framework" or rbc_mesh) provides a connection-less, rebroadcasting infrastructure for synchronizing states across a set of BLE enabled nodes. All nodes receive all messages that are transmitted within their range, and any node may update the mesh-global states. There is no hierarchy, and no directed data links.

The framework resides on top of the nRF51 SoftDevice, utilizing the Timeslot API to allocate radio time. The framework will attempt to allocate as much time as possible, in order to listen for other nodes' messages.

All nodes in the mesh share a set of indexed data slots. The data contained at each index is propagated through the mesh with version numbers, with the objective of synchronizing the same version of the data across all nodes in the mesh. Each time a node overwrites a value, it increments the version number, and all nodes that receive a broadcast message with a version number that is higher than the one in its database, will adapt this new version of the value.

The value propagation is controlled by an implementation of the IETF RFC6206 "Trickle", a flood control algorithm for lossy, low power networks. The Trickle algorithm dynamically decides intervals at which a value will be broadcast by a node, based on how many consistent messages the node picks up, and when the last update to the state it manages was. The Trickle algorithm dynamically adapts to node density and value update frequency.

The framework provides each handle-value pair with one Trickle-instance (an isolated version of the algorithm), and utilizes a Least-recently-used cache- system to store the values. When a value falls out of the "data cache", the device stops retransmitting it, and when the value falls out of the larger "handle cache", the device also forgets which version of the value it saw last.

The mesh can be interfaced by regular BLE devices through a GATT characteristic in the Softdevice. The application is responsible for advertising and managing the external connection, and the "BLE Gateway example" displays a way to achieve such behavior.

Architecture details

  • A brief introduction to the Trickle mechanic, and overview of the API and the internal structure of the system.

  • Detailed description of Trickle, the usage of the Softdevice (including GATT characteristic syntax) and the on-air packets.

About

The "nRF OpenMesh" was created in collaboration with The Norwegian University of Science and Technology (NTNU), as part of a master’s thesis pre-study. The project is not part of the official Nordic Semiconductor SDK. Developers are welcome to contribute and provide feedback.

  • Detailed description of Trickle, the usage of the Softdevice and the on-air packets.

More Repositories

1

Android-nRF-UART

nRF UART app for Android. A simple app showing how to handle BLE with custom service in Android.
Java
199
star
2

nRF52-Bluetooth-Course

C
187
star
3

nrf52-ble-image-transfer-demo

C
115
star
4

nrf51-ble-app-lbs

Simple example application showing how to do a custom service. Fully explained in nAN-36, available on www.nordicsemi.com.
C
93
star
5

nRF52-ADC-examples

C
91
star
6

puck-central-android

Java
88
star
7

nrf5-eagle-reference-design

80
star
8

nrf-docker

Dockerfile example for building nRF Connect SDK applications with GitHub Actions
Dockerfile
72
star
9

nrf51-UART-examples

nRF51 UART examples
C
64
star
10

nrf51-powerdown-examples

Powerdown examples for the nRF51, showing wakeup from system on with RTC and GPIO and from system off from GPIO.
C
62
star
11

nRF5x-custom-ble-service-tutorial

C
61
star
12

nrf52-quadcopter

C
59
star
13

nrf52-ble-multi-link-multi-role

C
58
star
14

webapp-nordic-thingy

Thingy:52 reference web app
JavaScript
54
star
15

nrf51-pwm-library

PWM library with examples for the nRF51x22. Supports up to 4 PWM channels, and can be used with or without a SoftDevice.
C
51
star
16

nrf5-calendar-example

C
50
star
17

nrf51-ble-tutorial-advertising

This example is meant to be used togheter with the tutorial "A beginner's tutorial: Advertising" found at https://devzone.nordicsemi.com/tutorials/5/a-beginners-tutorial-advertising/. The tutorial is fairly superficial and is meant to be a hands-on introduction to BLE advertising and broadcasting of a limited payload.
C
49
star
18

nrf5-sdk-for-eddystone

Example implementation of the Eddystone GATT Configuration Service for nRF5 devices.
C
46
star
19

nrf51-ADC-examples

Examples that operate the nRF51 internal ADC
C
43
star
20

nrf-doom

C
40
star
21

nRF51-multi-role-conn-observer-advertiser

Runs an Observer or Advertiser role (timeslot API) with a Connection. Provides a HCI interface to the Observer and Advertiser. Advertiser provides SCAN REQs back to application.
C
40
star
22

nRF52-ble-long-range-demo

C
40
star
23

Nordic-Thingy52-Nodejs

Nordic Thingy:52 Node.js library example. Please see http://www.nordicsemi.com/thingy for the latest Nordic Thingy:52 news and software releases.
JavaScript
40
star
24

Nordic-Thingy52-Thingyjs

JavaScript
39
star
25

Android-Image-Transfer-Demo

Java
38
star
26

nrf51-ble-app-temp

Project for the nRF51822 that can send data to the nRF Temp smartphone apps.
C
38
star
27

IOS-nRF-For-HomeKit

Swift
37
star
28

nrf528xx-ble-throughput-demo

C
36
star
29

IOS-nRF-Beacons

Objective-C
33
star
30

nRF52-ble-app-lbs

Simple example application showing how to do a custom service. Fully explained in nAN-36, available on www.nordicsemi.com.
C
32
star
31

nrf24lu1p-snifferdemo

C
30
star
32

nRF5-universal-prog

The nrfjprog command line tool implemented in Python.
Python
30
star
33

solar_sensor_beacon

C
30
star
34

secure-dfu-web-bluetooth

Performs secure device firmware updated over-the-air via Web-Bluetooth.
JavaScript
30
star
35

Nordic-Thingy52-mesh-demo

C
29
star
36

nrf51-micro-esb

Stripped down Enhanced Shockburst library for the nRF51 series
C
27
star
37

Windows-nRF-Toolbox

nRF Toolbox source code
C#
27
star
38

nrf8001-ble-uart-spark-io

C
26
star
39

nrf51-ble-tutorial-service

C
25
star
40

j-link-monitoring-mode-debugging

Assembly
24
star
41

nrf51-ble-ancs-nus

Combination of ANCS and NUS service with iOS app
C
24
star
42

nrf5-ble-tutorial-characteristic

C
23
star
43

nRF5-flash-storage-examples

C
23
star
44

nrf52-production-programming

A guide to programming nRF52 series devices in production, along with test cases to verify implementation
Assembly
22
star
45

nRF52-teensy-sgtl5000-audio

Audio example using nRF52 DK and Teensy SGTL5000 Audio adapter
C
21
star
46

nrf52-ble-app-uart-long-range

C
20
star
47

nrf52-gtt-demos

C
19
star
48

nrf52-i2c-hid-demo

C
18
star
49

nRF51-ble-app-uart-static-passkey

ble-app-uart project modified to require a static passkey.
C
18
star
50

iOS-Image-Transfer-Demo

High throughput transfer demo for iOS
Swift
18
star
51

ble-optiboot

This directory contains the Optiboot small bootloader for AVR microcontrollers, modified to support transfer using Bluetooth Low Energy in addition to UART
C
17
star
52

nrf51-ble-micro-esb-uart

Concurrent BLE and micro-ESB wireless UART example
C
17
star
53

node-usb-cdc-acm

Userspace javascript implementation of a USB CDC ACM driver, on top of libusb.
JavaScript
16
star
54

Android-Common-Libraries

A libraries with Nordic's common code for Android apps.
Kotlin
15
star
55

nrf5-physical-web

A collection of tools and projects to help you experiment with the Physical Web by using nRF51 and nRF52 development kits from Nordic Semiconductor.
JavaScript
15
star
56

nrf51-dfu-bootloader-for-gcc-compiler

code examples of a the SDKv6.0 DFU bootloader modified to be built by gcc.
C
15
star
57

Android-Digital-Bird

The Android game that combines what best in Flappy Bird and Bluetooth Smart.
Java
15
star
58

ble-mesh-serial-interface-js

An npm package for Node.js that provides an API to control a router node in a BLE mesh network via the serial port.
JavaScript
15
star
59

nrf52-rocket

C
13
star
60

thingy52-mesh-provisioning-demo

C
13
star
61

nrf52-drv-gpio-example

C
13
star
62

nrf51-TIMER-examples

Simple TIMER example for nRF51, both for timer and counter modes
C
13
star
63

ble_app_hrs---LongWrite

Example on long write (long characteristic)
C
13
star
64

pc-nrfconnect-ble-standalone

JavaScript
13
star
65

nrf52-capsense-example

C
11
star
66

nRF52-clients-for-serial-LTE-modem

C
11
star
67

nrf51-dfu-single-bank-ble

Single bank bootloader for DFU over BLE (nRF51, S110 v7.0+, SDK6.0+)
C
11
star
68

nRF52840-ble-secure-bootloader

C
11
star
69

thread_border_router

Thread Border Router based on OpenWRT and wpantund
Shell
11
star
70

nrf52-esb-ccm-example

C
11
star
71

nRF5-multi-prog

Program multiple nRF5 devices concurrently with this nrfjprog inspired python module/exe
Python
10
star
72

nRF51-ble-peripheral-bond-handling

Uses device manager peripheral with app context to identify the oldest bond
C
10
star
73

nrf-knx-iot

Implementation of KNX IoT over Thread
C
10
star
74

nrf70-linux-driver

Linux driver for the nRF70 series of ICs
C
10
star
75

nrf51-ble-gzll-device-uart

C
10
star
76

nrf91-pizza

Source code for the nRF91 Pizza web application
JavaScript
10
star
77

nRF52-flash-patch

Flash Patch library and example on Nordic Semiconductor's nRF52 Series Device
C
10
star
78

nrf51-dfu-ble-S130

OTA DFU example for S130 based on DFU example in SDK v6.1
C
9
star
79

nrf52840-ble-app-hrs-usb-audio

C
9
star
80

nrf-mesh-freeRTOS-example

C
9
star
81

nrf-esl-bluetooth

C
9
star
82

arduino-primo-iot-examples

Extension to nRF5 IOT SDK with examples for Arduino Primo
C
9
star
83

nrfconnect-chip-docker

Shell
9
star
84

nrf51-8-mhz-gpio-clock

A simple project showing how to use the a TIMER and GPIOTE, connected with the PPI to toggle an I/O at 8 MHz.
C
9
star
85

ncs-display-ble-example

C
8
star
86

nrf51-ble-dfu-symmetric-signing

Symmetric signing example for the SDK bootloader using a SHA256-based HMAC
C
8
star
87

nrf51-watchdog-resetreas-example

Demonstrates the use of the watchdog, System Off and displays RESETREAS register
C
8
star
88

nrf52-mesh-light-switch-client-server-proxy

C
8
star
89

puck

CSS
8
star
90

nrf52-hardware-startup-hands-on

C
7
star
91

nrf52-ble-app-uart-relay

C
7
star
92

nRF51-ble-app-hrs-s130

This example shows how a S130 application can be set up with the same structure as the SDK examples
C
7
star
93

nrf52-esb-broadcaster

C
7
star
94

nRF-Beehavior-Firmware

C
7
star
95

nordic-ot-border-router

Nordic OpenThread Border Router
7
star
96

nrf51-app-button-example

Example demonstrating the button handling library
C
7
star
97

ble-sdk-efm32

C
6
star
98

nrf52-timer-gpiote-ppi-hands-on

C
6
star
99

ANT-Shared-Channel-Demo

A demo of the ANT Shared Channel sample from SDK 7.2.
Objective-C
5
star
100

nrf52-ble-app-uart-c-multilink

C
5
star