Blynk: installing a private local server on Orange Pi under Armbian (Ubuntu 16.04LTS)

In the previous tutorial we saw how to install the local Blynk server on a Raspberry Pi 3. In this tutorial we will install the Blynk server on an Orange Pi Plus 2e running Armbian based on Ubuntu Xenial 16.04LTS. The Orange Pi + 2e is more powerful than the Raspberry Pi 3. It mainly has 2GB of RAM and 16GB of memory eMMC more reliable and faster than SD cards.

Check the installed Java version

Blynk needs Java 8 to work. Armbian 5.24 embeds Java 5, especially version 5.4.0. To check the version of Java installed on your system, run the following command

root@orangepiplus2e:~# java -version
java version "1.5.0"
gij (GNU libgcj) version 5.4.0 20160609

Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

If you are in this case, you must already update Java. Follow these steps that have been detailed here.

su -
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee /etc/apt/sources.list.d/webupd8team-java.list
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
apt-get update
apt-get install oracle-java8-installer
exit

During the installation, you will have two messages to validate

armbian install java 8

armbian install java 8 blynk server

After the update, version 8 of Java should be installed

root@orangepiplus2e:~# java -version
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) Client VM (build 25.121-b13, mixed mode)

Installing and Configuring the Local Blynk Server

Place yourself in the directory where you want to install Blynk then download the jar file from the server

wget "https://github.com/blynkkk/blynk-server/releases/download/v0.23.0/server-0.23.0.jar"

It’s over !

Configuring the server (server.properties file)

The first configuration file to create is server.properties. Retrieve a basic file from GitHub here. In addition to the destination files of the files, you will be able to modify the communication ports. This is especially important if you have installed a home automation server (or other software) that uses the same ports as the local Blynk server. For example, by default the port http (and web socket) is the 8080. If you use Domoticz, it will get stuck. You can use port 8082 instead.

#hardware mqtt port
hardware.mqtt.port=8440

#hardware ssl port
hardware.ssl.port=8441

#hardware plain tcp/ip port
hardware.default.port=8442

#http and web sockets port
http.port=8082

#https and web sockets port
https.port=9443

#application ssl port
app.ssl.port=8443

Blynk has a management interface accessible from a web browser. By default this interface is accessible only from the computer the raspberry Pi on which the server is installed. If you want to be able to access it from any computer on the local network, change the allowed.administrator.ips  parameter at the end of the file like this

Allowed.administrator.ips = 0.0.0.0/0

Save the server.properties file in the same folder as the server.

Configuring the email account (mail.properties file)

The second parameter file to create is the mail.properties file, which allows you to send the Tokens for the Arduino code. Create a new configuration file named mail.properties and save it to the same folder as the server. Here is a sample configuration file for gmail.

mail.smtp.auth=true
mail.smtp.starttls.enable=true
mail.smtp.host=smtp.gmail.com
mail.smtp.port=587
mail.smtp.username=EMAIL
mail.smtp.password=PWD

Starting the Server

Start the server manually

To start the server, run the following command

java -jar server-0.23.0.jar -dataFolder /home/pi/Blynk

The path to the data directory (-dataFolder) is passed as a parameter. The server starts in about ten seconds.

Blynk Server successfully started.
All server output is stored in current folder in 'logs/blynk.log' file.

To stop, press the CTRL + C key combination.

Start the Blynk server when Armbian starts

To start the server automatically at startup, simply run the start command by adding & at the end of the command. This gives

java -jar server-0.23.0.jar -dataFolder /home/pi/Blynk &

If it does not work, edit the crontab

pi@raspberrypi:~ $ crontab -e
no crontab for pi - using an empty one

Select an editor.  To change later, run 'select-editor'.
  1. /bin/ed
  2. /bin/nano        <---- easiest
  3. /usr/bin/vim.tiny

Choose 1-3 [2]: 2

Go to the end of the file and add the following command. Do not forget to change the path to match your installation directory.

@reboot java -jar /home/pi/server-0.23.0.jar -dataFolder /home/pi/Blynk &

The Blynk server now works exactly like any other system (Windows, MacOS, Raspberry Pi). Follow the previous tutorial to start using Blynk and assign unlimited energy to your user account.

Subscribe to the weekly newsletter

No spam and no other use will be made of your email. You can unsubscribe anytime.

We will be happy to hear your thoughts

Leave a Reply

DIY Projects
%d bloggers like this: