Blink локальный сервер на windows

Loading

Local-windows-Blynk-server

This is an up to date tutorial on how to set up a local windows Blynk server with a mention of some issues, giving you more security and inf. energy points.

Getting Started

these insturction will guide you on how to build your own windows local Blynk server, other online tutorials found to be out of date or not mentioning some special cases, it is highly recommended to start using blynk cloud at first to get an overview about blynk platform, then move to the local server -it’s a bit buggy-.

PS1: you will find other tutorials on how to build it on Mac and Linux, it’s easy.

PS2: if you have some experiance in the field, follow the original repository.

Requirements

  • Blynk Library.

  • Blynk APP: Google Play , Apple Store.

  • Java 9.

  • Open ports 8443 (for app), 8442 (for hardware without ssl), 8441 (for hardware with ssl), Open by default.

  • The latest Blynk local server to be found here.

  • Mail and Server properties to be found in this repository.


Installing

  • Install Java v9 via a normal double click, you can check your existing version by opening the cmd and typing:

You should get the following output:

java version "9.0.1"
Java(TM) SE Runtime Environment (build 9.0.1+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)
  • Create a folder, let say for example C:/BlynkServer, put the installed server, the downloaded mail and server properties files in it.

  • Right click the mail file, add your email and password in where requested:

mail.smtp.username=xxx@gmail.com
mail.smtp.password=xxxx
  • Make sure your E-mail accepts unknown apps requests, to do that go to your email’s security, if you have a two way authentication you have to add Blynk to the approved apps, else just go here and allow less secure apps.

Running the Server

  • Start the cmd as administartor: to start a command prompt as an administrator, you can search for cmd, rightclick it and run at as administrator, or: Click Start, click All Programs, and then click Accessories. Right-click Command prompt, and then click Run as administrator. If the User Account Control dialog box appears, confirm that the action it displays is what you want, and then click Continue.
  1. Now we need to go to the path where we created the folder, simply type cd and the folder path after it, for example:
  1. Run the server:
  java -jar server-0.28.6.jar -dataFolder /Path

You should get the following:

Blynk Server 0.28.6 successfully started.
All server output is stored in folder 'c:\BlynkStuff\.\logs' file.
  1. Thats it, now you should see two new folders being created, Keep it running, if you want to stop it just Ctrl + C.
  • Get your local IP by by going to cmd and type:

this should return lots of info including your local IP that looks something like this:

IPv4 Address. . . . . . . . . . . : 192.168.1.55

Save it somewhere, you are going to need it later.


Connecting to the Server

  • Run the Blynk Application, and go to Create New account, follow the picture by adding your own local IP, and enter any email and password.

  • You should be logged in, Create a project and check if you recived an auto token via your E-mail, if not; check your email security as said above or disable antivirus SSL sheild in your mail scanning, if the problem remains, you can still get it via the admin panel as we will see later.

  • After creating the project you will have 100,000 Energy points to use and you will be connected to the local server.


Uploading a sketch

  • After downloading the Blynk library and extracting it to the Arduino’s library folder -usually located under Documents\Arduino\Libraries, open the Arduino IDE.

  • pick any sketch, the only thing it change will be as follows:

OLD


  Blynk.begin(auth);
  // You can also specify server:
  //Blynk.begin(auth, "blynk-cloud.com", 8442);
  //Blynk.begin(auth, IPAddress(192,168,1,100), 8442);
  

NEW


//Blynk.begin(auth); , //We will comment this
// You can also specify server:
//Blynk.begin(auth, "blynk-cloud.com", 8442);
Blynk.begin(auth, IPAddress(192,168,1,100), 8442);  //Uncomment this, enter your local server's IP

that’s all, Upload the sketch, you’re ready to go.


Accessing the admin panel

  • Usually when you start the server for the first time, it will give you admin email and password as follows:

Email : admin@blynk.cc

Password: admin

  • Go to:
https://your_ip:9443/admin

OR

https://localhost:9443/admin

From there you will monitor your server, access signed users, check their projects and auth tokens.

That’s All.

Good luck tinkering around!

Introduction:

Blynk Legacy 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.

Following tutorial will guide to install Blynk legacy server in your local Windows, Mac computer or Linux like Raspberry Pi.

Picture 1.1 shows how Blynk systems works:
Picture 1.1

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

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

In this Lesson, we will teach students how to install Blynk Legacy 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. Test your java environment by typing following command in cmd terminal:

java -version

You should see something as following

