Clear Filters
Clear Filters

20x4 LCD Display with Raspberry Pi

8 views (last 30 days)
Niklas Rosenstock
Niklas Rosenstock on 25 Jun 2021
Commented: Niklas Rosenstock on 25 Jun 2021
Hello,
I try on displaying Text on a 20x4 LCD Screen through a Raspberry Pi 3b+. (My goal is writing a standalone program for the Raspberry)
I already have the Raspberry Toolboy for Matlab but I can't find any commands on how to display the Text.
Thanks in advance!

Answers (1)

Shantanu Thatte
Shantanu Thatte on 25 Jun 2021
Hi Niklas,
To interface with a 20x4 LCD with Rasperry Pi using MATLAB, you will have to first download and install the Raspberry Pi Support Package. Once that's done you will have to use either I2C or SPI bus to read/write data to your LCD. You will have to refer to the datasheet of your LCD to find which interface types your LCD supports.
If I assume that you have to use I2C to inteface with the LCD then you can use the write function to write to the I2C address. There is a more detailed example available on that page, but briefly:
% Assuming mypi is your raspberry pi
% Get instance of the conenction to I2C device at address 0x55
i2cdisplay = i2cdev(mypi,'i2c-1','0x55')
% Now write to the display
write(i2cdisplay,[hex2dec('20') hex2dec('51')])
% Or to write to a register (register 3 here)
writeRegister(i2cdisplay,3,hex2dec('08'),'uint8')
A list of all available supported functions are listed on this page.
  1 Comment
Niklas Rosenstock
Niklas Rosenstock on 25 Jun 2021
Thanks for you answer but since I use a simple 20x4 character display these functions don't work. I don't get any errors but accept from turning the LCD Backlight on and off, nothing is happening.

Sign in to comment.

Categories

Find more on Raspberry Pi Hardware in Help Center and File Exchange

Products


Release

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!