In earlier guides, we have mentioned that ThingsBoard is an open-source IoT platform which supports MQTT, CoAP and HTTP protocol. Supporting HTTP requests is quite important in some use cases. For example, when you need a toggle button to control your AC powered appliances, then the easiest way is to control with a cURL request. This you could do with IBM Watson IoT, but as we have said earlier, IBM Watson IoT platform will be retired soon. ThingsBoard is a software package that can be used for data collection, processing, visualization, and device management. All you need is a virtual server with 1GB RAM with root access.
Above is a screenshot of ThingsBoard cloud. You’ll get a similar UI on your server.
Steps to Install ThingsBoard IoT on Ubuntu/Debian Server
It is practical to use a subdomain or domain and setup Let’s Encrypt/Certbot. The steps of the later will be similar to that shown in our earlier guide.
---
SSH to the 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.4.1/thingsboard-3.4.1.deb sudo dpkg -i thingsboard-3.4.1.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 3 4 | sudo /usr/share/thingsboard/bin/install/install.sh --loadDemo sudo service thingsboard start # If you want ThingsBoard to start automatically upon a reboot, you must enable it: sudo service thingsboard enable |
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/ |