ThingsBoard is an open-source IoT platform that supports MQTT, CoAP and HTTP protocols related to IoT. It is a software package that can be installed to add various prototyping boards including Raspberry Pi, Arduino, ESP32 for data collection, processing, visualization, and device management. When we install vanilla Mosquitto with Ellipse Paho, we get a basic UI. The default Mosquitto package is great to learn the core things of IoT but in real life, we need some solution that offers us something like the hosted cloud-based IoT platforms like IBM Watson IoT offers us. We need a ready to use a mobile app, a good number of examples with Arduino, and a dashboard with widgets. Thingsboard also runs on their cloud as a paid service with a trial. We can use the cloud-hosted version of Thingsboard to test and decide whether we can run Thingsboard on our server. Installing Thingsboard requires a VPS with a minimum of 1GB RAM.
SSH to a new Ubuntu 18.04 instance. First, we have to install OpenJDK 11 and set it to use by the operating system by default :
1 2 3 4 5 | sudo apt update sudo apt install -y wget curl mlocate sudo apt install openjdk-11-jdk sudo update-alternatives --config java java -version |
Next, we have to install PostgreSQL and configure it :
---
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # update locate database sudo updatedb # import the repository signing key wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - # add repository contents to your system: RELEASE=$(lsb_release -cs) echo "deb http://apt.postgresql.org/pub/repos/apt/ ${RELEASE}"-pgdg main | sudo tee /etc/apt/sources.list.d/pgdg.list # install and launch the postgresql service: sudo apt update sudo apt -y install postgresql-12 sudo service postgresql start sudo su - postgres psql \password \q # press CTRL + D psql -U postgres -d postgres -h 127.0.0.1 -W CREATE DATABASE thingsboard; \q |
Now we will install Thingsboard and add the database details:
1 2 3 | wget https://github.com/thingsboard/thingsboard/releases/download/v3.2.2/thingsboard-3.2.2.deb sudo dpkg -i thingsboard-3.2.2.deb nano /etc/thingsboard/conf/thingsboard.conf |
These things you need to add to the configuration file :
1 2 3 4 5 6 7 8 9 10 11 | export DATABASE_ENTITIES_TYPE=sql export DATABASE_TS_TYPE=sql export SPRING_JPA_DATABASE_PLATFORM=org.hibernate.dialect.PostgreSQLDialect export SPRING_DRIVER_CLASS_NAME=org.postgresql.Driver export SPRING_DATASOURCE_URL=jdbc:postgresql://localhost:5432/thingsboard export SPRING_DATASOURCE_USERNAME=postgres export SPRING_DATASOURCE_PASSWORD=PUT_YOUR_POSTGRESQL_PASSWORD_HERE export SPRING_DATASOURCE_MAXIMUM_POOL_SIZE=5 export SQL_POSTGRES_TS_KV_PARTITIONING=MONTHS # Update ThingsBoard memory usage restricted to 256MB export JAVA_OPTS="$JAVA_OPTS -Xms256M -Xmx256M" |
Now, run the installation script and start ThingsBoard :
1 2 | sudo /usr/share/thingsboard/bin/install/install.sh --loadDemo sudo service thingsboard start |
Now, you will be able to open Web UI at this address:
1 | http://server-IP-address:8080/ |
The demo script has three user accounts. sysadmin@thingsboard.org
with sysadmin
as the password, tenant@thingsboard.org
with tenant
as the password and customer@thingsboard.org
with customer
as the password.
Next, you can follow this official guide to get started with Thingsboard :
1 2 | https://thingsboard.io/docs/getting-started-guides/helloworld/ https://thingsboard.io/docs/samples/esp32/gpio-control-pico-kit-dht22-sensor/ |