Wireless Sensor Tag

  • RF Mesh logging of Light, Temperature, Humidity, Pressure
  • High precision Temperature 0.01°
  • Ambient light ranges from 0.045 Lux to 188,000 Lux
  • Permanent logging of Battery and Mesh RF trace routing
  • Low power ~ 25 uA
  • Firmware Open source, even the RF stack is open source, no softdevice used.
  • Hardware Open design, schematics, board and gerbers files
  • Components : nRF52832, BME280 , MAX44009
  • Very easy to solder

Wireless Sensors
Wireless Sensors


RF Mesh Dongle

  • RF Mesh Autonomous router
  • RF Mesh Remote configuration
  • RF Mesh Host Controller Interface (HCI)
  • HCI used by Raspberry pi Python scripts
  • UART @ 460 Kbps
  • Continuos Streaming of up to 300 RF Packets / second

RF to USB Adapter
RF to USB Adapter


Host Controller Interface Function

RF to UART to MQTT
RF to UART to MQTT
  • The dongle converts the captured RF packet from binary, into a text message sent through the UART.
  • This text message will be used by a Raspberry pi Python HCI script to convert it from text line into an MQTT post.

nRF52 Software

Install

  • GNU Tools ARM Embedded version 6 2017-q2-update, referenced from the SDK Makefile.windows
  • Python jlink wrapper. Optional but recommended for automated parameters configuration.

Configuration and Usage

Make sure you do have configured the environment variable for your json Nodes Database file:

Environment Variable Value
NODES_CONFIG Drive:\Path_to_nodes.json

This step is only required for development not for usage. Connect the device to the debugger , clone the nRF52_Mesh repository, go to the nrf52_sensortag directory, and read its unique identifier by running :

cd applications\nrf52_dongle
make paramr

Use the retrieved uid for the next step, otherwise you can leave it empty if no firmware or flash reconfiguration is required.

Now in the json database file, Add a new entry for your newly built Sensor Node information :

"75":   {   "name"          :"nRF52_SensorTag_1",
    "board"         :"nRF52_Sensors",
    "program"       :"nRF52_Sensors",
    "uid"           :"0x85 B4 74 76 42 38 37 22",
    "add"           :"",
    "data"          : ["temperature","humidity","pressure","light"],
    "channel"       : "10",
    "sleep"         : "10"
    },
  • nodeid : As this json file is a map, every Key is unique and represent the node id in the mesh network.
  • name : this name will be used by applications parsing  messages
  • board, and program : just for user reference
  • uid : the one retrieved in the previous step, or leave empty
  • data : Not in use yet, to inform future automated gui about the capabilities of every node.
  • channel : the RF channel that is unique for the whole mesh network.
  • sleep : the period after which the sensor tag will wake up and do an action, note that the sensor parameters broadcast period are a multiplication of this period and will be in the future also configurable on config and runtime but are currently hardcoded on the program firmware.

Flashing

The flashing step can be skipped if the acquired device was labelled “ready to use”.

After having installed the required tools (see install section), first go in the nrf52_sensortag directory and compile the firmware

make

We refer here to the usage of a j-Link Segger Debugger. Connect the device to the debugger, switch the target power on and then flash by the following commands:

make on
make flash

make sure you write the parameters that were updated in the json database file, for that the following command will help by identifying the “uid” of the connected device to the debugger, will fetch the corresponding parameters where the json map values have a matching “uid”, then will only write the parameters that are different from the already available value on the device.

make paramw

Now, as all your dongle and raspberry pi server are already installed like described in each install section, all what is left to do is to configure the Dashboard with your new node id. See the Raspberry pi Grafana section and use the query :

SELECT "temperature" FROM "node75" WHERE $timeFilter

repeat this for all reported capabilities of your device (humidity, light, battery…)

Your Sensor device is ready, the next maintenance is to check the battery log from year to year unless you opted for a  big battery type then you might never have to do this for the lifespan of the sensor.

For the Developers

Schematics

Github Repo Link  nRF52 Mesh

The nRF52 firmware can be summarized in one function, where some initialisation was omitted for clarity, find the full function in this file.

void app_rtc_handler()
{
...
    if( ((cycle_count+offset_bme) % period_bme)==0)
    {
        read_send_bme();
    }
    if( ((cycle_count+offset_light) % period_light)==0)
    {
        read_send_light();
    }
    if( ((cycle_count+offset_bat) % period_bat)==0)
    {
        read_send_battery();
    }
...
}

It is possible to re target the Firmware to any other board for which a board.h is available by updating the makefile :

#BOARD selection : BOARD_NRF52_DONGLE, BOARD_NRF52_SENSOR_TAG
#USED_BOARD := BOARD_NRF52_DONGLE
USED_BOARD := BOARD_NRF52_SENSOR_TAG

Note that the Tx and Rx pios are taken from the board declaration and do not need manual update.

It is possible to change the compile time flags configuration to activate the Log, edit the baudrate or a enable serial communication by using the convenience cmsis configuration wizard, provided in the Nordik SDK. Note that it was here for a user Application section

The magic behind the “uid”  automatic retrieval from the attached device to the debugger was developed with a Python jlink wrapper in use in Makefile and tools of this repo, more on pylink.readthedocs. It has to be used with a 32 bit python version referenced in the tools scripts as C:\Python27\python.exe.

import os
import pylink

jlink = pylink.JLink()
jlink.open(os.environ['SEG_JLEDU'])

def start():
    jlink.set_tif(pylink.enums.JLinkInterfaces.SWD)
    jlink.connect('NRF52832_XXAA', verbose=True)
    print('ARM Id: %d' % jlink.core_id())
    print('CPU Id: %d' % jlink.core_cpu())
    print('Core Name: %s' % jlink.core_name())
    print('Device Family: %d' % jlink.device_family())
    return

 

Hardware

Schematics

Github Repo Link nRF52 Sensor Tag schematics

nRF52 Module

nRF52832 module
nRF52832 module dimensions
The usage of this module available on the market allows very quick prototyping and even hobbyist to produce their own sensor tag. The module reference is GT832E_01, it is using the nRF52832

nRF52832 module Key Features

  • ARM-M4
  • 512 KB Flash
  • 64 KB RAM
  • Integrated antenna
  • 32 MHz Oscilator
  • 32 KHz Oscilator for an RTC clock

Two battery types

cr2032
CR2032

cr2477
CR2477