GC9A01 Round LCD wi...
 
Notifications
Clear all

GC9A01 Round LCD with ESP32 & Arduino

34 Posts
9 Users
4 Likes
6,152 Views
(@dronebot-workshop)
Workshop Guru Admin
Joined: 5 years ago
Posts: 1053
Topic starter  

Learn to use the GC9A01 circular LCD module with an Arduino Uno and an ESP32.

Article with code: https://dronebotworkshop.com/gc9a01

We have worked with LCD modules many times before here in the DroneBot Workshop, but this one is a bit different - it’s round!

Round LCD modules like this one are excellent choices for instrumentation and metering projects. They can also be used for special effects in robotics and animatronics, as we will see when we use two of the displays to build some animated eyeballs.

We will start, of course, by looking at the specifications of this display. It is an SPI bus device, and the Waveshare model I’m using can operate on both 5-volts and 3.3-volts. Note that there is another model of this display, also using the GC9A01 driver, that only operates on 3.3-volts (and also has some very confusing pin markings).

Next, we will use the display with an Arduino Uno. We will start by using the Waveshare sample code, but after that, we will switch to another library that is much better documented.

After that, we will use the display with an ESP32, which has better performance than the Arduino Uno as it’s much faster and has more internal memory.

Finally, we will build a set of animated eyeballs using the ESP32 and two of the GC9A01 modules.

Lot’s to learn, and there is even a bonus “riddle” in the video for science fiction fans - of course, I give you the answer in the end!

Here is the Table of Contents for today's video:

00:00 - Introduction
01:13 - GC9A01 IPS Display
05:11 - GC9A01 with Arduino
18:12 - GC9A01 with ESP32
33:12 - GC9A01 Animated Eyes
43:08 - Conclusion

Hope you enjoy it, and I really hope you pick up a few of these displays and build something cool with them!

And, for those of you who solved the “riddle”, congratulations - and for the rest of you, DON’T PANIC! (that was a clue, BTW).

"Never trust a computer you can’t throw out a window." — Steve Wozniak


   
Quote
(@airborne2)
Member
Joined: 5 years ago
Posts: 1
 

Can anyone please help me with this problem as I have experienced it in other instances.

Bill and other Forum Members... as usual I have watched the video about using the Waveshare Round GC9A01 1.28" display. When I( got to the part where I downloaded the Adafruit "Graphics Test",.... loaded the sketch into my IDE and then tried to compile it, the IDE came up with the following error:

 

Arduino: 1.8.19 (Windows Store 1.8.57.0) (Windows 10), Board: "Adafruit Metro M0 Express, Small (-Os) (standard), Arduino, Off"

 

sketch_jun26a:3:10: fatal error: Adafruit_GC9A01A.h: No such file or directory

Multiple libraries were found for "Adafruit_ZeroDMA.h" 3 | #include "Adafruit_GC9A01A.h" Used: C:\Users\Brian\Documents\ArduinoData\packages\adafruit\hardware\samd\1.7.1\libraries\Adafruit_ZeroDMA | ^~~~~~~~~~~~~~~~~~~~ Not used: C:\Users\Brian\Documents\Arduino\libraries\Adafruit_Zero_DMA_Library compilation terminated. Multiple libraries were found for "Adafruit_GFX.h" Used: C:\Users\Brian\Documents\Arduino\libraries\Adafruit_GFX_Library Not used: C:\Users\Brian\Documents\Arduino\libraries\Adafruit-GFX-Library-master exit status 1 Adafruit_GC9A01A.h: No such file or directory This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.

Basically it says that there is no such file as the "Adafruit GC9A01.h" file. But having checked the Arduino/Adafruit_GC9A01A-master file which contains the examples and library files for the graphics test it is plain to see the so-called missing Adafruit GC9A01.h file. Any thoughts on what might be happening for the sketch to not recognise the ".h" file and/or what I can do about it

I have tried reloading the Adafruit coding and also rewritten the file name in both the support library and the lines in the sketch

 

 

#include "SPI.h"

#include "Adafruit_GFX.h" #include "Adafruit_GC9A01A.h"

in case there might be a spelling or punctuation error

Any help gratefully received

Airborne2

 


   
ReplyQuote
(@habanero-gh)
Member
Joined: 2 years ago
Posts: 16
 

Hi @airborne2,

The arduino ide is not my main tool but I've been messing with the round displays. I can duplicate your error by moving the Adafruit_GC9A01A-master folder.

Is this the exact path to your library : 'Arduino/Adafruit_GC9A01A-master' ?

If it is, can you try moving it so it is under the libraries folder

Arduino\libraries\Adafruit_GC9A01A-master

 

my library is here

C:\Users\$USER\Document\Arduino\libraries\Adafruit_GC9A01A-master

my sketch is located parallel to the libraries folder

