Interfacing STM32 Blue Pill with 1602 LCD

One of the simplest microcontroller projects is the interfacing with 1602 LCD screen, it of course can help showing data stored inside the microcontroller such as texts & numbers and also may be used for some debugging purposes. The LCD simply acts like a Human-Machine Interface device (HMI).
This post shows how to interface STMicroelectronics MCU STM32F103C8T6 Blue Pill development board with 1602 LCD where Arduino IDE is used to write the interfacing program. We will also see the simulation of the STM32F103C8T6 Blue Pill board with 16×2 LCD using Proteus simulation software.

Interfacing STM32F103C8T6 Blue Pill development board with 16x2 LCD hardware circuit

The 16×2 LCD is a very popular and simple display device, it contains a the HITACHI HD44780U Dot Matrix Liquid Crystal Display Controller/Driver (or compliant controller). Interfacing this display with a microcontroller requires at least 6 data pins. The number 1602 or 16×2 means the display module has 16 columns and 2 rows, this means a total of 32 character can be displayed at once.

Interfacing STM32F103C8T6 Blue Pill board with 16×2 LCD circuit:
Project circuit diagram is shown below.

Interfacing STM32F103C8T6 Blue Pill development board with 1602 LCD

 

Hardware required:
This is a summary of circuit required parts (circuit schematic diagram may contain some component parameters not mentioned below).

Circuit description:
Our 16×2 LCD example circuit is extremely simple as few components and connections are required between the STM32F103C8T6 Blue Pill board and the display module.
The main power source of the circuit comes from the micro USB port of the STM32 Blue Pill board with voltage of 5V. The board contains a voltage regulator that feeds the STM32F103C8T6 microcontroller with 3.3V. The 16×2 LCD module is powered with 5V from the STM32 Blue Pill board where its ‘VDD’ pin is connected to ‘5V’ pin of the board.

Other 1602 LCD pins are connected to the STM32 Blue Pill board as follows:
RS —> pin PA0
E   —> pin PA1
D4 —> pin PA2
D5 —> pin PA3
D6 —> pin PA4
D7 —> pin PA5
VSS, RW, D0, D1, D2, D3 and K are connected to circuit ground
VEE to the variable resistor (or potentiometer) output
VDD and A to +5V (from the board).
VEE pin is used to control the contrast of the LCD. A (anode) and K (cathode) are the back light LED pins.

Interfacing STM32F103C8T6 Blue Pill board with 16×2 LCD Arduino code:
Arduino IDE is used to write project code, the STM32 Blue Pill board has to be added to the IDE before compilation.
The STM32 Blue Pill board can be installed using Arduino IDE Boards Manager.

The FT232RL USB to serial UART converter is used to program the STM32F103C8T6 microcontroller, the ST-LINK V2 programmer also can be used and it is supported by the Arduino IDE.

The STM32 Blue Pill board package comes with a nice LCD library that supports different LCD connections including the 4-bit and 8-bit operating modes and the ‘RW’ pin connection.
In this example 4-bit mode with ‘RW’ pin connected to ground is used.

The LCD library is included in the Arduino code as shown below:

The connections between the STM32 Blue Pill board and the 16×2 LCD is as shown in the above circuit schematic, it is defined in the Arduino code as shown below:

Rest of code is described through comments.

The following video shows my simple DIY circuit:

Proteus Simulation:
The interfacing of ST32F103C8T6 Blue Pill with 1602 LCD project can be simulated using Proteus simulation software as shown in the video below:

Proteus simulation file download:
Interfacing STM32F103C8T6 Blue Pill with 16×2 LCD Proteus simulation file download link is below, use Proteus version 8.15 or higher in order to be able to open it.
Download

And the link below is Proteus library for the STM32F103C8T6 Blue Pill board. After the download put the file in Proteus library folder, for example in my case Proteus library folder path is: C:\ProgramData\Labcenter Electronics\Proteus 8 Professional\Library
Proteus library for the STM32F103C8T6 Blue Pill board


Discover more from Simple Circuit

Subscribe to get the latest posts sent to your email.

Leave a Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top