Book Image

Hands-On Internet of Things with Blynk

By : Pradeeka Seneviratne
Book Image

Hands-On Internet of Things with Blynk

By: Pradeeka Seneviratne

Overview of this book

Blynk, known as the most user-friendly IoT platform, provides a way to build mobile applications in minutes. With the Blynk drag-n-drop mobile app builder, anyone can build amazing IoT applications with minimal resources and effort, on hardware ranging from prototyping platforms such as Arduino and Raspberry Pi 3 to industrial-grade ESP8266, Intel, Sierra Wireless, Particle, Texas Instruments, and a few others. This book uses Raspberry Pi as the main hardware platform and C/C++ to write sketches to build projects. The first part of this book shows how to set up a development environment with various hardware combinations and required software. Then you will build your first IoT application with Blynk using various hardware combinations and connectivity types such as Ethernet and Wi-Fi. Then you'll use and configure various widgets (control, display, notification, interface, time input, and some advanced widgets) with Blynk App Builder to build applications. Towards the end, you will learn how to connect with and use built-in sensors on Android and iOS mobile devices. Finally you will learn how to build a robot that can be controlled with a Blynk app through the Blynk cloud and personal server. By the end of this book, you will have hands-on experience building IoT applications using Blynk.
Table of Contents (10 chapters)

Installing prerequisite software on Raspbian

Now you're ready to install all the required software on your Raspberry Pi to prepare it to work with Blynk Cloud:

  • Update and upgrade packages
  • git core
  • WiringPi
  • Blynk libraries

Updating and upgrading Raspbian

Let's see how to update and upgrade Raspbian:

  1. First, update your system's package list by entering the following command:
pi@raspberrypi:~ $sudo apt-get update

Refer to the following screenshot:

Updating Raspbian
  1. Then, upgrade all your installed packages to their latest versions with the following command:
pi@raspberrypi:~ $sudo apt-get dist-upgrade
  1. When prompted, press Y to continue:
Upgrading Raspbian

Installing git

You will need to install git-core on your Raspberry Pi to work with git repositories for cloning packages like WiringPi, and Blynk libraries.

  1. With the SSH to your Raspberry Pi with PuTTY, run the following command:
pi@raspberrypi:~ $sudo apt-get install git-core
Installing git-core
  1. This will install git on your Raspberry Pi. After installation is complete, verify the version of git by using the following command:
pi@raspberrypi:~ $ git -version

Refer to the following screenshot:

Verifying git version

Installing WiringPi

WiringPi is a PIN-based GPIO access library that can be used with all versions of Raspberry Pi:

  1. First, run the following command to clone the WiringPi repository:
pi@raspberrypi:~ $ git clone git://

Refer to the following screenshot:

Cloning WiringPi
  1. Then move to the wiringPi directory:
pi@raspberrypi:~ $ cd wiringPi
  1. Run the following command to build the WiringPi:
pi@raspberrypi:~/wiringPi $ ./build

Refer to the following screenshot:

Building WiringPi

Deploying Blynk libraries

Let's look at how to deploy Blynk libraries:

  1. You can deploy the Blynk libraries on Raspberry Pi by running the following commands:
pi@raspberrypi:~/wiringPi $ cd
pi@raspberrypi:~ $ git clone

Refer to the following screenshot:

Cloning Blynk libraries
  1. After cloning the git repository, move to the linux directory:
pi@raspberrypi:~ $ cd blynk-library/linux
  1. Then build the library from source by targeting Raspberry Pi:
pi@raspberrypi:~/blynk-library/linux $make clean all target=raspberry
  1. This command will output the Blynk file that will be used to connect to the Blynk server:
Building Blynk libraries