Serial I2C LCD 1602 Module (HCARDU0023)

LCD, TFT, OLED, LED modules
andrew
Site Admin
Posts: 1374
Joined: Sun Aug 05, 2012 4:15 pm

Re: Serial I2C LCD 1602 Module (HCARDU0023)

Post by andrew » Mon Nov 15, 2021 1:24 pm

Is J3 on the schematic the pin header with the link attached ?
Yes that's correct. Removing the jumper will break the power (VCC) supply to the backlight.

Can you also advise a part number for the 4 core lead that is shown in the photo's ?
It's the following 4 way anti-reverse cable:

https://hobbycomponents.com/cables/68-4 ... cable-30cm


If you don't need it to be anti-reverse there are the following alternatives which can be stripped into 4 way pieces:

https://hobbycomponents.com/cables/648- ... cable-10cm

https://hobbycomponents.com/cables/114- ... cable-pack
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

RMurphy195
Posts: 8
Joined: Fri Oct 21, 2022 3:16 pm

Re: Serial I2C LCD 1602 Module (HCARDU0023)

Post by RMurphy195 » Fri Oct 21, 2022 6:13 pm

Having struggled a little getting this to work e.g. code bugs such as the line lcd.begin();, which gave the IDE indigestion until I found it should be lcd.begin(16,2);, and finding, using I2C Scanner that the address is 0x27, not 0x3F (mine has the 3 pads on the back), plus a few other bugs I can now move forward -

However - I can't seem to find a function refernce for the library, ideally in summary form. Is it essentially the same as this https://www.arduino.cc/reference/en/lib ... idcrystal/?

And - if there's an easier way to get the info rather than following the arduino pages one-by-one to cut and paste the info into a document, I'd be very happy!

Thanks - Richard

andrew
Site Admin
Posts: 1374
Joined: Sun Aug 05, 2012 4:15 pm

Re: Serial I2C LCD 1602 Module (HCARDU0023)

Post by andrew » Sat Oct 22, 2022 10:59 am

Having struggled a little getting this to work e.g. code bugs such as the line lcd.begin();, which gave the IDE indigestion until I found it should be lcd.begin(16,2);
Odd, I guess you must be using a version of the library from a different source. The version in the first post requires you to specify the screen size when you first create an instance of the library, not in the begin() function.

and finding, using I2C Scanner that the address is 0x27, not 0x3F
Yes that's correct, these screens come with the default address of 0x27 or 0x3F (see note in first post of this thread) depending on the version of backpack fitted.


However - I can't seem to find a function refernce for the library, ideally in summary form. Is it essentially the same as this https://www.arduino.cc/reference/en/lib ... idcrystal/?
That's correct again, the I2C version of the liquidcrystal library is derived from the standard parallel version so your best option is referencing that. Unfortunately I don't know of any better source for documentation.

If you want to get an idea of which commands the library supports you can also take a look at the LiquidCrystal_I2C.h library file which lists all the function prototypes it supports.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

RMurphy195
Posts: 8
Joined: Fri Oct 21, 2022 3:16 pm

Re: Serial I2C LCD 1602 Module (HCARDU0023)

Post by RMurphy195 » Sat Oct 22, 2022 4:16 pm

Hi Andrew, thanks for the prompt reply. Cut and paste it is then oh well ...

All working very well now thanks, and very pleased with it.

PS - Somehow my libraries got mixed up - I had one called "HCARDU0023_LiquidCrystal_I2C_V2_1" from somewhere, now done some juggling and the line "lcd.begin();" now works without the arguments. A bit of a learning curve on Arduino libraries I think ...

Adrian_ffoil
Posts: 3
Joined: Tue Dec 26, 2023 5:04 pm

Re: Serial I2C LCD 1602 Module (HCARDU0023)

Post by Adrian_ffoil » Tue Dec 26, 2023 5:17 pm

I'm having problems getting my display to work.

I'm using a Nano, and I've uploaded the following code :

Code: Select all

#include <Wire.h>
 #include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x3F, 16, 2);
 void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);

lcd.begin(16,2);   // initialize the lcd for 16 chars 2 lines, turn on backlight

setscreen();

}

void loop() {
  // put your main code here, to run repeatedly:
  Serial.println ("starting");
  lcd.setCursor(0,0);
  lcd.print("hello world");
  delay (6000);
  Serial.println("Finished");

}
Using the IDE's console, I can see that the messages sent using Serial are being sent, so I'm confident that the Nano is running, but all I see on the screen are the 16 white squares on the first row.

So far as I can tell, I've got it the SDA / SCL lines connected to the right pins, and I've downloaded (via the IDE) the only LiquidCrystal_I2C library that I can find. I've also tried changing the address to 27 (and 37 as suggested earlier on here).

Where to look next ?

Adrian

andrew
Site Admin
Posts: 1374
Joined: Sun Aug 05, 2012 4:15 pm

Re: Serial I2C LCD 1602 Module (HCARDU0023)

Post by andrew » Fri Dec 29, 2023 8:16 am

...'m confident that the Nano is running, but all I see on the screen are the 16 white squares on the first row.

Hi Adrian, have you read the FAQ section in the first post of this thread? It gives reasons for the exact problem you're seeing.

Most likely you have the wrong version of the library for your display or version of IDE. It doesn't look like you purchased the display from us but you may want to give the version we link to in the first post as this is known to work with our displays and may work with yours.

Failing that I would suggest contacting whoever sold you the display and asking them to send you the correct version as failing that you may have a faulty display.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

Adrian_ffoil
Posts: 3
Joined: Tue Dec 26, 2023 5:04 pm

Re: Serial I2C LCD 1602 Module (HCARDU0023)

Post by Adrian_ffoil » Fri Dec 29, 2023 4:53 pm

andrew wrote:
Fri Dec 29, 2023 8:16 am
...'m confident that the Nano is running, but all I see on the screen are the 16 white squares on the first row.

Hi Adrian, have you read the FAQ section in the first post of this thread? It gives reasons for the exact problem you're seeing.

Most likely you have the wrong version of the library for your display or version of IDE. It doesn't look like you purchased the display from us but you may want to give the version we link to in the first post as this is known to work with our displays and may work with yours.
Hi Andrew,

Thanks for the prompt reply.

I've now downloaded and installed the library that you refer to in the first post, and my code still doesn't display anything. I've also tried the "hello world" example, and that doesn't display anything either.
andrew wrote:
Fri Dec 29, 2023 8:16 am
Failing that I would suggest contacting whoever sold you the display and asking them to send you the correct version as failing that you may have a faulty display.
I bought the display from you (via Amazon Marketplace) a couple of weeks back, which is why I came here.

Adrian

andrew
Site Admin
Posts: 1374
Joined: Sun Aug 05, 2012 4:15 pm

Re: Serial I2C LCD 1602 Module (HCARDU0023)

Post by andrew » Sat Dec 30, 2023 9:26 am

I've now downloaded and installed the library that you refer to in the first post, and my code still doesn't display anything. I've also tried the "hello world" example, and that doesn't display anything either.
Just a couple of things to check…

1) Did you delete the original version of the library first? It's important to remove it from your libraries folder as the Arduino IDE may still be using it instead of our version. It is normally installed here:

On Windows:
My Documents\Arduino\libraries\

On Mac:
Documents/Arduino/libraries/

Linux:
Usually found within the users home area under /Arduino/libraries/


Just to be sure I would recommend just deleting all versions of the library you find, restarting the IDE and then reinstalling the version from this forum.



2) I don't think this is the problem but worth checking: Can you try adjusting the blue and white contrast pot on the back of the display. Sometimes they are not set correctly by the factory and this can make it look like the display isn’t working.


I bought the display from you (via Amazon Marketplace) a couple of weeks back, which is why I came here.
Sorry about that, I couldn't match your name or email address to an order. If you still have no luck after you have tried the above can you either contact sales [at] hobbycpmponents.com with details of your order, or via Amazon and we will sort it out from there.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

Adrian_ffoil
Posts: 3
Joined: Tue Dec 26, 2023 5:04 pm

Re: Serial I2C LCD 1602 Module (HCARDU0023)

Post by Adrian_ffoil » Sat Dec 30, 2023 4:59 pm

andrew wrote:
Sat Dec 30, 2023 9:26 am
I've now downloaded and installed the library that you refer to in the first post, and my code still doesn't display anything. I've also tried the "hello world" example, and that doesn't display anything either.
Just a couple of things to check…

1) Did you delete the original version of the library first? It's important to remove it from your libraries folder as the Arduino IDE may still be using it instead of our version. It is normally installed here:

Linux:
Usually found within the users home area under /Arduino/libraries/


Just to be sure I would recommend just deleting all versions of the library you find, restarting the IDE and then reinstalling the version from this forum.
I've done that, and it still makes no difference.
andrew wrote:
Sat Dec 30, 2023 9:26 am
2) I don't think this is the problem but worth checking: Can you try adjusting the blue and white contrast pot on the back of the display. Sometimes they are not set correctly by the factory and this can make it look like the display isn’t working.
I've tried that. Out of the bag, I could see nothing at all on the screen. I've wound the pot up, and it quickly goes from nothing shown to the white squares, but that is at the top end of the scale, but where ever it is set (with the squares visible), I don't get to see any text.

Elsewhere, someone suggested that I download a I2C port scanner sketch. The only I2C device that I've got connected is the display. I installed that sketch, and the only thing it found was at 0x27, so I've altered the code to that, but that doesn't seem to have made any difference either.


Later Note

I was sent a test program from another forum, and when installed, it works fine. In slower time, I'll compare that with mine to see what the difference is.

Adrian

andrew
Site Admin
Posts: 1374
Joined: Sun Aug 05, 2012 4:15 pm

Re: Serial I2C LCD 1602 Module (HCARDU0023)

Post by andrew » Sun Dec 31, 2023 9:17 am

I was sent a test program from another forum, and when installed, it works fine. In slower time, I'll compare that with mine to see what the difference is.

Very odd. I don't see anything wrong with your sketch other than it's initialising the library with address 0x3F and it looks like you need it to be 0x27. I don't know what the setscreen() function is doing but if you say you're seeing the serial test messages being printed to the monitor window then like you said, the code in the main loop must be running.

I'm not aware of any current issue but I can pull one from our current stock and check it with the library to be sure but unfortunately as it is Sunday and new years day tomorrow I won't be able to do this until Tuesday.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

Post Reply

Return to “Display”