java version "1.8.0_202"

If you can’t see java version, it means your haven’t installed Java properly, please read this article to install Java

4)Go to your download folder, replace the bold font path with your folder path

cd  C:\Users\Admin\your download folder

Then 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.

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,

Go to your download folder, Run following command to start the local Blynk server:

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

you will see following result:

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)Go to your download folder, 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:

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:

Prerequisite:

You have successfully installed Blynk server in your local computer. Next step is to install Blynk Legacy APP in your cell phone.
Before install and setup your Blynk APP, you need to know your local server’s LAN IP address first, if you don’t know how to do it, read following article:

How to know my computer’s local IP address

Now let’s start to install and setup Blynk Legacy APP
1)Google Play and Apple Store do not support Blynk Legacy APP downloading anymore. But Android Mobile Device can still download the apk file from following link:
https://osoyoo.com/driver/blynk/blynk_legacy.apk
2)  Open Blynk App, click Login , you will see following UI:

3)Click the three dot icon in above UI to set local server IP and port.
Do following settings:

  • Switch server from BLYNK to CUSTOMS
  • Set your local blynk server IP
  • Set port to 9443
  • click OK

See following picture:

After you have set up the local server IP and port, you can use following steps to connect APP to local Blynk server:

  • Set Email field to [email protected]
  • Set password field to admin
  • Click Login

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  New Project UI as following:

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 Lesson1  and select Arduino UNO (or  Arduino MEGA if you are using MEGA2560),

In above UI, Click Create Project,   you will see a blank project named lesson1 as following picture,  In future, you can click (+) sign to add control Widget to create your APP UI

Get Auth Token

Blynk Auth token is the password to let your   Arduino board to exchange project data with local Blynk server. You need to set this token in your Arduino code file in future. Token is associated with a project, so you must create a project in APP before getting a Token.

You have two methods to get Blynk Token:

Method 1) In your folder where you download and save blynk-server.jar file, you will see a sub-folder called blynk, enter that folder, you will find a file  [email protected] , please use a text editor to open this file:

After open the the file, you will see following content:

In above picture, you can see that, on the right of the word “token“, there is a long string

eVEnM2WCQykIIY9w5KPfxrzzWEUfk4N

This is the token of the lesson 1 project , copy this token to a file , and you will use it in your Arduino or Raspberry Pi client software code.

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 [email protected] and password admin to login to control panel.
then please click Users->[email protected]:

Click [email protected], then you will find the Token which was just assigned for your project:

 

Introduction: How to Create a Blynk Local Server

Blynk is a software/app allows a user to control arduino devices from a smartphone or tablet. This can be done by using the company’s Blynk server or the user can host their own Blynk server. This Instructable shows you as to how the user can create their local Blynk Server.

The Files required for the process can be downloaded from the links below.

Blynk Server File: http://www.mediafire.com/download/8pyk6eg0gp5q6l2…

JavaJDK 8.77

32Bit: http://www.mediafire.com/download/72y69zvenhc10my…

64Bit: http://www.mediafire.com/download/72y69zvenhc10my…

Server Properties File: http://www.mediafire.com/download/1uxkg9jkwwmxcb3…

Mail Properties FIle: http://www.mediafire.com/download/1uxkg9jkwwmxcb3…

OpenSSL Installation Files

32Bit: http://www.mediafire.com/download/ae66hxukjp4fvax…

64Bit: http://www.mediafire.com/download/ae66hxukjp4fvax…

SSL Commands File: http://www.mediafire.com/download/ae66hxukjp4fvax…

Blynk Aurdino Library Files: http://www.mediafire.com/download/saccgzz86yeaqvf…

Step 1: The Actual Process

The actual process of creating a Blynk server has been clearly demonstrated in the video.

// DS18B20_1 - Arduino
//
// Continually measures temperatures at three points using the Dallas DS18B20 on three
// separate Arduino pins.
//
// Uses the parasitic power mode
//
// Displays to a serial LCD operating at 9600 baud.
//
// Arduino Board            DS18B20
//
//                    +5 VDC
//                    |
//                   4.7K
// 8 ---------------- |----- 2 (DQ)  Note that terms 1 and 3 are grounded.
//
// 7 ---- same as above
// 6 ---- same as above
//
// Tx ---------------------------- To Serial LCD (LCD #117)
//
// copyright, Peter H Anderson, Baltimore, MD, May 5, '07
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space

  int n, dev_channel[2] = {0, 2}, _1W_Pin;
char auth[] = "00000000000000000000000000000000"; //
IPAddress myip;
char myIpString[24];

void setup()
{
//  int n, dev_channel[2] = {0, 2}, _1W_Pin;
  Serial.begin(250000);
  while(Blynk.connect() == false) {
      Blynk.begin(auth, "ESSID", "password", IPAddress(192,168,0,1));
    delay(3000);
    Serial.print(".");
  }

  myip = WiFi.localIP();
  sprintf(myIpString, "%d.%d.%d.%d", myip[0], myip[1], myip[2], myip[3]);

  for (n=0; n<2; n++)
  {
    _1W_Pin = dev_channel[n];
    digitalWrite(_1W_Pin, LOW);
    pinMode(_1W_Pin, INPUT);   
  }
}

BLYNK_WRITE(V2) // There is a Widget that WRITEs data to V1
{
//  r = param[0].asInt(); // get a RED channel value
//  Serial.print("\nSLIDER 1: ");
//  Serial.println(r);
//  lcd.setCursor(14,1);
//  lcd.print("     ");
//  lcd.print(r);
//  lcd.print("     ");

}

void loop()
{
  int HighByte, LowByte, TReading, SignBit, Tc_100, Whole, Fract;

  Blynk.run(); // Initiates Blynk

  for (n=0; n<2; n++)
  {
     _1W_Pin = dev_channel[n];
     OneWireReset(_1W_Pin);
     OneWireOutByte(_1W_Pin, 0xcc, 0);
     OneWireOutByte(_1W_Pin, 0x44, 1);

     OneWireReset(_1W_Pin);
     OneWireOutByte(_1W_Pin, 0xcc, 0);
     OneWireOutByte(_1W_Pin, 0xbe, 0);

     LowByte = OneWireInByte(_1W_Pin);
     HighByte = OneWireInByte(_1W_Pin);
     TReading = (HighByte << 8) + LowByte;
     SignBit = TReading & 0x8000;
     if (SignBit)
     {
         TReading = (TReading ^ 0xffff) + 1;
     }
     Tc_100 = (6 * TReading) + TReading / 4;

     Whole = Tc_100 / 100;
     Fract = Tc_100 % 100;

     if(n)Blynk.virtualWrite(V0, Whole);
     else Blynk.virtualWrite(V1, Whole);
   
     Serial.print(Whole);
     Serial.print(".");
     if (Fract < 10)
     {
        Serial.print("0");
     }
     Serial.println(Fract);
     delay(1000);
  }

}

void OneWireReset(int _1W_Pin)
{
     digitalWrite(_1W_Pin, LOW);
     pinMode(_1W_Pin, OUTPUT);
     delayMicroseconds(500);
     pinMode(_1W_Pin, INPUT);
     delayMicroseconds(500);
}

void OneWireOutByte(int _1W_Pin, byte d, byte strong)
{
   byte n;

   for(n=8; n!=0; n--)
   {
      if ((d & 0x01) == 1)
      {
         digitalWrite(_1W_Pin, LOW);
         pinMode(_1W_Pin, OUTPUT);
         delayMicroseconds(5);
         pinMode(_1W_Pin, INPUT);
         delayMicroseconds(60);
      }
      else
      {
         digitalWrite(_1W_Pin, LOW);
         pinMode(_1W_Pin, OUTPUT);
         delayMicroseconds(60);
         pinMode(_1W_Pin, INPUT);
      }

      d=d>>1;
   }
   if(strong)
   {
       digitalWrite(_1W_Pin, HIGH);
       pinMode(_1W_Pin, OUTPUT);
       //delay(1000);
       pinMode(_1W_Pin, INPUT);
       digitalWrite(_1W_Pin, LOW);
   }
}

byte OneWireInByte(int _1W_Pin)
{
    byte d, n, b;

    for (n=0; n<8; n++)
    {
        digitalWrite(_1W_Pin, LOW);
        pinMode(_1W_Pin, OUTPUT);
        delayMicroseconds(5);
        pinMode(_1W_Pin, INPUT);
        delayMicroseconds(5);
        b = digitalRead(_1W_Pin);
        delayMicroseconds(50);
        d = (d >> 1) | (b<<7);
    }
    return(d);
}

Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Проверка реестра на ошибки средствами windows
  • Не могу восстановить файл из карантина защитника windows 10
  • Как удалить ненужные обновления в windows 10 полностью
  • Все телефоны на windows phone
  • Windows список устройств cmd