In compliance with high industry standards

Browse our Blog. You will find multiple applications, solutions, code examples. Navigate using the tag cloud or search using specific criteria

1.28" LCD Display Module & Raspberry Tutorial

Raspberry Applications

Odoo image and text block

Introduction


1.28" round LCD display module from WaveShare is a module with an embedded GC9A01 driver, 65K RGB colors, 240x240 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 blog we are going to display sample pictures in out 1.28"round LCD Display Module.

RELATED LINKS 

 


How to connect 
Raspberry PLC to Wi-Fi

Read >>

 

Basics about Raspberry Pi
analog outputs

Read >>


How to find your
perfect industrial PLC

Read >>

How to program Raspberry PLC 
interrupt inputs with Python

Read >>

Raspberry PLC
family products

Read >>

TouchBerry Pi
family products

Read >>

 REQUIREMENTS

- Raspberry Pi

- 1.28inch LCD module from WaveShare 

- Either HDMI cable or Ethernet cable to connect to your Raspberry Pi


 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.

Odoo image and text block

Steps

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

Odoo image and text block

Enable SPI interface

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


Run the following command to enter the configuration page

sudo raspi-config


Enable the SPI interface. Go to:

Interfacing Options > SPI > Yes, 


Reboot your Raspberry Pi:

sudo reboot


Install libraries

 Connect your Raspberry Pi to the WIFi network and download BCM2835 libraries.

wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.68.tar.gz


Extract the files.

tar zxvf bcm2835-1.68.tar.gz 

Change to the bcm2835-1.68 directory.

cd bcm2835-1.68/


Run the configure script and compile.

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

Install wiringPi 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


Install Python libraries. Install the one that fits with your Raspberry version.

#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
#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


Run the following commands to install p7zip-full package

sudo apt-get install p7zip-full 


Download the demo codes

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


Extract the files

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


Change to RaspberryPi directory

cd LCD_Module_code/RaspberryPi/


C codes

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

cd 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

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 have Python 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! 



Looking for your ideal PLC?

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

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


Industrial PLC controller comparison >>

Do you want more information?

Just fill the form!

Tell me more!