Blynk With ESP8266

Introduction: Blynk With ESP8266

About: interested in arduino projects and programming

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.

Step 1: Prerequisites and Parts

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!

Step 2: Installation

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

Step 3: Create Project

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.

Step 4: The Code

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.

Be the First to Share

    Recommendations

    • Chocolate Challenge

      Chocolate Challenge
    • Go Big Challenge

      Go Big Challenge
    • Digital Fabrication Student Design Challenge

      Digital Fabrication Student Design Challenge

    3 Comments

    0
    saravah
    saravah

    Question 7 months ago

    Bonjour,
    J'essaye vainement de faire fonctionner l'ESP8266-12E ,notamment avec ce code!
    En téléchargeant l'app. BLYNK j'ai été redirigé vers la nouvelle version.
    L'interface n'est pas la même, ( on ne me demande pas de sélectionner un pin sur l'ESP )
    Quand je clique sur le bouton, je vois que la console Blynk suit mon instruction (le bouton se met en On ou Off ) mais rien ne se passe sur l'ESP , pas de Led allumée.
    Le device est bien online.
    Je "crois" avoir bien suivi toutes les instructions.
    J'ai testé l'ESP avec un programme WIFI "interne" (à coté de la Livebox sans serveur externe) et tout fonctionne.
    Je ne sais plus trop quoi tenter !
    Si vous avez une idée, je suis preneur, il y a peut être une bêtise que j'ai oublié....
    Merci


    0
    lightbluecrab
    lightbluecrab

    Answer 7 months ago

    As far as I can tell, changes have been made to blynk's codebase recently. Therefore you should take a look at the latest docs on blynk.cc - especially the 'Getting Started' section appears to be helpful.

    0
    saravah
    saravah

    Reply 7 months ago

    J'ai effectivement suivi cette démarche, maintenant si je vais sur la section "Commencer", je suis sur la page Blynk.Console ou je retrouve mon device avec mot de passe etc..
    J'utilise ce code:

    #define BLYNK_TEMPLATE_ID "TMPLde_Of-0M"
    #define BLYNK_DEVICE_NAME "première "
    #define BLYNK_AUTH_TOKEN "oGDwjefNxxxxxxxxxxxfk0TfqC2S9C2";
    #define BLYNK_PRINT Serial
    #include <ESP8266WiFi.h>
    #include <BlynkSimpleEsp8266.h>
    #include <SPI.h>
    char auth[] = "oGDwjexxxxxxxxxx0TfqC2S9C2";
    void setup() {
    Serial.begin(115200);
    Blynk.begin(auth, "LiveboxXXXE", "oTvMaxxxxxxxx7n9o67");
    pinMode(0,OUTPUT);
    }
    void loop() {
    Blynk.run();
    }
    J'utilise le type de carte NodeMCU I.O (ESP-12E Module)

    Sur Blynk j'ai un seul bouton ,SWITCH ,Double Data Stream 0
    Le Serial m'indique que je suis connecté.
    Sur la console je suis "Online".
    Sur la page METADATA les cases location, device timezone et hotspot ne sont pas remplies.
    Sur la page Services , je lis : nodatastreams

    Et.........rien ne se passe en cliquant sur le bouton !
    Ou peut se trouver mon erreur ou oubli ?