Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

BLYNK Chapter

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 11

BLYNK :

Blynk was designed for the Internet of Things. It can control hardware remotely, it can display
sensor data, it can store data, visualize it and do many other cool things.

There are three major components in the platform:

 Blynk App - allows to you create amazing interfaces for your projects using various
widgets we provide.
 Blynk Server - responsible for all the communications between the smart phone and
hardware. You can use our Blynk Cloud or run your private Blynk server locally. Its open-
source could easily handle thousands of devices and can even be launched on a Raspberry Pi.
 Blynk Libraries - for all the popular hardware platforms - enable communication with
the server and process all the incoming and out coming commands.
Now imagine: every time you press a Button in the Blynk app, the message travels to the Blynk
Cloud, where it magically finds its way to your hardware. It works the same in the opposite
direction and everything happens in a blynk of an eye.

Fig : . 1.Role of Blynk Server.


Blynk works over the Internet. This means that the hardware you choose should be able to
connect to the internet. Some of the boards, like Arduino Uno will need an Ethernet or Wi-Fi
Shield to communicate, others are already Internet-enabled: like the ESP8266, Raspberri Pi with
WiFi dongle, Particle Photon or SparkFun Blynk Board. But even if you don’t have a shield, you
can connect it over USB to your laptop or desktop (it’s a bit more complicated for newbies, but
we got you covered).

The Blynk App is a well designed interface builder. It works on both iOS and Android.

Configure Blynk app :

Blynk is a Platform with IOS and Android apps to control Arduino, Raspberry Pi and the likes
over the Internet. It’s a digital dashboard where you can build a graphic interface for your
project by simply dragging and dropping widgets.

Fig : . 2. Creating a new project.


Blynk application can be found from the following links –

1. Android Blynk App

2. IOS Blynk App

After downloading the app, create an account and log in. (If possible than log in with your real
mail id for better connectivity later).

Fig: .3.Signing in Blynk.

You’ll also need to install the Blynk Arduino Library, which helps generate the firmware
running on your ESP8266. Download the latest release from https://github.com/blynkkk/blynk-

library/releases , and follow along with the directions there to install the required libraries.

Create a Blynk Project :

Click the “Create New Project” in the app to create a new Blynk app. Give it any name and click
on “create”.
Blynk works with hundreds of hardware models and connection types. Select the
Hardware type. After this, select connection type. In this project we have select WiFi
connectivity.

Fig : .4.Interfacing Blnk and


Fig : . 5. After creating a new project.
NodeMcu.
The Auth Token is very important – you’ll need to stick it into your ESP8266’s firmware. For
now, copy it down or use the “E-mail” button to send it to yourself.

Add Widgets To The Project :

Then you’ll be presented with a blank new project. To open the widget box, click in the project
window to open.

We are selecting a button to control Led connected with NodeMCU.

1. Click on Button.
2. Give name to Button say led.                                    
3. Under OUTPUT tab- Click pin and select the pin to which led is connected to
NodeMCU, here it is digital pin 2, hence select digital and under pin D2. And Click
continue.

Under MODE tab- Select whether you want this button as “push button” or “Switch”. You have
successfully created a GUI for Arduino.

Fig : . 7.Creating Widgets. Fig : . 8.Button settings.

Upload The Firmware :

Now that your Blynk project is set-up, open Arduino and navigate to the
ESP8266_Standalone example in the File > Examples > Blynk > Boards_WiFi>
ESP8266_Standalone menu as shown in below figure-9.

Stand Alone Programming Code:


Before uploading, make sure to paste your authorization token into the auth [] variable. Also
make sure to load your Wifi network settings into the Blynk.begin(auth, “ssid”, “pass”) function.
Fig : . 9.Changing the settings in the Arduino IDE for uploading the source code.

Execution : After the app has uploaded, open the serial monitor, setting the baud rate to 9600.
Wait for the “Ready” message.
Fig button
Then click the “Run” : . 10. Output after
in the top rightinstalling
corner ofand
the the Blynk
Blynk app. by using
Press theSerial
button and watch
monitor.
the LED. Then add more widgets to the project. They should immediately work on the ESP8266
without uploading any new firmware.

Blynk main operation :

Virtual pins : Blynk can control Digital and Analog I/O Pins on you hardware directly. You
don’t even need to write code for it. It’s great for blinking LEDs, but often it’s just not enough…
We designed Virtual Pins to send any data from your microcontroller to the Blynk App and
back.
Anything you connect to your hardware will be able to talk to Blynk. With Virtual Pins you can
send something from the App, process it on microcontroller and then send it back to the
smartphone. You can trigger functions, read I2C devices, convert values, control servo and DC
motors etc.
Virtual Pins can be used to interface with external libraries (Servo, LCD and others) and
implement custom functionality.
Hardware may send data to the Widgets over the Virtual Pin like this:

Blynk.virtualWrite(pin, "abc");
Blynk.virtualWrite(pin, 123);
Blynk.virtualWrite(pin, 12.34);
Blynk.virtualWrite(pin, "hello", 123, 12.34);

Fig : . 11.Mapping of virtual pins.

All Controller Widgets can send data to Virtual Pins on your hardware. For example, code below
shows how to get values from the Button Widget in the App. For example the commands used to
to get values from the Button Widget in the App are,

BLYNK_WRITE(V1) //Button Widget is writing to pin V1


{
int pinData = param.asInt();
}
Fig : . 12. Code to get values from Buttons.

When you press a Button, Blynk App sends ‘1 ‘ On the second click it sends ‘0’.

This Blynk is used not only for a single connection . it


supports multiple of virtual pins at a time.

Fig : . 13.Widget setting for a single relay fig : . 14. Multiple arrays of widgets.

Module.

Features of Blynk :
 Similar API & UI for all supported hardware & devices
 Connection to the cloud using:
o WiFi
o Bluetooth and BLE
o Ethernet
o USB (Serial)
o GSM
o …
 Set of easy-to-use Widgets
 Direct pin manipulation with no code writing
 Easy to integrate and add new functionality using virtual pins
 History data monitoring via SuperChart widget
 Device-to-Device communication using Bridge Widget
 Sending emails, tweets, push notifications, etc.
features are constantly added.
You can find example sketches covering basic Blynk Features. They are included in the library.
All the sketches are designed to be easily combined with each other.
Formatting options ;
For example: your sensor sends vaule of 12.6789 to Blynk application. Next formatting
options are supported:
/pin/ - displays the value without formatting (12.6789).
/pin./ - displays the rounded value without decimal part (13).
/pin.# - displays the value with 1 decimal digit (12.7).
/pin.##/- displays the value with two decimal places (12.68).

Blynk libraries:

 With Blynk Library you can connect over 400 hardware models (including ESP8266,
ESP32, NodeMCU, all Arduinos, Raspberry Pi, Particle, Texas Instruments, etc.)to the
Blynk Cloud. Full list of supported hardware can be found here.

 With Blynk apps for iOS and Android apps you can easily drag-n-drop graphic


interfaces for any DIY or commercial project. It's a pure WYSIWG experience: no
coding on iOS or Android required.

 Hardware can connect to Blynk Cloud (open-source server) over the Internet using
hardware connectivity available on your board (like ESP32), or with the use of various
shields (Ethernet, WiFi, GSM, LTE, etc). Blynk Cloud is available for every user of
Blynk for free. Direct connection over Bluetooth is also possible.

Blynk libraries platform :

o Python.
o Micro python.

Python is an interpreted, high-level, general-purpose programming language. Created by Guido


van Rossum and first released in 1991, Python's design philosophy emphasizes code
readability with its notable use of significant whitespace. Its language constructs and object-
oriented approach aim to help programmers write clear, logical code for small and large-scale
projects.

Python is dynamically typed and garbage-collected. It supports multiple programming


paradigms, including procedural, object-oriented, and functional programming. Python is often
described as a "batteries included" language due to its comprehensive standard library. Python
was conceived in the late 1980s as a successor to the ABC language. Python 2.0, released in
2000, introduced features like list comprehensions and a garbage collection system capable of
collecting reference cycles. Python 3.0, released in 2008, was a major revision of the language
that is not completely backward-compatible, and much Python 2 code does not run unmodified
on Python 3.

MicroPython is a software  implementation of a programming language largely compatible


with Python 3, written in C, that is optimized to run on a microcontroller. MicroPython is a full
Python compiler and runtime that runs on the micro-controller hardware. The user is presented
with an interactive prompt (the REPL) to execute supported commands immediately. Included
are a selection of core Python libraries. MicroPython includes modules which give the
programmer access to low-level hardware. MicroPython includes a cross compiler which
generates MicroPython bytecode (file extension .mpy). The Python code can be compiled into
the bytecode either directly on a microcontroller or it can be precompiled elsewhere.
MicroPython firmware can be built without the compiler, leaving only the virtual machine which
can run the precompiled mpy programs.

MicroPython was originally created by the Australian programmer and physicist Damien


George, after a successful Kickstarter backed campaign in 2013.  While the original Kickstarter
campaign released MicroPython with an STM32F4-powered development board "pyboard",
MicroPython supports a number of ARM based architectures. The ports supported in the
mainline are ARM Cortex-M (many STM32 boards, TI CC3200/WiPy, Teensy boards, Nordic
nRF series, SAMD21 and SAMD51), ESP8266, ESP32, 16bit PIC, Unix, Windows, Zephyr, and
JavaScript.  Also, there are many forks for a variety of systems and hardware platforms not
supported in the mainline. 

You might also like