https://github.com/ramsailopal/yottadb-iot
A repo demonstrating YottaDB as a time series database within an IoT (Internet of Things) setting
https://github.com/ramsailopal/yottadb-iot
iot raspberry-pi time-series yottadb
Last synced: about 2 months ago
JSON representation
A repo demonstrating YottaDB as a time series database within an IoT (Internet of Things) setting
- Host: GitHub
- URL: https://github.com/ramsailopal/yottadb-iot
- Owner: RamSailopal
- Created: 2022-01-17T11:44:29.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-03-23T11:20:47.000Z (almost 4 years ago)
- Last Synced: 2024-12-29T10:25:44.380Z (about 1 year ago)
- Topics: iot, raspberry-pi, time-series, yottadb
- Language: M
- Homepage:
- Size: 383 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# YottaDB-IoT

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.

# 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
[](https://gitpod.io/#https://github.com/RamSailopal/YottaDB-IoT)
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

This shows the key value data as written to YottaDB in time series form
7) Open a new tab as below, substituting the unique Gitpod address (ramsailopal-yottadbiot-pz86r4t05uu.ws-eu27.gitpod.io) for the one you are running

This shows the key value data in JSON format presented as a REST API endpoint (more details - https://github.com/RamSailopal/YottaDB-Demo)
8) 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.
9) Log in with username **admin** and password **admin**
10) Change the admin password when prompted
11) On the left hand side, click on **Manage**, **dashboards**, **Sensors**

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=""
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.