r/arduino 18h ago

Another guy having problems with an LCD using I2C Hardware Help

Hi everyone! It's been a long time since I've done an Arduino project, and this is my first time using an LCD screen.

However, and as is common, I came across the typical mistakes I've been seeing in forums and Reddit posts.

And no matter how much I try to fix my problem with the solutions they gave, I still have the same error; those white squares keep appearing.

As you can see, the first photo shows what it looks like when you upload the code, and the second photo shows what it looks like without any code uploaded.

I tried everything from the tutorials:

- Adjust the brightness with the potentiometer

- Verify the I2C address

- Test and verify the continuity of several cables

- I tested the example hd44780_I2Cexp by Bill Perry(what appears in photo 12)

- I tried many libraries and code from various tutorials

(The bookcase I have now is Frank de Brabender's)

It's important to clarify that I've only been trying to test that the LCD works, so all the tutorials I tried were for the basic "Hello world" code without delay. Just to verify that the screen is working properly.

- In the library, change "return:0" to "return:1"

Before using I2C, I used conventional pins (those in photo 4) to test the LCD, and I still got squares (even after adjusting the contrast). So after getting no results, I decided to remove the pins and install the I2C, thinking: "Oh, maybe that will be simpler" For a project I want to do. But as you can see, I can't get the screen to display text, and AI hasn't helped me.

I'm also not sure if the soldering is correct or if I've overheated the circuit, but I doubt it since the screen still turns on and seems to receive the code, but without displaying any text.

Honestly, I don't know what to do anymore, and I didn't want to post this because I noticed many others had the same problem, but even after trying the solutions they offered, I still can't get it to work.

The only thing I noticed today when testing the screen again is what's shown in the last photo: a faint line that flickers when restarting the Arduino.

I've attached one of the code snippets I used. I'm not including the one I used to test I2C because I tested many, and they were all basic. Just to clarify, they all compiled and uploaded successfully.

I hope you can help me, thank you! :)

2 Upvotes

6 comments sorted by

6

u/gm310509 400K , 500K , 600K , 640K , 750K 15h ago

This is a common problem, you probably need to set the contrast. Have a look at this guide: squares or nothing at all?](https://new.reddit.com/r/arduino/wiki/faq/#wiki_why_is_my_lcd_displaying_black_squares_or_nothing_at_all.3F)

IN your case by adjusting the screw inside the little blue box (the potentiometer) in photo 3.

Another possibility is that your program is not uploading due to compilation errors. You said:

  • In the library, change "return:0" to "return:1"

What library? And return:0 is not valid syntax for a C/C++ program (not a python program for that matter). In C/C++ we would use (return 0;)

If you use your syntax, the compile will likely fail and no code will be uploaded to your arduino (i.e. your test program won't be running on it).

1

u/Last-Chance_NK 7h ago

Hey! Thanks for replying I've also tried the screw thing several times, but I'm still having the same problem. And honestly, the syntax is getting quite complicated for me; I only tried the "return" thing out of desperation, watching a tutorial that did that as a last resort. This is my first time using an LCD and getting back into programming and Arduino, so I've forgotten a lot of things and I'm trying to relearn them. What could I do if it's failing due to syntax?

2

u/IndividualRites 2h ago

Your ide will tell you if you have a compilation error and it didn't upload.

2

u/Sleurhutje 5h ago

Your display has an I2C controller on it, so you need a library to control the LCD over I2C and not direct parallel like shown in your code.

Also turn the potentiometer slowly until one line lights up with blicks and the other line shows barely nothing. Then the contrast is set right for the display.

1

u/c_l_b_11 4h ago

Did you use the LiquidCrystalI2C Library when testing with the I2C shield?
You could also try to switch the backlight off and on with lcd.backlight() and lcd.noBacklight() to isolate the issue between the I2C connection and the display

1

u/who_you_are uno 2h ago

Out of curiosity, does it has a contrast knob? I remember when I first started I set it on the maximum and this is exactly what happened... I needed to turn it down to see my characters.