Introduction:

Blynk is a very powerful Internet of Things(IoT ) software solution which allows you to design your own  IoT APP without  Android and iOS APP programming knowledge.  It makes DIY IoT projects much easier and simpler than ever before.

Following picture 1.1 shows how Blynk systems works:
Picture 1.1

From Above picture, you can see Blynk software consists three parts:

  1. Blynk APP which is installed in your Cell phone or tablet
  2. Blynk Server
  3. Blynk Library which is installed in IoT terminal device such as Arduino, Raspberry Pi etc.

The Blynk IoT server is the most important because it is the bridge to exchange control signal and data between APP and those Things in terminal devices.

By default, Blynk  Server is operated by Blynk company and also called Blynk Cloud.

Blynk Cloud server makes our programming and setting very simple and easy. However, it has some weakness:

Fortunately Blynk has provided another solution for users to solve these   problems. In order to attract more people to make IoT project based on Blynk platform , they opened their java server code to public for free. So we can install the Blynk Server to your local computer and no need buy Energy to use their server. Since the server is installed locally in your home or office LAN, the IoT reaction speed is much faster than WAN server.

In this Lesson, we will teach students how to install Blynk local Server and setup APP and Arduino sketch code to make them working in Blynk Local Server.

Install Server on local PC

You can install local Blynk server on any computer which has Java 11 (or higher version). Java environment is a basic module which comes with those popular OS such as Windows, MacOS and Linux. So if your computer is not too old, you no need install any Java software to run Blynk server.

In this tutorial, we will teach how to install local Blynk server on Windows, MacOS and Raspbian(Raspberry Pi OS). If you use other OS, the installation is similar, just make sure you have Java 11 and JDK 8+ installed in your OS.

Install Blynk local server on Windows

1)Download  Blynk local server from https://osoyoo.com/driver/blynk/blynk-server.jar

2)In Windows search bar , type cmd to open command windows

3)After open the command window, go to the fold where blynk-server.jar file is saved.
Run following command to start the local Blynk server:

java -jar ./blynk-server.jar -dataFolder ./Blynk &

you will see following result:

Now your local Blynk server has been successfully installed and running in your Windows. In above picture, we can see our local server IP is 192.168.0.37, pleas write down your server IP address for later use.
You can see from the result that you can visit the admin page of Blynk Server url:

https://your_windows_ip_address:9443/admin

We will teach you how to access the admin page later.

Install Blynk local server on Apple Macbook Computer

1)Download  Blynk local server from https://osoyoo.com/driver/blynk/blynk-server.jar
2)Open MacBook terminal window,

Run following command to start the local Blynk server:

java -jar ./blynk-server.jar -dataFolder ./Blynk &

you will see following result:


Now your local Blynk server has been successfully installed and running in your Macbook. In above picture, we can see our local server IP is 192.168.0.37, pleas write down your server IP address for later use.
You can visit the admin page of Blynk Server url:

https://your_macbook_ip_address:9443/admin

Install Blynk local server on Raspberry Pi or similar Linux computer

1)Open your Pi shell terminal or use SSH to connect Raspberry Pi remote terminal

2)Download  Blynk local server by following command

wget http://osoyoo.com/driver/blynk/blynk-server.jar

2)Run following command to start the local Blynk server:

java -jar ./blynk-server.jar -dataFolder ./Blynk &

The java server will start in one or two minutes, then you will see following result:

Now your local Blynk server has been successfully installed and running in your Raspberry Pi. In above picture, we can see our local server IP is 192.168.0.37, pleas write down your server IP address for later use.

If you want the Raspberry Pi to start Blynk Server automatically when starting your Pi, you can run following command:
crontab -e
Then you can add following in the bottom crontab file

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

After that, use Ctrl-X to save and exit the file and reboot your computer. Your Blynk server will automatically start every time.

You can visit the admin page of Blynk Server url:

https://your_RaspberryPi_ip_address:9443/admin

Cell Phone APP download and configure:

1)In Google Play or iOS APP store, search Blynk and install the APP.

2) Open APP and Create a Blynk Account for your local Blynk Server

i) Click Create new Account in Blynk APP

ii)Input your email and password, then click Server Setting button. Switch server from Blynk to CUSTOM, write your local server IP address in the IP field. Leave default port 9443 unchanged as following:

iii)Click OK to finish Local Server setting. Then Click Sign UP to connect Server.

If your Local Blynk is not running properly or IP address setting is wrong, APP will show Can’t connect to Server, Try later…

If server running and IP setting are all ok, you will a welcome page as following:

iv)just click Cool! Got it and go to the New Project UI.

Congratulations! You have successfully installed local Blynk Server and connected your APP to the server.

Suppose you are using Arduino as terminal device, you click +New Project to add an Arduino project:

You can name your Project, i.e My Blynk Project  and select Arduino UNO (or  Arduino MEGA if you are using MEGA2560), then Click Create,   you will see:

Although above page shows server has emailed you a Token, but we did not set SMTP email service in our local Server, so we will not get any token email.  I will teach you how to get local server token for this project later.

Now you entered blank project setting UI,  In future, you can click (+) sign to add control Widget to create your APP UI

Get Auth Token

You have two ways to get Blynk Token:
Method 1: Get token from APP as following:

Method 2) Get token from local blynk control panel:
Please open your browser and visit following url:
https://your_server_ip:9443/admin
your_server_ip is the IP address of your local Blynk server.

Above https:// url  default certificate is self-signed. It will therefore be considered unreliable. You will have to accept the alert message displayed by your internet browser. If you are using Google Chrome browser, You will see following alert:

Click Advanced, then select proceed to the unsafe IP as following:

You will go to Server login page, please use user name admin@blynk.cc and password admin to login to control panel.
then please click Users:

Click the email account you just created, then you will find the Token which just assigned for your project:

Write down this token, you  will use this token and local server IP address in your terminal device program which is written in Arduino C++, Python, or other languages.