Blynk With ESP8266

by lightbluecrab in Circuits > Arduino

46952 Views, 20 Favorites, 0 Comments

Blynk With ESP8266

NDMCUBLYNK.png

Blynk is an Internet of Things platform, which makes controlling hardware remotely and visualizing its data very easy. You can create your own interfaces using the free Blynk App. Every WiFi, Bluetooth/BLE, Ethernet and Serial device is able to connect to the Blynk cloud or a locally running server. Supported hardware can be found on blynk.cc

This instructable will only cover how to install and get started with an ESP8266 developement board (NodeMCU), using the provided cloud service.

Prerequisites and Parts

NodeMCUClose.jpg

Parts

  1. ESP8266 (NodeMCU)
  2. LED

Prerequisites

  1. Arduino IDE (1.8.5 or newer)
  2. WiFi (credentials)

The app can only be installed on smartphones or emulators!

Installation

Preferences.JPG
BoardMenu.JPG

Include ESP8266 Core to Arduino IDE

1) Goto 'Preferences' and enter the following URL to Additional Board Manager URLs

http://arduino.esp8266.com/stable/package_esp8266com_index.json

2) Open the Boards Manager (Tools > Board Menu)

3) Search for "esp8266" and install the latest version

4) Select your board under Tools > Board and define Baud Rate etc.

Install Blynk libraries

1) Install the latest release of the Blynk libraries on GitHub

2) Unpack it

3) Move the libraries to C:/User//Documents/Arduino/libraries

Install Blynk App

1) Download the App for iOS or Android

Create Project

ProjectSettings.jpg
ButtonSettings.jpg
Interface.jpg

Before creating your project you have to create an account or sign in.

  1. Click 'Create New Project'
  2. Choose your device and connection type (NodeMCU, WiFi)
  3. Receive and note down your 'Auth Token'
  4. Open the 'Widget Box' ('+')
  5. Add a button
  6. Name it and select switch mode
  7. Define the output pin the LED is connected to (anode Dx, cathode GND)

This example interface is very basic, but you can create more complex interfaces if you add graphs etc.

The Code

Library.png
Code.JPG

The client-side code for remote controlling an LED is very easy.

  1. Open the Arduino IDE
  2. Goto Examples > Blynk > Boards_WiFi and select your dev board
  3. Enter your 'Auth Token' (char auth[])
  4. Enter your WiFi credentials (char ssid[], char pass[])
  5. Compile and Upload
  6. Open the Serial Monitor and check whether connecting was successful

If everything worked properly, your now able to turn on and of the LED remotely using the Blynk App.

More information about Blynk and ESP8266 can be found on blynk.io and esp8266doc.