Skip to content

A repo demonstrating YottaDB as a time series database within an IoT (Internet of Things) setting

Notifications You must be signed in to change notification settings

RamSailopal/YottaDB-IoT

Repository files navigation

YottaDB-IoT

Alt text

This repo demonstates the use of YottaDB as a time series database that is then used to present data to Grafana.

As an example, placing YottaDB in a relevant Internet of Things (IoT) setting, a Raspberry Pi is used and an attached D11 temperature/humidity sensor utilised to read data, and publish the data to an MQTT message broker. Another process then subscribes to the message broker, reading from the message topic before sending the data to Yottadb.

The YottaDB mg-webserver is then used to present data from YottaDB as JSON based API endpoints. These endpoints are then "consumed" by Grafana via the infinity plugin.

Alt text

Installation

Raspberry Pi

You can run this demo without a Raspberry Pi using dummy sensor data. If you don't have a Raspberry Pi or equivalent hardware, skip this step.

Connect the DHT11 (D11) sensor to your Raspberry Pi using the following guide:

https://www.circuitbasics.com/how-to-set-up-the-dht11-humidity-sensor-on-the-raspberry-pi/

Install git:

sudo apt-get update
sudo apt-get install -y git

Clone the repo:

cd /usr/local
git clone https://github.com/RamSailopal/YottaDB-IoT.git

Install the neccesary packages for the sensor:

cd /usr/local/YottaDB-IoT
sudo ./installpi.sh

Gitpod

Open in Gitpod

  1. Create a free/paid Gitpod account - https://www.gitpod.io/

  2. Log into the account

  3. Open a new browser tab and add gitpod.io/#https://github.com/RamSailopal/YottaDB-IoT to the address - This will create a new Gitpod cloud instance.

  4. Let the containers fully load

  5. Without a Raspberry Pi, open a new terminal and run:

    python3 mqttsend.py

    This will send dummy data to two public mqtt broker topics, yotta/db/humid and yotta/db/temp

    With a Raspberry Pi, go to your Pi terminal and:

    cd /usr/local/YottaDB-IoT

    python3 mqttsendpi.py

    This will send actual sensor data to two public mqtt broker topics, yotta/db/humid and yotta/db/temp

  6. Open a new tab as below, substituting the unique Gitpod address (ramsailopal-yottadbiot-pz86r4t05uu.ws-eu27.gitpod.io) for the one you are running

Alt text

This shows the key value data as written to YottaDB in time series form

  1. Open a new tab as below, substituting the unique Gitpod address (ramsailopal-yottadbiot-pz86r4t05uu.ws-eu27.gitpod.io) for the one you are running

Alt text

This shows the key value data in JSON format presented as a REST API endpoint (more details - https://github.com/RamSailopal/YottaDB-Demo)

  1. Open a new tab and naviagate to https://3001-ramsailopal-yottadbiot-pz86r4t05uu.ws-eu27.gitpod.io substituting the unique Gitpod address (ramsailopal-yottadbiot-pz86r4t05uu.ws-eu27.gitpod.io) for the one you are running.

  2. Log in with username admin and password admin

  3. Change the admin password when prompted

  4. On the left hand side, click on Manage, dashboards, Sensors

Alt text

This shows the API endpoint data consumed by the Grafana Infinity plugin and presented in graphical format.

Using docker-compose on Prem

git clone https://github.com/RamSailopal/YottaDB-IoT.git
cd YottaDB-IoT/Docker
export glbviewadd="<addressofserverrunningdocker>"
docker-compose up

Global View - http://addressofserverrunningdocker:8001/SENSORS

API view - http://addressofserverrunningdocker:8080/api/temp

http://addressofserverrunningdocker:8080/api/humid

Grafana - http://addressofserverrunningdocker:3001

Additional steps are the same as for Gitpod.

About

A repo demonstrating YottaDB as a time series database within an IoT (Internet of Things) setting

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published