Your shopping cart is empty!

Displaying Telegram Message on 3.3V Serial LCD using NodeMCU ESP8266
With the availability of an LCD library for Arduino, now we are able to display text on 3.3V Serial LCD using Arduino. Let's go!
Introduction
Cytron Technologies just release the Arduino library for the 3.3V SErial LCD. This library has also been tested with most of the Arduino-based microcontrollers such as Arduino Uno, Maker Uno, NodeMCU ESP8266, Arduino Nano, and Arduino Mega for both communication protocol I2C and SPI.
NOTE: The library is provided as it is and is built with fundamental functions. You are encouraged to improve the code for your application purposed.
With this IoT (Internet of Things) hype this day, I would like to do some IoT applications with the LCD. So in this tutorial, we will display the Telegram message on 3.3V LCD for both communication protocols using NodeMCU ESP8266. Let's go!
Hardware
Setup
NodeMCU ESP8266 Setup
If you are new to NodeMCU ESP8266, you might need this step to help you. But if you confirmed that your Arduino IDE already has an ESP8266 library, you can skip this step.
- To install the ESP8266 board in your Arduino IDE, first, you need to goto File > Preferences

- Enter http://arduino.esp8266.com/stable/package_esp8266com_index.json into the “Additional Boards Manager URLs” field as shown in the picture below. Then, click the “OK” button:

- Open the Boards Manager. Go to Tools > Board > Boards Manager…

- Search for ESP8266 and press install button for the “ESP8266 by ESP8266 Community“:

- That’s it. It should be installed after a few seconds.

You also can refer to this Getting Started with ESP8266 to know more about NodeMCU ESP8266.
LCM1602-14 3.3V LCD Library Setup
STEP 1: To program the display, we need the library or the “driver” of this LCD. You can get the library for Arduino at this GitHub LCM1602-14_LCD_Library_Arduino created by Cytron Trainee. This library is compatible with all Arduino programmable based. Click the link given, the view will look like this :

STEP 2: Download the library file (Arduino_LCD-I2C_Library and Arduino_LCD-SPI_Library) by clicking the ‘code’ green button and click download ZIP. The following picture visualized the step :

STEP 3: Put the downloaded files in Arduino library folder separately [Documents > Arduino > libraries].
STEP 4: Check both files if they already got into the libraries by opening the Arduino IDE then got to sketch [Arduino IDE > sketch > Include Library].

NOTE: If the libraries are there, then you are ready to use them but if the libraries do not appear, you need to restart Arduino IDE by closing the IDE and open back.
CT Bot library for Telegram Setup
STEP 1: To use the Telegram bot for the microcontroller to communicate, we need the library. There are various libraries that available, but in this tutorial, I used the CT Bot library. First, we need to install the CT Bot library and Arduino JSON library by going to 'manage libraries'. Arduino JSON primarily used for serializing and transmitting structured data over a network connection – transmit data between a server and a client. It is often used in services like APIs (Application Programming Interfaces) and web services that provide public data.
[Sketch > Include library > Manage libraries]

STEP 2: Search for CT Bot and Arduino JSON libraries. Then, click the install.


Wiring
LCD Display with I2C Serial Communication Protocol
The view of actual setup :
LCD Display with SPI Serial Communication Protocol
The actual view of the setup :
Sample Code
Below show the sample codes that been used in this tutorial. 1st code (top) is for I2C protocol communication and the 2nd code (bottom) is for SPI protocol communication. Please replace your Telegram Bot token, WiFi SSID and password.
For I2C protocol :
https://gist.github.com/CytronTrainee/4e051a07599c3d74b12181412f3e6974
For SPI protocol :
https://gist.github.com/CytronTrainee/e73a473bb7805c7e0a2ee81b631c28e1
Procedure
Before you execute the code in NodeMCU, first you need to create Telegram Bot. So, in this section, you will learn on how to create a Telegram Bot and execute the program in NodeMCU.
Create the Telegram Bot
STEP 1: Open Telegram apps and search for @BotFather or click this link t.me/botfather.

STEP 2: Create a new Telegram bot using the Bot Father.

STEP 3: To create a new Telegram Bot, send command
/newbot
.

STEP 4: Give the Telegram Bot a friendly name.

STEP 5: Give the Telegram Bot a unique name.

STEP 6: The red highlight is the link that brings you to your bot. You need to click the link in order for you to use the bot. The blue highlight is the Telegram Bot's access token which you need to copy and insert the token in the code.

STEP 7: Now open your bot via the link. Congratulations! you did created your own bot.

Program Execution
STEP 1: Copy and paste the sample code above into the Arduino IDE.

STEP 2: Insert your SSID, WiFi password and Telegram Bot token. SSID is your Wifi name while the Telegram Bot token you can get from the Bot Father. The blue highlight is the token needed.


STEP 3: Go to [Tools > Board > ESP8266 Boards (2.7.4) > NodeMCU 1.0 (ESP12-E Module)] and also make sure the port chosen is correct.


STEP 4: Upload the program

STEP 5: Go to Telegram, then open the bot. Do testing by typing
/start
in your bot. If Bot respond, means the communication is succeed.

STEP 6: Congratulations! we did it. For SPI the step also same as well. You can type anything through Telegram Bot and the LCD will displayed. Let's give a shot!

Thank You
References :
Thanks for reading this tutorial. If you have any technical inquiry, please post at Cytron Technical Forum.