Smart Mesh Network

Smart Mesh Networking with Bluetooth Low Energy = CSRmesh™
Inside the CSRmesh™ 1.0

The CSRmesh is an implementation of a flood mesh network using only Bluetooth Low Energy 4.0 (a.k.a. Bluetooth Smart) broadcast and scan transport mechanisms. It is designed mainly for home automation use, including light control, heating, access etc. It does not require making connection or maintaining a connection in order to send or receive commands. It is independent of the standard GATT protocol and can be used at the same time while maintaining an incoming connection.

The implementation has advantages over a routed mesh such as used with Zigbee for commercial lighting applications. Adding or removing new members to the mesh does not require any management. All devices can be monitored and controlled via a standard smartphone. No hub or access point is required eliminating the need of managing an infrastructure.

Mesh messages are repeated if necessary to extend the range beyond the range of single nodes. Each node can implement the relay function. The communication is encrypted on a per message basis allowing only members of the mesh to understand the commands. A network key used for this encryption is generated from a pass phrase on the mesh controller and is securely distributed from the smartphone to the members. Infinite retransmissions are prevented by not relaying messages that have already been heard and by using a time-to-live counter.

New mesh members get a unique identifier. It is a 16 bit number allowing enough members in one network. In addition the member can also be in a group and the number of groups a device can be in is configurable.

Each device implements a role or roles, which are called models and clients. A model is a receiver of a command the client sends. There are light models, power models etc. receiving messages from a light client, which basically is the light switch.

The CSRmesh is a very attractive implementation of a mesh network going beyond the point-to-point type of Bluetooth communication. It has the potential to become the leading implementation of the Internet of Things, being very fast, secure, requires very little management and is very power efficient for battery driven devices.

We are committed to using this protocol for our AIRcable SmartDimmer product line for light switches, plugs etc. for a smart home automation network. This article presents our implementation of the CSRmesh for even better usability.
 

Working with the CSRmesh version 1.0 to implement our AIRcable SmartDimmer though required to solve some interesting usability aspects.

  • Power Consumption
  • Association
  • Status Updates

 
Power Consumption

Members in the CSRmesh are constantly listening for mesh messages to see if a message is a command for the node, or if it needs to be retransmitted. The listener is implemented with a standard passive scan for advertisement messages. Since users require a reaction time of a light to turn on by command of 1/10 of a second, the receivers in the CSR radio are scanning at a high rate, pretty much all the time.

When messages are received they are decrypted, discarded, executed or retransmitted. This method of operation pretty much prevents the use of batteries. The CSR processors are rated at 16mA active during that time. Implementing a relaying mesh light switch that should run on batteries for years would be impractical regarding battery life. For power connected lights, it poses no problem.

Association

To become a member in the mesh net, devices need to receive the network key which allows them to decrypt received messages as well as encrypt messages for transmit. The current implementation only uses a single Android or iOS smartphone to be the mesh controller, capable of distributing the key to a newly associated device. Other smartphones can generate the same network key using the same pass phrase, but lack the ability to discover the network. This is a proposed function but not implemented in CSRmesh 1.0. For the moment it is not easy to use a second smartphone to control lights in your home.

Status Update

The proposed function of discovering all members of the network as well as their state is implemented by issuing a flood of messages from all devices throughout the network. It may be a bit excessive if a user just wants to see a list of all lights in their home and if they are on or off. Especially if sensor data is needed as well, such as the current power consumption, temperature of the room, ambient light, motion detection etc. Each of those sensors is proposed to be a model/client pair with its own mesh network protocol.

Solutions

First we wanted to decrease the power consumption of the SmartDimmer companion switch. The switch operates only on batteries and is mounted behind the wall as a 2-way (or more) light switch. No wiring is required to install the product. The batteries should last a very long time to give the best user experience.

Implementing a light client only does not require the CSRmesh scanner to run at all. A light command can be issued without requiring a return command. Transmitting a message is very quick and is repeated usually 8 times for reliability. But after that the processor can go back to deep sleep. With correct hardware and software implementation the lightswitch will consume only 5μA.

Since a light switch does not listen for mesh messages, it does not know what the status of the light is that it controls. Thus we changed the meaning of the standard light intensity message, which has a range of 0-255 to a percentage range.

We use 0-100% light messages for the intensity of the light. That is a fine enough stepping and easy to implement on a smartphone application.

We propose to use light intensity numbers above 127 (0x7F) for special light commands.

    0x80 = toggle light: if a light is on, switch it off and vice versa

    0x81 = step light: for dimming purpose, step the light one intensity up or down

The toggle light command is sent out when a user touches the button on the light switch. The light itself knows if the light is on or off, and will then toggle it accordingly.

Our light switches can dim the light as well. A long press starts the dimming process. Depending on the status of the light, the dimming will be up or down. The light switch only needs to send out the light step command repeatedly to the mesh network.

The association of the light switch to the mesh network should be an easy operation. Using a smartphone to do that will be cumbersome and does not allow easy changes. Certainly the user would want to use the light switch to control a particular individual light or a certain group. To do that we implemented a pairing process, started when the user double clicks on the light switch. This starts the CSRmesh association procedure. Using the Android smartphone app you can distribute the mesh key and give it a device id and group number. Unfortunately the light switch does not know which light it should switch. There are no ways, other than group ids to configure the light switch. A configuration that links a light switch to a light model would be helpful on the Android app.

Our solution is actually simpler, by eliminating the smartphone during the association procedure. When running the pairing mode, the light switch also looks for a light switch that wants to associate and is able to communicate with it. During that communication the light model distributes the network key to the light switch and also itʼs own device id. The light switch can then use that id to switch the light. The pairing process only takes the time to double click both devices. This leads to a very nice user experience.

Introducing the AIRcable SmartBeacon, a CSRmeah evaulation and test product.

It implements many CSRmesh operations as commands. See command line