C:\Users\$USER\Documents\Arduino\graphicstest

This post was modified 2 years ago by habanero-gh

   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6662
 

@airborne2 It sounds like you have not installed the library.

First undo any changes you did to 'fix' the problem.

Do NOT manually move it.

I assume it is a zip you downloaded, so the IDE command to install it is (with the sketch loaded so that the includes also get set up) Sketch -> Include Library -> Add .ZIP library... now just navigate to the zip file and click it.

Everything should then work. 

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
(@habanero-gh)
Member
Joined: 2 years ago
Posts: 16
 

@airborne2

From your errors I assumed you tried to install it and it failed.

But if you did not install it originally then by all means you can start with installing it.

Moving libs around isn't rocket science, but see this page for a step by step of the cookie cutter install process.

https://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use/how-to-install-a-library

 


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6662
 

@airborne2 I just downloaded the library from github, then did the install per below. Then loaded the example sketch and compiled it clean.

I noticed you said

Can anyone please help me with this problem as I have experienced it in other instances.

That sounds like you are not using the standard library install procedure. I have seen several new members have this problem and make a mess of their environment. The IDE makes it safe and fool proof, yes it can be done manually, but isn't it strange that the only folks who come here seeking help with this kind of issue all did not follow the builtin methods, coincidence?

 

Screen Shot 2022 07 04 at 14.11.29

 

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
(@habanero-gh)
Member
Joined: 2 years ago
Posts: 16
 

If it is a repetitive install problem understanding why will be helpful.

Sticking with the cookie cutter recipes is great at first. Get that to work, then try this.

The IDE looks in known locations for libraries when the IDE fires up.  One of those places is what I mentioned above originally , in windows commonly it's

C:\Users\<user>\Documents\Arduino\libraries.

Folders in that tree contain a library.properties file that describes the library to the IDE. The folders that contain an examples directory will be included in the examples menu items.

When the IDE scans the library directory if everything is correctly structured you'll see it in the menus and you can reference and link to the library.

I hacked up a simple example from scratch. Zip file attached.

Down load the zip, unzip it anywhere, to prove the point only then move it to your Sketchbook library directory. C:\Users\<user>\Documents\Arduino\libraries.

Shutdown all copies of the IDE that are running. Now fire up the IDE.

Presto 'Habanero's Bad Poetry Library' is in your list of libraries, with an example.

No library zip manager, not too many shenanigans, just some arcane details.

 

The source is simple:

directory tree:

  • HabsLib
    • examples
      • example_1
        • example_1.ino
    • HabsLib.h
    • library.properties

example_1.ino:

#include "HabsLib.h"

HabsLib habslib;

void setup() {  Serial.begin(115200); }
int i=0;
void loop()
{
  String vogon = habslib.getline(i);
  Serial.println(vogon);
  if(i == 2) i = 0;
  else ++i;
  delay(1000);
}

HabsLib.h:

#pragma once
struct HabsLib
{
    HabsLib() { init(); }
~HabsLib() {}
  void init() {
    _1 = "To be or not to be";
    _2 = "For score and seven years";
    _3 = "Thy micturations are to me";
  }
  String getline(int i) {
    if(i == 0) return _1;
    else if(i == 1) return _2; 
    else if(i == 2) return _3;
    else return "Try again.";
  }
  String  _1,_2,_3;
};

library.properties:

name=Habanero's Bad Poetry Library
version=0.0.1
author=hab
maintainer=hab <info@nowhere.com>
sentence=Poetry library
paragraph=Simple library example
category=Sensors
url= https://github.com/nowhere/nowhere 
architectures=*
depends=SD

The Arduino IDE is great for it's intended user base. The procedures and processes the IDE goes through will have a corollary in any other IDE you might end up using.

Learning how they work removes some of the mystery in problems.

 


   
Inst-Tech reacted
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6662
 

@habanero-gh I have helped get many new users out of trouble they got into by NOT following the standard procedure. Offering an example that may work but does not follow the standard procedure is not helpful in my opinion. The IDE has it's own installer, it's just a menu and click away, why not use it. 

In case you are unaware, the standard procedure is download from github (most of the time) Sketch>Include library>Add .ZIP Library... and then click on the zip file in your download folder. Done.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
(@habanero-gh)
Member
Joined: 2 years ago
Posts: 16
 

remain calm.

I am aware of the process, read above:

"But if you did not install it originally then by all means you can start with installing it."
"Sticking with the cookie cutter recipes is great at first. Get that to work, then try this."

And also pointed to a trusted source, on how to do all this step by step the Adafruit way, also read above:

https://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use/how-to-install-a-library

Otherwise I don't share your opinion.


   
Inst-Tech reacted
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6662
 

@habanero-gh The problem is the old adafruit method doesn't always work. There is more to the installer than just populating folders. Not an opinion, a fact. Also, I know of a library that can only be manually installed and will not install via the standard installer. It requires the usual steps and a few more including renames and something else I can't remember.

