Particle BLE (Bluetooth Low Energy)

Particle devices support both the peripheral and central BLE roles.   The Boron/Argon/Xenon may use the built-in chip or trace antenna, or an external BLE/Mesh antenna.   BLE is supported in Device OS 1.3.1 and later.  

BLE range is limited to about 10 meters.   The interval for advertising ranges from 20 milliseconds to 10.24 seconds.   Central devices do not advertise.  

For a mobile phone app to 3rd Gen device scenario, the phone would be the Central BLE device, and the Boron/Argon/Xenon would be the Peripheral.   Typically the Advertising payload method is used by the Peripheral.   If the amount of data the peripheral needs to send is small enough, it can be included in the advertising payload and eliminate the need to establish a connection with the Central device.   If the amount of data is too large for the Advertising payload, then a connection will need to be established with the central device, and then data exchanged using the GATT services.  

Communication Options

Advertise Only to Primary Channels

A peripheral always starts with advertising before accepting a connection.   Within the advertisement packet is a small amount of custom data (23 bytes) that can be transmitted and immediately received by a bluetooth app without making a bluetooth connection.   With 23 bytes, you can send about five floating point values packaged in four bytes each, plus a flag byte to cycle between multiple assignments for those five floating point values.   At a transmission rate of 100 ms, you could create a numeric display that could update five values on the display with every bluetooth advertisement.   The only downside to this is that the bluetooth mobile app needs custom programming to manage that custom data stream.  

A byte stores an 8 bit unsigned number from 0 to 255.   An integer from -32768 to 32767 requires two bytes.   A boolean (8 bit) A float is stored as 32 bits (4 bytes) and ranges from 3.4028235E+38 and as low as -3.4028235E+38.   A double is stored as 8 bytes

How Bluetooth Low Energy Works: Advertisements

Make the most of Bluetooth LE advertising mode

Particle BLE docs

Adafruit BLE tutorial

BLE GATT Services

The Ultimate Guide

Particle tutorial on Gen 3 using Bluetooth or NFC

Adafruit Bluefruit LE UART Friend

Online GUID Generator

 

BLE & nRF52840

Using Arduino BLEPeripheral library with nRF52840

hackaBLE nRF52832 based BLE

Arduino Core for Nordic Semiconductor nRF5 based boards on GitHub by sandeepmistry

iBeacon location aware Xenon


Particle library: BLE_Group
https://github.com/particle-iot/ble-group-library
Implements star configuration with one BLE Central and one or more 
Peripherals, where the Central relays the published messages from 
a peripheral to all other peripherals. 
When employed, Particle publish and other cloud functionality disabled.  
Use up to 3 max Xenons as peripherals and Argon/Boron as Central. 

 

BLEPeripheral library

BLEPeripheral by Sandeep Mistry


particle library add BLEPeripheral

See also:


BleSerialPeripheralRK
https://github.com/rickkas7/BleSerialPeripheralRK

 


// Below is Arduino BLEPeripheral library for creating custom BLE 
// peripherals with Nordic Semiconductor's nRF8001 or nR51822.
// (Particle Boron/Argon/Xenon use nRF52840 chip)
// This library is also included in the full Blynk library, but
// not the library that is included in the Particle "Blynk" 
// library install. 
// https://github.com/sandeepmistry/arduino-BLEPeripheral
// https://www.arduinolibraries.info/libraries/ble-peripheral
#include <BLEPeripheral.h>

 

Building Mobile Phone Apps (for BLE)

NativeScript

NativeScript

NativeScript BLE plugin

 

Blynk

As of May 2019, the Blynk server is still involved when using the Blynk library for BT/BLE communications: DEVICE <–BT/BLE–> APP <–networking–> SERVER

Blynk

Blynk Particle library on GitHub

Blynk library on GitHub

Adafruit Bluefruit BLE example

Using Blynk with Boron / Argon

Particle Webhook to Blynk by Jarad Wolff

Boron data to Blynk by Luca Cavallin

Photon door lock & Blynk by Tom Nardi

Argon using #include blynk.h

Particle Electron

ZeRGBa widget example

Blynk to Argon via BLE

Blynk to any Arduino via USB

Blynk app BLE communication to Arduino 101 by Noah Huber-Feely

Blynk Bluetooth Example

/*************************************************************
  Blynk library is licensed under MIT license
  This example code is in public domain.
 *************************************************************/

#define BLYNK_PRINT Serial  // Set serial output for debug prints
//#define BLYNK_DEBUG       // Uncomment this to see detailed prints

// Below required for bluetooth BLE communication
#include <BlynkSimpleSerialBLE.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";

void setup()
{
    Serial.begin(9600);
    delay(5000); // Allow board to settle

    BLESerial.begin();
    Blynk.begin(BLESerial, auth);
}

void loop()
{
    Blynk.run();
}

 

MIT App Inventor

MIT App Inventor

 

How to build a cross-platform Iot Mobile App with Nativescript by Brandon Satrom

NativeScript Particle plugin   GitHub repo   plugin docs

Particle IoT Mobile Apps using NativeScript by Jared Wolff

How to Use Particle's Powerful Bluetooth API On Your Xenon, Boron or Argon by Jared Wolff

NativeScript Particle plugin

Controlling Robots with NativeScript Bluetooth

 

Intra Device BLE Communication

BLE locally connecting to publish data quickly

 


Do you need help developing or customizing a IoT product for your needs?   Send me an email requesting a free one hour phone / web share consultation.  

 

The information presented on this website is for the author's use only.   Use of this information by anyone other than the author is offered as guidelines and non-professional advice only.   No liability is assumed by the author or this web site.