OVERVIEW
I set up my first blynk app about half years ago,recently, i hope to show the data on the website,but not only on the app. I’ve try many ways to make it , days later,i made it with Raspberry Pi 3,blynk_server,postgresql9.6 and Metebase.
Raspberry Pi 3 is the server;blynk_server is the Blynk server;postgresql to storage data;Metabase will help you to create dashboard to display table or lines.
install raspberry
- Download raspberry from :https://www.raspberrypi.org/downloads/raspbian/
- recommend: RASPBIAN STRETCH LITE
Config Raspberry
- Set network, timezome,language , trun on the SSH by
sudo raspi-config
.(It’s very important to set the timezone to your city)
Install software
- Get update by
sudo apt-get update && apt-get upgrade -y
- Install java8 by
sudo apt-get install oracle-java8-jdk
- Verify java version by
java -version
Setup blynk server
- Download blynk server by
wget "https://github.com/blynkkk/blynk-server/releases/download/v0.30.3/server-0.30.3-java8.jar"
- Create the config file by
sudo nano server.properties
; paste the file in https://github.com/blynkkk/blynk-server/blob/master/server/core/src/main/resources/server.properties - Enable the DB function
#enable DB
enable.db=true
#enable raw data storage to DB
enable.raw.db.data.store=true
Install PostgreSQL9.6
sudo apt-get update
apt-get --no-install-recommends install postgresql-9.6 postgresql-contrib-9.6
- Download the SQL file by
wget https://raw.githubusercontent.com/blynkkk/blynk-server/master/server/core/src/main/resources/create_schema.sql
- Change the timestamp type in the sql file( otherwise you will confused by Timezone problem)
sudo nano create_schema.sql
Change all thetimestamp
intotimestamp with time zone
- Move create_schema.sql to temp folder (to avoid permission problems)
mv create_schema.sql /tmp
- Connect to PostgreSQL
sudo su - postgres
psql
- Create Blynk DB, test user and tables
\i /tmp/create_schema.sql
- Quit psql
\q
At this part ,i refer to https://github.com/blynkkk/blynk-server#enabling-raw-data-storage
install metabase
cd /home/pi
wget http://downloads.metabase.com/v0.27.2/metabase.jar
Set autostart by edit rc.local
sudo nano /etc/rc.local
Add two lines in the file
java -jar /home/pi/server-0.30.3-java8.jar -dataFolder /home/pi/Blynk &
java -jar /home/pi/metabase.jar
Reboot & enjoy
- Reboot by
sudo reboot
- Wait 2-3 minutes…the blynk server ,metabase, psql will working one by one.
- Blynk_server:http://raspberry_ip:8000
- Metabase:http://raspberry_ip:3000
Metabase Guide
- Visit:http://raspberry_ip:3000,wait minutes
- The info of blynk database :databese name:blynk,username:test;passwd:test.(you can change the database info in the create_schema.sql)
- Create a dashboard and question in the MetaBase.you can get more info in the http://www.metabase.com