All Projects → koenvervloesem → ruuvitag-demo

koenvervloesem / ruuvitag-demo

Licence: MIT License
Demo of reading Bluetooth Low Energy sensor measurements of RuuviTag environmental sensors and feeding them to MQTT, a database and dashboards

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to ruuvitag-demo

Nimble Arduino
A fork of the NimBLE library structured for compilation with Ardruino, designed for use with ESP32.
Stars: ✭ 108 (+671.43%)
Mutual labels:  bluetooth, ble, bluetooth-low-energy, bluetooth-le
Extendable
Blocks Based Bluetooth LE Connectivity framework for iOS/watchOS/tvOS/OSX. Quickly configure centrals & peripherals, perform read/write operations, and respond characteristic updates.
Stars: ✭ 88 (+528.57%)
Mutual labels:  bluetooth, ble, bluetooth-low-energy, bluetooth-le
IOS-DFU-Library
OTA DFU Library for Mac and iOS, compatible with nRF5x SoCs
Stars: ✭ 400 (+2757.14%)
Mutual labels:  bluetooth, ble, bluetooth-low-energy, bluetooth-le
py-bluetooth-utils
Python module containing bluetooth utility functions, in particular for easy BLE scanning and advertising
Stars: ✭ 60 (+328.57%)
Mutual labels:  bluetooth, ble, bluetooth-low-energy, bluetooth-le
kotori
A flexible data historian based on InfluxDB, Grafana, MQTT and more. Free, open, simple.
Stars: ✭ 73 (+421.43%)
Mutual labels:  mqtt, influxdb, grafana, mosquitto
Ble.net
Cross-platform Bluetooth Low Energy (BLE) library for Android, iOS, and UWP
Stars: ✭ 137 (+878.57%)
Mutual labels:  bluetooth, ble, bluetooth-low-energy, bluetooth-le
Ios Pods Dfu Library
OTA DFU Library for Mac and iOS, compatible with nRF5x SoCs
Stars: ✭ 349 (+2392.86%)
Mutual labels:  bluetooth, ble, bluetooth-low-energy, bluetooth-le
Easyble
Android BLE framework
Stars: ✭ 155 (+1007.14%)
Mutual labels:  bluetooth, ble, bluetooth-low-energy, bluetooth-le
Node Ble
Bluetooth Low Energy (BLE) library written with pure Node.js (no bindings) - baked by Bluez via DBus
Stars: ✭ 159 (+1035.71%)
Mutual labels:  bluetooth, ble, bluetooth-low-energy, bluetooth-le
PiBeacon
Low-cost iBeacon using Raspberry Pi
Stars: ✭ 41 (+192.86%)
Mutual labels:  bluetooth, bluetooth-low-energy, raspbian, bluetooth-le
grafana-dashboards
List of Grafana Dashboards 📺
Stars: ✭ 120 (+757.14%)
Mutual labels:  influxdb, grafana, telegraf
monitoring-rancher
🤠How to Set up Rancher Server Monitoring with TIG Stack?
Stars: ✭ 22 (+57.14%)
Mutual labels:  influxdb, grafana, telegraf
docker-telegraf-influxdb-grafana
Docker Image with Telegraf, InfluxDB and Grafana
Stars: ✭ 17 (+21.43%)
Mutual labels:  influxdb, grafana, telegraf
H.E.L.P.
Home Environment Locating People 🍍
Stars: ✭ 19 (+35.71%)
Mutual labels:  bluetooth, ble, bluetooth-low-energy
soma-ctrl
Node util for controlling SOMA smart shade via MQTT or HTTP
Stars: ✭ 19 (+35.71%)
Mutual labels:  mqtt, bluetooth, bluetooth-le
Bluetooth-ble-beamer-and-scanner-for-tracing-corona-virus-infected-individual
Bluetooth ble beacon beamer and scanner for tracing corona virus infected person similar to Trace Together app
Stars: ✭ 26 (+85.71%)
Mutual labels:  bluetooth, ble, bluetooth-low-energy
awesome-bluetooth-security
List of Bluetooth BR/EDR/LE security resources
Stars: ✭ 220 (+1471.43%)
Mutual labels:  bluetooth, ble, bluetooth-low-energy
bounded-disturbances
A k6/.NET red/green load testing workshop
Stars: ✭ 39 (+178.57%)
Mutual labels:  influxdb, grafana, telegraf
bluetooth-manager
Java Bluetooth Manager. A library/framework for managing bluetooth adapters, bluetooth devices, GATT services and characteristics
Stars: ✭ 75 (+435.71%)
Mutual labels:  bluetooth, ble, bluetooth-low-energy
rpi-monitoring-node
Automated installation of Grafana, Telegraf and influxdb for your Raspberry Pi
Stars: ✭ 18 (+28.57%)
Mutual labels:  influxdb, grafana, telegraf

RuuviTag Demo

This is a demo of reading Bluetooth Low Energy sensor measurements of RuuviTag environmental sensors and feeding them to MQTT, a database and dashboards.

This project is not affiliated to the Ruuvi company in any way.

Screenshots

Grafana dashboard:

Grafana dashboard

Node-RED dashboard:

Node-RED dashboard

System requirements

