Contents
•Basics of Blynk Architecture
•Blynk App download to smartphone and setup the user interface
•Setting up local blynk server in Raspberry PI
•Uploading a Blynk based program from Arduino IDE to the IoT hardware ( NodeMcu)
•
DOWNLOAD FROM LINKS:
https://btreeshop.com/iotshow-2020/links.html
•
installing raspbian image to sdcard:
https://www.raspberrypi.org/documentation/installation/installing-images/
•
INSTALL BLYNK SERVER ON RASPI
#Install dependencies – java and SSL
sudo apt-get install oracle-java8-jdk
sudo apt-get install openssl
•
#Create a directory for the server called Blynk
mkdir /home/pi/Blynk
#Move into the working directory
cd Blynk
•
#Download the server (Change the server version to the latest version)
wget https://github.com/blynkkk/blynk-server/releases/download/v0.41.11/server-0.41.11.jar
#Generate self-signed certificates
Openssl req -x509 -nodes -days 1825 -newkey rsa:2048 -keyout server.key -out server.crt
•
#Convert key to pem
openssl pkcs8 -topk8 -inform PEM -outform PEM -in server.key -out server.pem
•
#Copy the contents from the site
https://raw.githubusercontent.com/blynkkk/blynk-server/master/server/core/src/main/resources/server.properties
#And paste it in
sudo nano server.properties
•
#Change the following lines
server.ssl.cert=./server.crt
server.ssl.key=./server.pem
server.ssl.key.pass=PASSWORD
•
#Copy the contents from the site
https://raw.githubusercontent.com/blynkkk/blynk-server/master/server/notifications/email/src/main/resources/mail.properties
#Paste it in
sudo nano mail.properties
#Set Gmail id and password. If you are using two step verification, generate app specific password from google account.
cd ..
•
#For Autostart on reboot
sudo nano /etc/rc.local
#Add the following command mentioned before “exit”
java -jar /home/pi/Blynk/server-0.41.11.jar -dataFolder /home/pi/Blynk -serverConfig /home/pi/Blynk/server.properties -mailConfig /home/pi/Blynk/mail.properties &
•
#Now You can start the server
java -jar /home/pi/Blynk/server-0.41.11.jar -dataFolder /home/pi/Blynk -serverConfig /home/pi/Blynk/server.properties -mailConfig /home/pi/Blynk/mail.properties
•
Server.properties
#by default server uses embedded in jar cert to simplify local server installation.
#WARNNING DO NOT USE THIS CERTIFICATES ON PRODUCTION OR IN WHERE ENVIRNOMENTS REAL SECURITY REQUIRED.
#provide either full path to files either use ‘.’ for specifying current directory. For instance “./myfile.crt“
server.ssl.cert=./server.crt
server.ssl.key=./server.pem
server.ssl.key.pass=xxxxxxx
•
mail.properties
mail.smtp.host=smtp.gmail.com
mail.smtp.port=587
mail.smtp.username=balabtree@gmail.com
mail.smtp.password=xxxxxxxx
mail.smtp.connectiontimeout=30000
mail.smtp.timeout=120000
•
Assign a static private IP address to Raspberry Pi with DHCPCD
Before you begin with the assignment of a private IP address for Raspberry Pi, check whether DHCPCD is already activated using the following command:
sudo service dhcpcd status
In case it’s not, activate DHCPCD as follows:
sudo service dhcpcd start
sudo systemctl enable dhcpcd
•
Now make sure that the configuration of the file /etc/network/interfaces has the original status. For this, the ‘iface’ configuration needs to be set at ‘manual’ for the interfaces.
For the editing of the activated DHCPCDs, start by opening the configuration file /etc/dhcpcd.conf and running the following command:
sudo nano /etc/dhcpcd.conf
You’ll now carry out the configuration of the static IP address. If your Raspberry Pi is connected to the internet via an Ethernet or network cable, then enter the command ‘interface eth0’; if it takes place over Wi-Fi, then use the ‘interface wlan0’ command.
•
To assign an IP address to Raspberry Pi, use the command ‘static ip_address=’ followed by the desired IPv4 address and the suffix ‘/24’ (an abbreviation of the subnet mask 255.255.255.0). For example, if you want to link a computer with the IPv4 address 192.168.2.4, then you need to use the command ‘static ip_address=192.168.2.4/24’. It goes without saying that the address used here is not yet used anywhere else. As such, it also can’t be located in the address pool of a DHCP server.
•
You still then need to specify the address of your gateway and domain name server (usually both are the router). Raspberry Pi turns to the gateway address if an IP address to which it wants to send something is outside of the subnet mask (in the example, this would mean outside of the range 192.168.2). In the following command, the IPv4 address 192.168.2.1 is used as an example as both the gateway and DNS server. The complete command looks like this in our example (where a network cable is used for the internet connection):
interface wlan0
static ip_address=192.168.2.102/24
static routers=192.168.2.1
static domain_name_servers=192.168.2.1
•
The command lines above match the IPv4 addresses that you want to use for your Raspberry Pi, or where your router is assigned. Save the changes with ‘Ctrl + O’ and then press the enter key. Close the configuration file with ‘Ctrl + X’. Restart to adopt the newly assigned static IP address in the network:
sudo reboot
•
Now use a ping command to check whether the Raspberry Pi is accessible in the network with its new IP address:
Ping 192.168.2.102
If the connection of the IP address was successful, you’ll see that you can reach it under the new IP address with a ping.
Static IP addresses for Raspberry Pi are sometimes vital
A static private IP address is primarily necessary if you want to use Raspberry Pi as a server.
•
check if Blynk server is running in raspi
Type this command in raspi console.
ps -aux grep java
# start the blynk admin interface in web browser:
https://192.168.2.102:9443/admin
admin login: admin@blynk.cc
password: x14111123z