Controlling an LED Over the Internet

In this article, we are going to control the Node MCU’s built in LED over the web using the Blynk application.

You will need the following items to carry out this project.:

  • NodeMCU ESP8266 12E development board (Buy Here)
  • Smart Phone with Blynk App installed (iOS or Android).
  • Latest Arduino IDE (Download)

Introducing the NodeMCU Board

The NodeMCU is an Open-source, Programmable, Low cost, Simple, Wi-Fi enabled board which can help you to build IoT projects in the shortest possible time. The board is based on ESP8266 chips made by Espressif, and comes with GPIO pins, PWM, I2C, 1-Wire and ADC. To crown the NodeMCU as the king of IoT prototyping and DIY boards, it is programmable using the Arduino IDE.

One drawback though, it only works at 3V logic and you must make special arrangements when working with 5V circuits.

Node MCU Board
nodemcu pinout
NodeMCU Pinout Diagram

In the Blynk of an Eye

Blynk is a Platform with iOS and Android app that allows you to send control signals, visualize data and lots more on an Arduino, Raspberry Pi or ESP8266 over the Internet in the Blynk of an eye.

There are three major components that allow you to create graphical user interfaces for your IoT project in minutes.

See www.blynk.com for further details.

IMPLEMENTATION

Now that we have some insights about the hardware and the app, we can proceed to implement.

Please ensure that the CH340 Driver for the NodeMCU board is installed.

STEP 1: INSTALL REQUIRED LIBRARIES

This Blynk app has set of library files which must be included in the Arduino IDE environment before the project is executed

  1. Follow the link to install libraries http://www.blynk.cc/getting-started/
  2. Once the Zip file is downloaded, extract it and individually copy all the folder to your libraries folder of your Arduino.
  3. Once done just open Arduino IDE and go to Sketch> Include libraries and you would see Blynk in the menu.
  4. If you find it, Blynk libraries have been included successfully.
Adding Blynk library to Arduino IDE
Adding Blynk library to Arduino IDE

 

The Arduino IDE does not come with a NodeMCU compiler installed. In order to compile and upload functional code to the board, follow these steps:

  •  In the Arduino IDE go to File>Preferences
  •  Now copy the below link and paste it in the Additional Boards Manager URL text box: http://arduino.esp8266.com/stable/package_esp8266com_index.json

 

Adding ESP8266 to Arduino IDE
Adding ESP8266 to Arduino IDE
  • Restart the Arduino IDE.
  •  Proceed to Tools>Board>Board Manager… Search for ESP8266 and install it (it takes a few minutes to download and install).
  •  Restart the Arduino IDE, go to Tools>Boards and select Node MCU board.
Selecting the NodeMCU Board

STEP2: Set Up Blynk

This step by step guide runs you through the steps required to run setup the Blynk App.

1. Open the Blynk App

2. Create a new project and note the Auth Token emailed to you

3. Add a Button

4. Set the button to control Digital GPIO 2 (Built-in LED)
5. The LED Control Button

STEP 3: UPLOAD THE CODE

  1. Connect your Esp8266 Wi-Fi to your PC
  2. In Arduino IDE  go to File>Examples>Blynk-Boards_Wifi->Esp8266Standalone
    Select the correct board (NodeMCU 1.0) and the corresponding serial port from the Tools Menu.
  3. Edit the code by entering the Authentication token emailed, your WiFi SSID and Password

    Edit Auth. Token and Password
  4. Click the Upload button
  5. You should be able to control the LED with the press of a button.

Now that we have the basics, let’s know what you plan to build next in the comments section. Thank you.

3 Replies to “Controlling an LED Over the Internet”

Leave a Reply to Vitamin Cancel reply

Your email address will not be published. Required fields are marked *