Adding Bluetooth Low-Energy Connectivity to a Mote

We detail how we used an nrf8001 Bluetooth low-energy (BLE) breakout board from Adafruit to demonstrate remote configuration of a mote.


A typical sensor device integrated with a SmartMesh IP mote will need to be configured in some way while deployed in the field.  Since most of these devices are designed for extremely long battery life, they often do not have a user interface, which limits the options for configuring to the device. 

By adding BLE capability to the sensor device, configuration can be accomplished with a cell phone that supports BLE, such as an iPhone. This example shows how BLE connectivity can be easily added to the device with a direct connection to the SmartMesh IP mote.


This sample application showcases using the OCSDK to interface the mote to a Nordic Semiconductor nrf8001 BLE chip. We chose the nrf8001 because it was one of the few BLE chips available that supported an SPI slave interface. The OCSDK stack currently only supports being an SPI master.

For the purpose of this demo, two software components are needed, namely an iPhone application for the user interface and a mote application running on the SmartMesh IP device to receive commands from the BLE device. Adafruit provides an iOS demo application (the BlueFruit LE Connect iOS app) that connects to the nrf8001 and supports the sending and receiving of short text strings.  The mote sample application created here implements a get and set network ID command, a "join" command, a "reset" command. Note that any number of additional commands or security for the BLE connection can be implemented: this small subset was selected to keep the example simple.

The nrf8001 uses an SPI-like interface they call ACI.  Transactions are asynchronous - the master (the LTC5800) sends a command, and the nrf8001 uses the RDYn line to indicate that a response is available to be retrieved by the master.  Incoming BLE data also is signaled by the nrf8001 RDYn line.  

Since transactions are asynchronous, it is possible to send a command while receiving incoming data or a response to a previous command.  The application could handle this by always transferring a maximum (32-byte) SPI buffer for each master transaction, but the mote SPI bus allows for more flexibility than that. Rather than using one of the built-in slave-select lines, the application uses an output line (S_MOSI) to stop the SPI transfer after receiving the incoming header. It decides which packet (incoming or outgoing) is longer, and only clocks out the needed bytes to send in each direction.  

Hardware Connection

LTC5800 pinDirection (from LTC5800)nrf8001 pinNotes
SPI Master clock
SPI Master input
SPI Master output
Used in place of slave select (active low)
Signals that the nrf8001 is ready to transfer asynchronous data (active low)

No connect
nrf8001 reset (active low)

No connect


3.6 volts

Mote CLI commands

The sample app adds two CLI commands to the basic set provided by the stack:

  • send - once connected, this command allows you to send text strings (<= 20 bytes) to the iOS Connect application. It prints an error if there is no BLE connection
  • reset - resets the mote (and the nrf8001 chip)

Running the Demo

Connect to the mote CLI (9600 baud, 8 data bits, 1 stop bit, no parity) to view mote prints.

When the mote boots, you will see the following screen (assuming the nrf8001 is properly connected):

nrf8001 app, ver
SmartMeshIP stack, ver
Setting up BLE chip...
Ready for remote connection...

At this point you can use the Adafruit BlueFruit LE Connect iOS app to connect to the nrf8001:


Select the UART connect button. This will bring up a menu of interfaces - select the UART for the connection mode. Once connected, he mote CLI will show that a peer has connected.

Connected to peer

At this point, the BlueFruit LE Connect app will display a text window for entering commands:

The following remote commands are available:

  • getnetid gets the current netid setting from the mote
  • getstatus - gets the current mote status (idle, joining, operational, or disconnected)
  • join - causes the mote to begin searching for the network with the currently configured netid
  • reset - resets the mote, which also resets the BLE chip. BlueFruit LE Connect will tell you that the nrf8001 has disconnected
  • setnetid <netid> - sets the netid on the mote

The mote will print out messages for each command received via the nrf8001, e.g. 

Data received = getnetid
Remote command: getnetid, returning netid = 293
Data received = setnetid 295
Changing network ID to 295
Data received = join
179017 : Joining
180764 : Connected
189045 : Active
Data received = reset

Source Code

The source code has been tested with release 1.1.07 of the On-chip SDK.  Utility files from Nordic Semiconductor are subject to their licensing terms.  All other files subject to the OCSDK licensing terms.