I have helped quite a few folks with library problems, my advice is not without reason. In this case either way works, but is this particular user plus any other newbies watching going to know that sometimes it works the non-standard way and sometimes it doesn't and how to fix it when it fails.

The thousands of engineering hours invested by Arduino in the IDE were spent for a reason, it seems risky to me to not take advantage of their efforts.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
(@habanero-gh)
Member
Joined: 2 years ago
Posts: 16
 

You have opinions, repeating them does make em' fact.

If you have information to share, real data, not opinions, not anecdotes, I'm all ears.

You do know anyone can get the IDE source code, right?

Here are some facts from the source in Base.java:

    JMenuItem addLibraryMenuItem = new JMenuItem(tr("Add .ZIP Library..."));
    addLibraryMenuItem.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        Base.this.handleAddLibrary();
        BaseNoGui.librariesIndexer.rescanLibraries();
        Base.this.onBoardOrPortChange();
        Base.this.rebuildImportMenu(Editor.importMenu);
        Base.this.rebuildExamplesMenu(Editor.examplesMenu);
      }

This should look familiar

new JMenuItem(tr("Add .ZIP Library..."));

This lets you pick your file, it unzips it in a temp folder, verifies that the folder is structured in the expected way, and then moves it to your path, as in PreferencesData.get("sketchbook.path"))

Base.this.handleAddLibrary()

The name of this function says it all.

BaseNoGui.librariesIndexer.rescanLibraries(); 

This is the core task the menu item really does. This is how the IDE is resync to the file system and menu changes.

Base.this.onBoardOrPortChange();
Base.this.rebuildImportMenu(Editor.importMenu);
Base.this.rebuildExamplesMenu(Editor.examplesMenu);

I did not disrespect you or counter your advise and opinions. I expect the same respect.

My opinion is you do a disservice when you try to modulate accurate information sharing.


   
Inst-Tech reacted
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6662
 

@habanero-gh 

verifies that the folder is structured in the expected way

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
(@richardbr)
Member
Joined: 3 years ago
Posts: 7
 

Posted by: @dronebot-workshop

Learn to use the GC9A01 circular LCD module with an Arduino Uno and an ESP32.

Article with code: https://dronebotworkshop.com/gc9a01

We have worked with LCD modules many times before here in the DroneBot Workshop, but this one is a bit different - it’s round!

Round LCD modules like this one are excellent choices for instrumentation and metering projects. They can also be used for special effects in robotics and animatronics, as we will see when we use two of the displays to build some animated eyeballs.

We will start, of course, by looking at the specifications of this display. It is an SPI bus device, and the Waveshare model I’m using can operate on both 5-volts and 3.3-volts. Note that there is another model of this display, also using the GC9A01 driver, that only operates on 3.3-volts (and also has some very confusing pin markings).

Next, we will use the display with an Arduino Uno. We will start by using the Waveshare sample code, but after that, we will switch to another library that is much better documented.

After that, we will use the display with an ESP32, which has better performance than the Arduino Uno as it’s much faster and has more internal memory.

Finally, we will build a set of animated eyeballs using the ESP32 and two of the GC9A01 modules.

Lot’s to learn, and there is even a bonus “riddle” in the video for science fiction fans - of course, I give you the answer in the end!

Here is the Table of Contents for today's video:

00:00 - Introduction
01:13 - GC9A01 IPS Display
05:11 - GC9A01 with Arduino
18:12 - GC9A01 with ESP32
33:12 - GC9A01 Animated Eyes
43:08 - Conclusion

Hope you enjoy it, and I really hope you pick up a few of these displays and build something cool with them!

And, for those of you who solved the “riddle”, congratulations - and for the rest of you, DON’T PANIC! (that was a clue, BTW).

 


   
ReplyQuote
(@richardbr)
Member
Joined: 3 years ago
Posts: 7
 

I have the 1.28" TFT B style LCD Round display GC9A01. It has only 7 pins.  No BL pin.  I have found no specific instructions to get this to work.  Has anyone got this module to work.  Specific instructions would be nice.  I have tried it on Arduino nano and ESP32 using Bill's instructions.  


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6662
 

@richardbr The BL is just Backlight, nothing that will affect the normal operation. If you take very careful photos so all of us can determine if the wiring is correct and post the sketch you are trying to get to work we might have a chance to debug it. AFAIK the specific instructions are in Bill's video/blog, I just went to the blog and had a quick look, everything is there. Unfortunately that is one of the few LCD displays I do not have, too expensive. Show us your UNO wired up exactly like in the blog. Asw Bill points out there is excellent info and sample code at https://www.waveshare.com/wiki/1.28inch_LCD_Module

Good luck.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
Page 1 / 3