LCD works good with UNO but not with Nano

Hello,

As the title says, I have a project which requires an LCD, and I am now in the process of changing the Arduino UNO to a nano, but for some reason when trying the LCD with the "Hello World!" code, it works perfectly with the UNO but with the Nano, while it does display the text, it has a certain lag, like a wild movement of pixels (like what you would see in an old RCA TV). I am not using a potentiometer, but I set a specific value in a digital pin and I use a 420Ω resistor for the anode.

I tried to fix this by adding a delay but nothing changed.

Any ideas?
Thanks!

pllagunos:
I am not using a potentiometer, but I set a specific value in a digital pin and I use a 420Ω resistor for the anode.

That makes little sense without a circuit diagram, so get working on that diagram for us!

A "digital pin" can have a value of HIGH (1) or LOW (0).

This is the whole circuit, but you can discard the max232 chip and just see the connections between the Arduino and LCD.

It is a mystery why anyone would want to PWM the backlight.
I can understand on-off for the backlight. Or even bright-dim

There is no sense in PWM on the LCD_VO pin.
Just connect LCD_DO directly to GND. Or via a 390R if this gives a better contrast.

You do not quote your sketch. The constructor should match your wiring.

David.

As far as I can see from your circuit diagram the LCD's LED+ needs 5V while V0 needs to be connected with the wiper of the pot meter you don't use.

I recommend connecting the LCD to the Nano with a potentiometer wiper connection to pin V0 of the LCD pin interface. If that works, then the culprit is known.

See https://thesolaruniverse.wordpress.com, post dated Juy 7, 2018

david_prentice:
It is a mystery why anyone would want to PWM the backlight.
I can understand on-off for the backlight. Or even bright-dim

There is no sense in PWM on the LCD_VO pin.
Just connect LCD_DO directly to GND. Or via a 390R if this gives a better contrast.

You do not quote your sketch. The constructor should match your wiring.

David.

Thanks! This indeed ended the "lag". However, plugging to VO pin directly to GND is way to much backlight, so I must restrict it, which I'll probably do with a 390R or similar. A pot could also work, however, one of my goals in the project is to have a very minimalistic approach (thus I am using a Nano and not a UNO).

Also, how did I not quote my sketch? Sorry if I misspelled something or have a mistake in the sketch, but I don't understand/see where.

It is still a mystery why this worked in the Uno but not in the Nano.

You have misunderstood the purpose of VO pin#3 and LED+ pin#15.

VO controls the contrast of the individual letters on the display. It has no effect on the backlight. It needs to be somewhere between 0.0V and 0.3V on most 5V displays.
You can adjust it with a potentiometer but the pot will always be at the bottom of its range i.e. near 0.0V
Many (most) displays have a pullup resistor mounted on the pcb between VO and VDD pin#2. Which is why a single 0R or 390R resistor between VO and GND pin#1 completes the "potential divider".

LED+ controls the backlight. Your schematic shows that you have an external 420R series resistor. I would expect the backlight to be very dim. Many displays already have a 100R mounted on the pcb and do not require an external resistor. Some displays have a 0R mounted and consequently MUST have an external resistor.

The yellow-green LCD with black letters work perfectly well without a backlight. At night the backlight does not need to be very bright.
The blue LCD with white letters must have a backlight for you to see the letters at all.

David.

pllagunos:
Thanks! This indeed ended the "lag". However, plugging to VO pin directly to GND is way to much backlight, so I must restrict it, which I'll probably do with a 390R or similar.

You suffer from a couple of very common matters of confusion here. The backlight is the LED powered by the 420 Ohm resistor. You can if you wish, switch it on and off to conserve power by connecting it to an Arduino pin and you could even dim it using PWM, but generally you only need a choice of three brightness levels; fully on, dim for night use, or off, and these can be set using resistors. The LCD board usually contains a 100 Ohm ("101") resistor at R8 to set the LED current which allows it to be directly controlled by an Arduino pin.

pllagunos:
A pot could also work, however, one of my goals in the project is to have a very minimalistic approach (thus I am using a Nano and not a UNO).

"Vo" sets the contrast of the display. This requires a voltage of between 4.5 and 5 V negative to Vcc for the common display materials (significantly greater however, for those designed to work is extreme cold). When the original chip was designed many years ago, one "test" circuit was published with a potentiometer to set the voltage and in a fascinating blunder, engineers ignored the other design information and ever since imagine a potentiometer is necessary. In fact, what is required is a resistor, fixed or variable, from Vo to ground. Since the chain of resistors internal to the display board total 11k, (five times 2k2) a resistor of up to 1k to ground is just about right.

What does not work, is connecting this to a PWM output; the results are entirely random and will cause the exact sort of effect you describe.

pllagunos:
Also, how did I not quote my sketch? Sorry if I misspelled something or have a mistake in the sketch, but I don't understand/see where.

In the Arduino IDE terminology, it is the source code that is called a "sketch". Asking for your "sketch" is asking for you to post your code using the "code" (</> icon at the top of the "Post Reply" window) macro.

pllagunos:
It is still a mystery why this worked in the UNO but not in the Nano.

No, the mystery is why it ever functioned if you drive the contrast chain with PWM. What happens is a complex interference between the PWM waveform and the multiplexing frequency of the LCD driver. Whether it is visible at all is a fluke.

If you do not wish to include a variable resistor, just use a 390 or 470 Ohm resistor between Vo and ground. Try one and the other, and use what looks best. Note however that if your Vcc varies, so will your contrast, no matter how you connect it. Unfortunately, every so often, someone confuses PWM with a variable voltage and if they are really unlucky, it actually works and they write it up on "Instructables" or some similar site to entrap newbies. :astonished: