1.28" LCD Display Module & Raspberry Tutorial
Raspberry Pi Projects for industrial automation
21 June, 2021 by
1.28" LCD Display Module & Raspberry Tutorial
Boot & Work Corp. S.L., Fernandez Queralt Martinez

Introduction

1.28" round LCD display module from WaveShare is a module with an embedded GC9A01 driver, 65K RGB colors, 240×240 Resolution and using SPI bus and interface. Minimizes required IO pins, supports controller boards like Raspberry Pi/Jetson Nano/Arduino/STM32 and comes with development resources, like examples for Raspberry Pi, Arduino and STM32.

In this post, you are going to display sample pictures in your 1.28” round LCD Display Module for industrial control.

Outline Dimensions of 1.28"round LCD Display Module - 1.28" LCD Display Module & Raspberry Tutorial

Related Links

How to

Connect Raspberry PLC to Wi-Fi

Read 

Raspberry PLC

Family Products

See 

How to

Program Raspberry PLC interrupt inputs with Python

Read 

How to

Find your perfect industrial PLC

Read 

Touchberry Pi

Family products

See 

Basics about

Raspberry Pi Analog Outputs for industrial control

Read 

Requirements

Explanation

SPI

Serial Peripheral Interface (SPI) is an interface bus commonly used to send data between microcontrollers and small peripherals such as shift registers, sensor, and SD cards. It uses separate clock and data lines, along with a select line to choose the device you wish to talk to. In the picture below, you can see a single master and a single slave on a Serial Peripheral Interface (SPI) bus.

SPI Master Slave- Explanation - 1.28" LCD Display Module & Raspberry Tutorial

Steps

1. First of all, connect your Raspberry Pi and 1.28" LCD module as shown in the picture below.

Raspberry Pi and 1.28" LCD module - Explanation - 1.28" LCD Display Module & Raspberry Tutorial

Enable SPI interface

2. Then, power up your Raspberry Pi and connect through Ethernet or HDMI. In our case, we are going to connect through SSH:

ssh pi@10.10.10.20

3. Run the following command to enter the configuration page.

sudo raspi-config

4. Enable the SPI interface. Go to Interfacing Options > SPI > Yes.

5. Reboot your Raspberry Pi:

sudo reboot

Install Libraries

6. Connect your Raspberry Pi to the Wi-Fi network and download BCM2835 Libraries.
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.68.tar.gz

7. Extract the files.

tar zxvf bcm2835-1.68.tar.gz

8. Change to the bcm2835-1.68 directory.

cd bcm2835-1.68/
 

9. Run the configured script and compile.

sudo ./configure
sudo make
sudo make check
sudo make install

10. Install Wiring Pi Libraries.
sudo apt install wiringpi

For the version of the Raspberry Pi system after May 2019 an upgrade may be required.

wget https://project-downloads.drogon.net/wiringpi-latest.deb
sudo dpkg -i wiringpi-latest.deb
gpio -v

11. Install Python Libraries. Install the one that fits with your Raspberry Pi version.

Pyhton 2

#python2
sudo apt-get update
sudo apt-get install python-pip
sudo apt-get install python-pil
sudo apt-get install python-numpy
sudo pip install RPi.GPIO
sudo pip install spidev

Pyhton 3

#python3
sudo apt-get update
sudo apt-get install python3-pip
sudo apt-get install python3-pil
sudo apt-get install python3-numpy
sudo pip3 install RPi.GPIO
sudo pip3 install spidev

Download examples

12. Run the following commands to install p7zip-full package.

sudo apt-get install p7zip-full
 

13. Download the demo codes.

sudo wget https://www.waveshare.net/w/upload/a/a8/LCD_Module_RPI_code.7z 

14. Extract the files.

7z x LCD_Module_RPI_code.7z -O./LCD_Module_code

15. Change to Raspberry Pi Directory.

cd LCD_Module_code/RaspberryPi/

C codes

16. Go to the LCD_Module_code/RaspberryPi/c directory and re-compile the demo codes.

Excd c
sudo make clean
sudo make -j 8

Waveshare code examples are made for multi-display. So you can input the type of LCD when using. In our case, we are going to run the command according to our 1.28inch LCD module.

sudo ./main 1.28

Python codes

17. To run the Raspberry demo examples, go to the directory demo examples from Python:

cd LCD_Module_code/RaspberryPi/python/example

Likewise as with the C codes, these examples are made for multi-display, so you can also run the examples for different modules. In our case, if you havePython version 2, run the following:

sudo python 1inch28_LCD_test.py

In case of Python3, run the following command:

sudo python3 1inch28_LCD_test.py

If everything went fine, congratulations! You managed to get the sample application running! 



1.28" LCD Display Module & Raspberry Tutorial
Boot & Work Corp. S.L., Fernandez Queralt Martinez
21 June, 2021
Share this post
Archive

Looking for your ideal Programmable Logic Controller?

Take a look at this product comparison with other industrial controllers Arduino-based. 

We are comparing inputs, outputs, communications and other features with the ones of the relevant brands.


Industrial PLC comparison >>>

Do you want more information?

Just fill the form!

Tell me more!