This article is written by Raphael Pohland from BlueRange.
My grandmother is an avid gardener. After some particularly cold days and nights, she started wondering how cold it actually got in her greenhouse. When she talked to me about her worries in regards to her loved plants, my thoughts immediately went to the RuuviTag. The one-stop, open-source hardware solution for battery powered sensor beacons. Together with the Ruuvi Station app which can make the sensor data easily available at her fingertips directly on her smartphone, this seemed like a good plan in order to take care of her plants.
So, we went ahead and placed one RuuviTag in the greenhouse and out of curiosity also put one in the garage and one in the attic. Unfortunately, the signal from the greenhouse did not reach her computer desk or the sofa in the living room – probably because the distance to the greenhouse was so long and house has a thick concrete walls. The other RuuviTags were happily updating their sensor data on her phone though.
Make them talk!
One solution would be for her to walk towards the greenhouse and wait for a moment for the sensor measurement to come through, but … this does not strike me as particularly user-friendly. We could use the Ruuvi Gateway – yet another product from Ruuvi – place it in range of the greenhouse RuuviTag, route the sensor data to a logging platform and get a nice historical view out of it. But, alas, we did not have a gateway around.
So maybe the sensors could exchange data among each other – and having just started working as a Software Engineer for BlueRange at MWAY – I knew exactly how we would be able to achieve that: FruityMesh, the energy-efficient mesh network based on Bluetooth Low Energy 4.1 connections. It allows multiple nodes to automatically form a mesh network that makes sending data from one node to another possible, regardless of their physical location.
The RuuviTag integrates the BME280 temperature, humidity and pressure sensor from Bosch Sensortec. When the sensor measurement on a node is taken, we will send it to all other nodes in the mesh network and queue it for broadcast in the format the Ruuvi Station app expects. As we turn the nodes into proxies for each other, we are suddenly able to receive the greenhouse sensor data via the RuuviTags in the garage and the attic.
Sending the data is accomplished using a specific feature of the SoftDevice, particularly the Radio Timeslot API which allows the firmware to cooperatively schedule direct access to the radio peripheral without interfering with the Bluetooth Low Energy stack used by FruityMesh.
Putting it Together
Application-level functionality in FruityMesh is implemented in the form of modules. They provide persistent storage for configuration values, are able to talk to other nodes by calling the SendModuleActionMessage function and get informed about inbound messages through the MeshMessageReceivedHandler. The peripherals and the Bluetooth Low Energy stack is accessed through a hardware abstraction layer, which makes porting an application to different chipsets and boards much easier. FruityMesh uses the nRF5 SDK 14 for nRF52832 SOCs and the SDK 15 for nRF52840 SOCs with different SoftDevices. As an example, the implementation described below can not only be used on the RuuviTag but also on the nRF52840-DK, albeit without the sensor measurement.
The required functionality has been implemented in the RuuviWeatherModule. On one hand it takes the sensor measurements, prepares and sends them through the mesh to every other node. On the other hand, it receives the measurements from the other mesh nodes, queues and finally broadcasts them in the correct format for the Ruuvi Station app. Splitting this module into two pieces in order to respect the Single-Responsibility rule is left to our enthusiastic readers.
In order to use FruityMesh on the RuuviTag, you can follow the instructions to compile and manually flash the firmware, just be sure to use the prod_ruuvi_weather_nrf52 featureset. We are actively looking into utilizing DFU and the bootloader present on your RuuviTag for flashing the FruityMesh firmware, but the difference in SoftDevice versions between the FruityMesh and the Ruuvi firmware put a spoke in our wheels. You currently have two options to flash the firmware, either you use the Devkit, which is by far the easiest option, or you will need to use a SEGGER JLink – e.g., the one embedded on the nrf52-DK or the nrf52840-DK (but not the Dongle) – and the required cables to access the standard 10-pin ARM Cortex debug connector (RuuviTag Rev. B1 – B5) or TC2030 TagConnect (RuuviTag Rev. B6 – B7.1). You can find more about the flashing in the tutorial for FruityMesh.
With BlueRange and FruityMesh on the RuuviTags my grandmother is now able to quickly check temperature, relative humidity and atmospheric pressure in the attic, the garage and the greenhouse in the garden from the sofa in the living room – without having to walk up the stairs, over iced-over garden paths, through rain and other weather.
M-Way Solutions’ BlueRange platform is primarily designed for smart building automation and asset tracking applications, providing the ability to automatically monitor and control building infrastructure based on comprehensive sensor data. In addition, the platform can perform ‘real time’ tracking of equipment, material, and staff via wireless tags connected to the mesh and from there to the centralized management portal.
BlueRange is designed to make smart and wireless buildings possible, and to increase the flexibility of building utilization. According to the company it is the ideal technology to digitalize office spaces, production sites, hotels, shopping centers, and more. BlueRange connects buildings and users and allows them to control lights, blinds and temperature intuitively through mobile devices.
Bluetooth LE ecosystem
BlueRange is comprised of an ecosystem of third party ‘BlueRange Ready’ hardware—including Bluetooth LE asset tags, environmental sensors, luminaires, switches and HVAC controls—a high throughput open source Bluetooth LE-based mesh protocol, and a nRF52832 SoC-equipped gateway to a back-end server cluster and management portal. The ‘BlueRange Ready’ components include devices preflashed with BlueRange firmware. They are used in lighting solutions such as the Vossloh-Schwabe ‘Blu2Light’ system, the Regent ‘Lightpad’ and the Waldmann ‘Yara’ luminaire as well as HVAC controllers such as the Belparts ‘DXN6_B’. Further components include asset tracking tags such as the ‘BlueRange Tag A1’, the ‘BlueRange CO2 Sensor C1’ powered by Enerthing, the ‘BlueRange Mesh Node R2’, as well as the nRF52840 SoC-powered ‘BlueRange USB Dongle U1’.
In a typical building automation application, the lighting, movement, temperature, and other sensors are provisioned in the BlueRange Mesh via the ‘BlueRange Admin’ app on a Bluetooth 4.0 (and later) smartphone or tablet. The open-source BlueRange Mesh is a bidirectional mesh based on scatter net logic, timed and directed by a self-finding, -maintaining, and -healing algorithm. This open-source connection based mesh protocol, called FruityMesh, is also available on GitHub and offers very high throughput, lower power consumption and other advantages compared to competing solutions.
The mesh nodes send sensor data to the mesh network’s central gateway which in turn relays the data to the BlueRange Portal using standardized technologies such as Representational State Transfer (REST) and Message Queuing Telemetry Transport (MQTT) based on Transmission Control Protocol/Internet Protocol (TCP/IP). The portal enables the user to review sensor data at a building, floor, or individual room level, as well as execute network and device management commands. These commands are relayed via the nRF52832 SoC-equipped gateway to the relevant mesh nodes to trigger tasks such as raising or lowering HVAC temperature output or luminosity in specified building zones.
Flexible lighting control and building automation
A key benefit of BlueRange is powerful and flexible lighting control. BlueRange Ready luminaires using the Digital Addressable Lighting Interface (DALI) enable wireless configuration and control through their connectivity. Based on occupancy sensors, BlueRange hardware ensures automatic lighting control for individual luminaires and lighting arrays. In addition, BlueRange also offers an option for easy integration of building automation components using industry standards such as KNX or BACnet®.