Close Menu
  • Articles
    • Learn Electronics
    • Product Review
    • Tech Articles
  • Electronics Circuits
    • 555 Timer Projects
    • Op-Amp Circuits
    • Power Electronics
  • Microcontrollers
    • Arduino Projects
    • STM32 Projects
    • AMB82-Mini IoT AI Camera
    • BLE Projects
  • IoT Projects
    • ESP8266 Projects
    • ESP32 Projects
    • ESP32 MicroPython
    • ESP32-CAM Projects
    • LoRa/LoRaWAN Projects
  • Raspberry Pi
    • Raspberry Pi Projects
    • Raspberry Pi Pico Projects
    • Raspberry Pi Pico W Projects
  • Electronics Calculator
Facebook X (Twitter) Instagram
  • About Us
  • Disclaimer
  • Privacy Policy
  • Contact Us
  • Advertise With Us
Facebook X (Twitter) Instagram Pinterest YouTube LinkedIn
How To Electronics
  • Articles
    • Learn Electronics
    • Product Review
    • Tech Articles
  • Electronics Circuits
    • 555 Timer Projects
    • Op-Amp Circuits
    • Power Electronics
  • Microcontrollers
    • Arduino Projects
    • STM32 Projects
    • AMB82-Mini IoT AI Camera
    • BLE Projects
  • IoT Projects
    • ESP8266 Projects
    • ESP32 Projects
    • ESP32 MicroPython
    • ESP32-CAM Projects
    • LoRa/LoRaWAN Projects
  • Raspberry Pi
    • Raspberry Pi Projects
    • Raspberry Pi Pico Projects
    • Raspberry Pi Pico W Projects
  • Electronics Calculator
How To Electronics
Home » Interfacing 16X2 LCD Display with STM32 Bluepill Microcontroller
STM32 Projects

Interfacing 16X2 LCD Display with STM32 Bluepill Microcontroller

Mamtaz AlamBy Mamtaz AlamUpdated:August 22, 20221 Comment4 Mins Read
Share Facebook Twitter LinkedIn Telegram Reddit WhatsApp
Interfacing 16X2 LCD Display with STM32 Bluepill Microcontroller
Share
Facebook Twitter LinkedIn Pinterest Email Reddit Telegram WhatsApp

Interfacing 16X2 LCD Display with STM32 Bluepill Microcontroller

In this post we will learn about connecting LCD Display to STM32f103c8t6 microcontroller, i.e we will be Interfacing 16X2 LCD Display with STM32 Bluepill Microcontroller. The LCD display is an important component while interfacing any sensors and displaying the output value. The 16X2 Alphanumeric display is the most popular display in Embedded Electronics System.

Here we will be programming STM32 via Arduino IDE and uploading the code to STM32 via the bootloader method. You can also upload code using STLink Debugger or USB-TTL Converter. Before starting the LCD & STM32 interfacing you can go through our previous post:
1. Getting Started with STM32 Microcontroller : Blinking of LED
2. STM32 Bootloader: Programming STM32F103C8 Board using USB Port


Components Required

  1. STM32 Blue Pill Development Board
  2. 16×2 LCD display
  3. 10K Potentiometer
  4. Connecting Wires



C16X2 LCD Display

LCD (Liquid Crystal Display) screen is an electronic display module and finds a wide range of applications. A 16×2 LCD display is a very basic module and is very commonly used in various devices and circuits. A 16×2 LCD means it can display 16 characters per line and there are 2 such lines. In this LCD each character is displayed in 5×7 pixel matrix. This LCD has two registers, namely, Command and Data.

16x2 LCD Display

The command register stores the command instructions given to the LCD. A command is an instruction given to LCD to do a predefined task like initializing it, clearing its screen, setting the cursor position, controlling display etc. The data register stores the data to be displayed on the LCD. The data is the ASCII value of the character to be displayed on the LCD.

 Pin No
 Function
 Name
1
Ground (0V)
Ground
2
Supply voltage; 5V (4.7V – 5.3V)
 Vcc
3
Contrast adjustment; through a variable resistor
 VEE
4
Selects command register when low; and data register when high
Register Select
5
Low to write to the register; High to read from the register
Read/write
6
Sends data to data pins when a high to low pulse is given
Enable
7
8-bit data pins
DB0
8
DB1
9
DB2
10
DB3
11
DB4
12
DB5
13
DB6
14
DB7
15
Backlight VCC (5V)
Led+
16
Backlight Ground (0V)
Led-

