IOT 16×2 LCD using Nodemcu esp8266, wireless LCD Display
Table of Contents
IoT 16×2 LCD Description:
IOT 16×2 LCD can be used for the remote data monitoring using Nodemcu Esp8266 wifi Module and Blynk Application. I have been using 16×2 LCD for displaying the sensors data. 16×2 LCD Physical interfacing with Arduino or Mega or Nodemcu esp8266 wifi module is really a hectic job, as it needs a lot of soldering and needs many IO pins to control a 16×2 LCD.
In this tutorial, you will learn how to use a 16×2 LCD on your cell phone and display the sensor values and text messages just like the ordinary 16×2 LCD. But this version of the 16×2 LCD is pretty advanced as this is an IOT based LCD. You can also call this a wireless LCD, with the help of this LCD you can monitor your sensors from anywhere around the world using your cell phone.
In this article based on the IoT 16×2 LCD display system, I will explain the very basic things, how to use the 16×2 LCD widget in blynk application. For demonstration purposes, I will use a variable resistor with the analog pin A0 of the Nodemcu module, so that you can easily understand the basics. While in the next tutorial I will show you how you can use this LCD with Arduino in an advanced level project, in which the Nodemcu esp8266 wifi module will be interfaced with the Arduino. So the next Tutorial will be based on the 110/220V ac mains frequency monitoring system using the 16×2 LCD widget in blynk application.
Amazon Links:
Other Tools and Components:
Super Starter kit for Beginners
PCB small portable drill machines
DISCLAIMER:
Please Note: these are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!
Circuit Diagram of the IoT 16×2 LCD:
This is the complete circuit diagram designed in cadsoft eagle 9.1.0 version. If you want to learn how to make schematics and PCB’s then watch the video tutorial.
Let’s start with the power supply, J1 is a dc female power jack where we can connect a 12v adaptor or a battery, this 12v will be used for powering up the Nodemcu module. As you can see this 12v is connected with the input of the 7805 voltage regulator. 470uf capacitors are connected at the input and output of the voltage regulator. A 330 ohm resistor is connected in series with the led.
This is a current limiting resistor. The output pin of the 7805 voltage regulator is connected with the Vin pin of the Nodemcu module while the ground is connected with the ground. Make sure you connect all the grounds together. A0 pin of the Nodemcu will be used for monitoring the variable resistor; this variable resistor can be replaced with any analog sensor. As you can see the variable resistor middle pin is connected with A0 pin of the Nodemcu while the rightmost and leftmost pins of the variable resistor are connected with 3.3v and gnd. Now let’s make an application using Blynk. I will be doing the screen recording, so that you can easily understand.
Note: this old version of the Blynk app is no more functional. For the blynk mobile App setup and Blynk.cloud dashboard setup ready my article on the New Blynk V2.0. In this article I have explained how to migrate your projects from Blynk 1.0 to the new Blynk V2.0. You can also watch the video.
Blynk Application Designing for the IoT 16×2 LCD Display Widget:
- First of all, open the blynk application.
- Click on the new project.
- set the project name as LCD.
- Click on the choose device and select Nodemcu and make sure you set the connection type to wifi, then click on the create button, an authentication token will be send on your email id, which will be then used in programming, simply copy and paste it in programming.
- Click anywhere on the screen and search for the lcd widget and add it.
- click on the lcd widget, change the input type to advanced then click on the pin and select virtual pin V2. If you want you you can change the screen color and fonts color. if you want you can select any other color.
- our application is ready and now let’s discuss the programming….
For the Step by Step cell phone Blynk Application designing watch video Tutorial available at the end of this Article.
Nodemcu ESP8266 wifi Module Programming:
Before you start the programming for the iot 16×2 LCD Project first of all make sure that you download all the necessary libraries and you install the Nodemcu board and you also install a driver for the USB UART. I have a separate video on this.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
/* * lcd.print(x,y,"messsage"); * where x is a symbol position(0 to 15) * y is a line number (0 or 1) * lcd.clear(); */ #define BLYNK_PRINT Serial #include <ESP8266WiFi.h> #include <BlynkSimpleEsp8266.h> #include <SimpleTimer.h> WidgetLCD lcd(V2); String data = ""; // this will be used to store the value of the variable resistor. the value will be converted into string as the lcd widget accept data in string format. int clflag = 0; // clear lcd flag. // You should get Auth Token in the Blynk App. // Go to the Project Settings (nut icon). char auth[] = "34e8cf4e86d94629a0e3f6ca4f3d0d5d"; // Your WiFi credentials. // Set password to "" for open networks. char ssid[] = "ZONG MBB-E8231-6E63"; char pass[] = "08659650"; SimpleTimer timer; // sensors int vr = A0; // variable resistor connected int sdata = 0; // sensor data will be stored in this variable. // This function sends Arduino's up time every second to Virtual Pin (1). // In the app, Widget's reading frequency should be set to PUSH. This means // that you define how often to send data to Blynk App. void myTimerEvent() { // You can send any value at any time. // Please don't send more that 10 values per second. Blynk.virtualWrite(V1, millis() / 1000); } |
Unlike Arduino and Mega, Nodemcu also has at least two functions, which are the void setup and void loop functions. Void means that this function is not returning any value and the empty parenthesis means that these functions are not taking any arguments as the input.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
void setup() { // Debug console Serial.begin(9600); pinMode(vr ,INPUT); Blynk.begin(auth, ssid, pass); // Setup a function to be called every second timer.setInterval(1000L,sensorvalue); } void loop() { Blynk.run(); timer.run(); // Initiates BlynkTimer } void sensorvalue() { sdata = analogRead(vr); data = data + sdata; //Serial.println(data); // You can send any value at any time. // Please don't send more that 10 values per second. // Blynk.virtualWrite(V2, sdata); if ( (sdata > 999)&& (clflag == 0)) { lcd.clear(); lcd.print(0,0,"VResistor:"); lcd.print(11,0,data); lcd.print(0,1,"ElectroniClinic"); clflag = 1; } if ( (sdata < 1000)&& (clflag == 1)) { lcd.clear(); lcd.print(0,0,"VResistor:"); lcd.print(11,0,data); lcd.print(0,1,"ElectroniClinic"); clflag = 0; } lcd.print(11,0,data); data = ""; } |
Watch Video Tutorial: