You are on page 1of 19

Node-MCU Guidebook

with Blynk App for Internet of Things


(Advance)
CONTENTS
○ Node MCU pin configuration .........................................................................2

○ Installing Node-MCU D1 library on IDE............................................................3

○ How to uploading program into Node-MCU......................................................7

○ Blynk......................................................................................................................8

○ How Blynk works....................................................................................................8

○ Create a new account.............................................................................................9

○ Create a new project.............................................................................................10

○ Other libraries required.........................................................................................11

○ How to add library to Arduino IDE..........................................................................12

○ Project 1 Control the direction of 2 dc motor with ESP12E motor driver.................13

○ Project 2 Display temperature chart and notifications if the temperature exceeds the
limit ..........................................................................................................................19

○ Project 3 Request temperature value via terminal..................................................25

○ Project 4 Send email if temperature exceeds the limit ...........................................29

○ Project 5 ON / OFF lamp based on time..................................................................33

1
Node MCU Pin Configuration
Node MCU is board of Internet of Things (IoT) based ESP8266.

➢ Features:
• Arduino-like hardware IO.
• Event-driven API for network applications.
• 10 GPIO, D0-D10, PWM functionality, IIC and SPI communicaiton, 1-Wire
and ADC A0 etc. all in one board.
• Wifi networking (can be used as access point and/or station, host a
webserver), connect to internet to fetch or upload data.
• Excellent few system on board for Internet of Things (IoT) projects.

2
• The ESP8266 chip requires 3.3V power supply voltage. It should not be
powered with 5 volts like other arduino boards.
• NodeMCU can be connected to 5V using micro USB connector or Vin pin
available on board.
• The I/O pin of ESP8266 has input/output max 3.3V only, the pins are NOT
5V tolerant inputs.

Installing Node MCU Library


Step1. Installing Arduino Software/IDE

Step2. Telling Arduino Where to Find the Node-MCU Library

3
4
Step3. Installing Node-MCU Board Via the Board Manager

5
Step4. Selecting Node-MCU Board

6
Step5. Ensure that you have selected the correct board as shown in below figure.
Also make sure that you have selected the appropriate COM port.

How to uploading program into Node-MCU


1. Install CP2102 USB driver then connect Node-MCU and USB ports on PC using
data cable.
2. Go to tools menu, select NodeMCU 1.0 (ESP-12E Module) then select port
available.
3. Click verify to check the program then click upload for uploading the program
into Node-MCU.

7
Blynk
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. It's really
simple to set everything up and you'll start tinkering in less than 5 mins. Blynk is
not tied to some specific board or shield. Instead, it's supporting hardware of your
choice. Whether your Arduino or Raspberry Pi is linked to the Internet over Wi-Fi,
Ethernet or this new ESP8266 chip, Blynk will get you online and ready for the
Internet Of Your Things.

How Blynk Works


Blynk was designed for the Internet of Things. It can control hardware remotely, it
can display sensor data, it can store data, vizualize 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
smartphone and hardware. You can use our Blynk Cloud or run your private
Blynk server locally. It’s 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 outcoming
commands.

Now imagine: every time you press a button in the Blynk app, the message travels
to space 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. Blynk app can be downloaded from App Store, and you must have Blynk
library for programming Node-MCU on Arduino IDE later.

8
Create a New Account
Log in with your facebook or with your email account.

9
Create a New Project
1. Tap the plus symbol to create a new project.

2. Specify the project name, choose theme you want, then choose the device
used and the connection used. This project using Node-MCU and WiFi
connection.

3. Tap create

4. Go to project settings, choose your device, and tap email to get auth tokens
from blynk that required on Node-MCU programming.

10
CHECK YOUR EMAIL TO FIND MESSAGES THAT CONTAIN AUTH
CODE FROM BLYNK NOW!!

11
Other libraries required
Required installation of several libraries before starting the project, the mentioned
libraries can be installed through manage libraries, or download the mentioned
libraries from internet and manually install via the add.ZIP library menu. The
following libraries are required:

1. DallasTemperature.h

2. OneWire.h

3. blynk-library-master.zip

4. SimpleTimer.h

How to add library to Arduino IDE


1. Sketch>>Include Library>>Manage Libraries and select the library you want to
install.
2. Sketch>>Include Library>>add.ZIP library and choose that library you have
downloaded from internet.

The second way is used if the required libraries are not


available in the library manager and must be downloaded
from the internet.

12
Project 1
Control the direction of 2 dc motor with ESP12E
motor driver

Step 1. Materials needed

a. ESP12E motor driver, smartphone, and WiFi with internet connection


b. 2 DC motor
c. Node-MCU, jumper cable, and project board
d. Computer and data cable for downloading program
e. Lipo batterry 9V

Step 2. Widget used

a. Joystick

What is ESP12E motor driver?

13
ESP-12E Motor Shield is designed and developed by Shenzhen Doctors of
Intelligence & Technology (SZDOIT). This large current motor driven module can
compatible with ESP12E Dev Kit and NodeMCU. By using the overlap-plug design,
the motor shield can be directly plugged by ESP-12E Dev Kit and NodeMCU Lua
module.

This shield board is driven by the special excent large power full-bridge chip
L293DD from the famous Stmicroelectronics company, which can directly drive 2-
channels DC motors or one-channel stepper motor. The driven current can be
arrived at 1.2A. This board is generated with national layout, SMT ensuption, and
convenient installation.

In this motor shield board, the IO port of ESP-12E Dev Kit is used as the control
port. The logic chip configured inside can finish IC driven. Thus, the shield board
has four ports: D1, D2, D3, and D4, which are used as PWMA(motor A), PWMB
(motor B), DA (direction of motor A), and DB (direction of motor B), respectively.

In addition, this shield board has many pins, such as VIN, 3.3V, DIO, AIO, SDIO,
UART, SPI, RST, and EN, thus can conveniently connect all kinds of sensors (e.g.,
temperature and humidy, buzzer, light, relay sensor, etc.).

The board is developed by the humanized design with a power switch, and thus
user can control the on-off of power conveniently.

This motor shield board can be used to control directly the smart car

In essence, the motor shield features:

1. Four powered outputs controlled by NodeMCU IO 1, 2, 3 and 4


2. Optional dual voltage for motors and NodeMCU
3. Convenience breakout for all relevant pins

14
The motor power pins are labeled as A-, A+, B- and B+. The nodemcu and Arduino
GPIO is not mapped the same. If you try to use the D1 pin as io-pin 1 in Arduino
IDE it will not work.

Board pin | NodeMCU GPIO | Arduino IDE


A- 1 5 or D1
A+ 3 0 or D3
B- 2 4 or D2
B+ 4 2 or D4
Step 3. Electrical circuit

15
Step 4. Set up program on IDE then upload program into Node-MCU

Fill in auth with your


auth token from blynk
app, fill in ssid and pass
with your WiFi ID and
your WiFi password

16
17
Step5. Set up Blynk App

A. Add joystick from widget box

B. Tap joystick, set up joystick settings like the picture below, then tap
triangle symbol to play your blynk project!!

18

You might also like