Circuit Diagram & Connection

The circuit diagram for interfacing 16X2 LCD Display with STM32 Development Board is given below. Make an exact same connection like this.

Circuit Diagram Connection 16X2 LCD and STM32

Supply 5V to LCD pins 2,15 from 5V pin of STM32
Connect pin 1,5,16 of LCD to GND of STM32
Connect pin 3 of LCD to 10K Pot as shown in above circuit.
Connect pin 4 (RS) of LCD to PB11 of STM32
Connect pin 6 (EN) of LCD to PB10 of STM32
Connect pin 11 (DB4) of LCD to PA4 of STM32
Connect pin 12 (DB5) of LCD to PA3 of STM32
Connect pin 13 (DB6) of LCD to PA2 of STM32
Connect pin 14 (DB7) of LCD to PA1 of STM32




Programming STM32 with LCD using Arduino IDE

There are 6 methods by which you can program STM32 Microcontroller. The methods are:
1. STM32duino Bootloader Method
2. Serial Method
3. By using ST-Link Debugger
4. By BMP (Black Magic Pro)
5. Jlink Method
6. By HID bootloader 2.0

I have used the first method i.e STM32duino bootloader method. By this method, you can directly upload code to STM32 via usb port. But before that, you need to install the bootloader in STM32. To learn more about this method check here: STM32 Bootloader: Programming STM32F103C8 Board using USB Port

You can also use the Serial Method to program STM32 Microcontroller. For this, you need a USB to TTL Converter like FTDI Module to program STM32. Check more about this method here: Getting Started with STM32 Microcontroller : Blinking of LED



Source Code/Program

Here is a code/program for interfacing 16×2 LCD with the STM32 development board. Copy this code to Arduino IDE and upload it by any method mentioned above.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <LiquidCrystal.h> // include the LCD library
 
const int rs = PB11, en = PB10, d4 = PA4, d5 = PA3, d6 = PA2, d7 = PA1; //STM32 Pins to which LCD is connected
LiquidCrystal lcd(rs, en, d4, d5, d6, d7); //Initialize the LCD
 
void setup() {
lcd.begin(16, 2);//Defining 16*2 LCD
lcd.setCursor(0, 0); //LCD Row 0 and Column 0
lcd.print("Interfacing LCD"); //Print this Line
lcd.setCursor(0, 1); //LCD Row 0 and Column 1
lcd.print("with STM32 Board"); //Print this Line
 
delay(4000); //wait for four secounds
lcd.clear(); //Clear the screen
}
 
void loop() {
 
lcd.setCursor(0, 0); //LCD Row 0 and Column 0
lcd.print(" STM32 with LCD "); //Print This Line
lcd.setCursor(0, 1); //LCD Row 0 and Column 1
lcd.print(millis() / 1000); //Print the value of secounds
}


Video Tutorial

STM32 & 16x2 LCD Interfacing Tutorial
Watch this video on YouTube.

Share. Facebook Twitter Pinterest LinkedIn Tumblr Email Reddit Telegram WhatsApp
Previous ArticleECG Graph Monitoring with AD8232 ECG Sensor & Arduino
Next Article Arduino Tilt Angle & Distance Meter with ADXL335 & HC-SR04

Related Posts

PIR Motion Detection using Bluetooth & STM32 Board

PIR Motion Detection using Bluetooth & STM32 Board

Updated:December 23, 20234K
STM32 SHT85 Humidity Temperature Sensor

Collecting SHT85 Sensor Data using STM32 & Bluetooth Low Energy

Updated:August 20, 20222K
SX1276 STM32

Interfacing LoRa SX1276 with STM32 Microcontroller | LR1276-915MHz

Updated:May 29, 2023112K
BLE enabled Smart Bulb with STM32 & Javascript

BLE enabled Smart Bulb with STM32 & Javascript

Updated:August 20, 20222K
Create BLE Project using STM32 Microcontroller & BlueIO

Create BLE Project using STM32 Microcontroller & BlueIO

Updated:August 20, 202212K
DS18B20 STM32

Interfacing DS18B20 Temperature Sensor with STM32

Updated:August 21, 2022110K
View 1 Comment