You need a Linux system with Bluetooth Low Energy (BLE) adapter, so at least Bluetooth 4.0.

The demo uses Docker, so it has to be installed.

This demo has been tested on:

  • Raspbian Buster Lite (on a Raspberry Pi 3B)
  • Ubuntu Desktop 19.10

All instructions assume the first configuration. It should run on other Linux systems with minor adjustments, though.

Checking your Bluetooth adapter

Your system should have a Bluetooth Low Energy adapter, as is available in all recent Raspberry Pi models. You can verify this with:

hciconfig -a

This should show a device hci0 as UP RUNNING and the LMP Version should be at least 4.0.

Installing Docker and Docker Compose

Docker can be installed with:

curl -sSL https://get.docker.com | sh

And give the pi user access to Docker by adding it to the docker group:

sudo usermod pi -aG docker

Log out and then log in again, so the group permissions are applied to your session.

Then install Python's pip package manager:

sudo apt install python3-pip

And install Docker Compose:

sudo pip3 install docker-compose

Installation

Clone the repository (you may have to sudo apt install git first) and enter the directory:

git clone https://github.com/koenvervloesem/ruuvitag-demo.git
cd ruuvitag-demo

Change the owner of the grafana directory:

sudo chown -R 472:472 grafana

Configuration

Add the MAC addresses of your RuuviTag sensors to the bt-mqtt-gateway/config.yaml file. You can find these by scanning for Bluetooth Low Energy devices in your neighborhood:

sudo hcitool lescan

Or you can run the Ruuvi Station app on Android or on iOS and have a look at the MAC address in the tag settings of each RuuviTag.

The Node-RED flow and Grafana dashboard suppose that you have four tags, called tag1, tag2, tag3 and tag4. So I suggest that initially you leave these names in bt-mqtt-gateway/config.yaml. After starting up the demo, you can always change the configuration.

Starting the demo

Starting the demo is easy, as it's using Docker Compose:

docker-compose up -d

This starts seven Docker containers:

  • bt-mqtt-gateway: Reads RuuviTag sensor measurements using Bluetooth Low Energy and forwards them to a MQTT broker.
  • Mosquitto: Receives the MQTT messages from bt-mqtt-gateway and relays them to anyone who is interested.
  • HiveMQ MQTT Web Client: Connects to Mosquitto and shows you the MQTT messages in your web browser using WebSockets.
  • Node-RED: Subscribes to the MQTT messages from Mosquitto and shows the values in a dashboard.
  • Telegraf: Collects MQTT messages from Mosquitto and sends the values to InfluxDB.
  • InfluxDB: Stores all the values of the RuuviTag measurements in a time-series database.
  • Grafana: Shows the values of the InfluxDB database in a dashboard.

You have access to:

Extra demo: e-Paper HAT

If you have a Waveshare 2.7 inch three-colour e-Paper HAT, you can use this demo in combination with the RuuviTag ePaper project on a Raspberry Pi:

  • Build the Docker container of that project.
  • Start this container together with the containers of the RuuviTag Demo: docker-compose up -f docker-compose-epaper.yml up -d.

This shows the temperature and humidity measurements of the four configured RuuviTag sensors on the display, as well as the date, time and IP address. The latter is a nice way to know which IP address you have to log into to access the dashboards.

Security

This is purely a demo of how you can process RuuviTag sensor measurements, so there are no special security measures such as encryption, and minimal authentication and user permissions. Only use this demo for evaluation purposes.

The following default passwords are configured after installation:

  • Node-RED dashboard: username admin and password password. To change this, run docker exec -ti node-red /usr/local/bin/node -e "console.log(require('bcryptjs').hashSync(process.argv[1], 8));" your-password-here with your new password instead of your-password-here and paste the output string in the line password: "$2a$08$zZWtXTja0fB1pzD4sHCMyOCMYz2Z6dNbM6tl8sJogENOMcxWV9DN.", after the line username: "admin", in the file node-red/settings.js. After this, restart Node-RED with docker-compose restart node-red.
  • Grafana: username admin and password admin. After the first login, you're asked to choose another password.

If you want to know more about securing Mosquitto and Node-RED, please consult my book Control Your Home with Raspberry Pi: Secure, Modular, Open-Source and Self-Sufficient and the accompanying GitHub repository koenvervloesem/raspberry-pi-home-automation.

Stopping the demo

If you want to stop the demo, just run:

docker-compose down

If you run the extra demo with the e-Paper HAT, stop the demo like this:

docker-compose -f docker-compose-epaper.yml down

Architecture

This is the architecture of the demo:

Demo architecture diagram

This diagram shows two instances of bt-mqtt-gateway. You can use as many as you want, installed on Raspberry Pis or other devices positioned in multiple places for the best Bluetooth coverage of all sensors.

While the demo installs all components on one device, you can distribute them over various devices. For instance, bt-mqtt-gateway on various receiver devices, ruuvitag-epaper on a Raspberry Pi with the Waveshare e-Paper HAT, HiveMQ MQTT Web Client on a developer laptop, and Mosquitto, Node-RED and Telegraf/InfluxDB/Grafana on a Linux server.

License

This program is provided by Koen Vervloesem as open source software with the MIT license. See the LICENSE file for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].