1 Comment

  1. sravya on December 2, 2019 6:13 PM

    What is the difference between Arduino and micro controller, I interfaced Arduino to LCD only 4 data lines, rs, enable but 8051 micro controller I connected all the data lines to 8051 port what is the difference b/w both controllers ??

    Reply

CommentsCancel reply

Latest Posts
IoT Based PM & Air Quality Monitoring System using ESP32

IoT Based PM & Air Quality Monitoring System using ESP32

May 31, 2026
DIY ESP32 MLX90640 IR Thermal Camera with Live Web Display

DIY ESP32 MLX90640 IR Thermal Camera with Live Web Display

May 10, 2026
IoT Activity Tracker with ESP32 & Accelerometer Gyroscope

IoT Activity Tracker with ESP32 & Accelerometer/Gyroscope

May 2, 2026
A Guide to Sourcing Obsolete ICs for Vintage Projects

Beyond AliExpress: A Guide to Sourcing Obsolete ICs for Vintage Projects

April 21, 2026

ESP32 IoT Vehicle Motion Analyzer with MPU6050 & LIS3MDL

April 27, 2026
Building a Smart Sensor Node with a BLE Microcontroller

Building a Smart Sensor Node with a BLE Microcontroller

February 26, 2026
High-Accuracy Pitch, Roll, Yaw with ESP32 & BNO08x IMU

High-Accuracy Pitch, Roll, Yaw with ESP32 & BNO08x IMU

April 27, 2026
DIY Colorimeter using AS7265x Spectroscopy Sensor & ESP32

DIY Colorimeter using AS7265x Spectroscopy Sensor & ESP32

February 1, 2026
Top Posts & Pages
  • IoT Based PM & Air Quality Monitoring System using ESP32
    IoT Based PM & Air Quality Monitoring System using ESP32
  • IoT AC Energy Meter with PZEM-004T & ESP32 WebServer
    IoT AC Energy Meter with PZEM-004T & ESP32 WebServer
  • 12V DC to 220V AC Inverter Circuit & PCB
    12V DC to 220V AC Inverter Circuit & PCB
  • Buck Converter: Basics, Working, Design & Application
    Buck Converter: Basics, Working, Design & Application
  • How to use INA219 DC Current Sensor Module with Arduino
    How to use INA219 DC Current Sensor Module with Arduino
  • IoT Based ECG Monitoring with AD8232 ECG Sensor & ESP32
    IoT Based ECG Monitoring with AD8232 ECG Sensor & ESP32
  • How to use INA226 DC Current Sensor with Arduino
    How to use INA226 DC Current Sensor with Arduino
  • ECG Graph Monitoring with AD8232 ECG Sensor & Arduino
    ECG Graph Monitoring with AD8232 ECG Sensor & Arduino
Categories
  • Arduino Projects (197)
  • Articles (60)
    • Learn Electronics (19)
    • Product Review (15)
    • Tech Articles (28)
  • Electronics Circuits (46)
    • 555 Timer Projects (21)
    • Op-Amp Circuits (7)
    • Power Electronics (13)
  • IoT Projects (204)
    • ESP32 MicroPython (7)
    • ESP32 Projects (81)
    • ESP32-CAM Projects (15)
    • ESP8266 Projects (76)
    • LoRa/LoRaWAN Projects (22)
  • Microcontrollers (38)
    • AMB82-Mini IoT AI Camera (4)
    • BLE Projects (18)
    • STM32 Projects (19)
  • Raspberry Pi (93)
    • Raspberry Pi Pico Projects (57)
    • Raspberry Pi Pico W Projects (12)
    • Raspberry Pi Projects (24)
Follow Us
  • Facebook
  • Twitter
  • Pinterest
  • Instagram
  • YouTube
About Us

“‘How to Electronics’ is a vibrant community for electronics enthusiasts and professionals. We deliver latest insights in areas such as Embedded Systems, Power Electronics, AI, IoT, and Robotics. Our goal is to stimulate innovation and provide practical solutions for students, organizations, and industries. Join us to transform learning into a joyful journey of discovery and innovation.

Copyright © How To Electronics. All rights reserved.
  • About Us
  • Disclaimer
  • Privacy Policy
  • Contact Us
  • Advertise With Us

Type above and press Enter to search. Press Esc to cancel.

Ad Blocker Enabled!
Ad Blocker Enabled!
Looks like you're using an ad blocker. Please allow ads on our site. We rely on advertising to help fund our site.