EEVblog Electronics Community Forum

Electronics => Beginners => Topic started by: Macros on February 13, 2023, 09:46:11 pm

Title: lCD 16x2 turns on but doesn't show the white squares nor changes the contrast
Post by: Macros on February 13, 2023, 09:46:11 pm
Hello. I'm making a voltimeter-amperemeter using an atMEGA328P, L7805, LM358, LCD 16x2 and some other components.
The problem is that even though the LCD turns on, it doesn't show the code or at least the white squares it should, and when I move the potentiometer that goes with it it doesn't change the contrast.
I am completely sure it can't be the schematic nor the code since they were given by our professors, so they can't be wrong. The pads are fine, there are no shorts, and the components should technically be good.
(the red pad doesn't cross the other pads, it's a cable that goes on the other side (single sided baord)). What could the problem be? Any help is appreciated.
Title: Re: lCD 16x2 turns on but doesn't show the white squares nor changes the contrast
Post by: wasedadoc on February 13, 2023, 10:18:08 pm
What do you mean by "turns on"?  If you mean the backlight, it is completely independent of the LCD segments.  The backlight only needs current through pins 15 and 16.

The schematic does not include the contrast pot.  How is it connected?
Title: Re: lCD 16x2 turns on but doesn't show the white squares nor changes the contrast
Post by: james_s on February 13, 2023, 10:22:06 pm
The contrast pot is right there to the lower left of the display, it's drawn as a 3 pin connector.
Title: Re: lCD 16x2 turns on but doesn't show the white squares nor changes the contrast
Post by: wasedadoc on February 13, 2023, 10:29:44 pm
The contrast pot is right there to the lower left of the display, it's drawn as a 3 pin connector.
OK, I had not spotted the '10k' legend.

Use a multimeter to confirm that the voltage at pin 3 of the display does change as the pot is turned.
Title: Re: lCD 16x2 turns on but doesn't show the white squares nor changes the contrast
Post by: TomKatt on February 14, 2023, 11:53:31 am
Just because the schematic and code are known to be correct doesn't mean you don't have some kind of fault preventing the ucontroller from operating correctly...

Do you have a scope or something to inspect the data lines so you can verify the ucontroller is 'alive'?  It could be that your lcd is connected correctly, but something is keeping the ucontroller from operating...

When I run into something like this, I code in a 'heartbeat' led somewhere so I can verify that at least the code is running.
Title: Re: lCD 16x2 turns on but doesn't show the white squares nor changes the contrast
Post by: pcprogrammer on February 14, 2023, 12:23:34 pm
I am completely sure it can't be the schematic nor the code since they were given by our professors, so they can't be wrong.

You got to love the faith in the professors  :-DD

Only if the design and the code has been used with good results before, then yes you could rely on it.

I do see some issues with the design, but they most likely don't interfere with the working. According to the 78L05 datasheet it needs a 330nF cap on the input and 100nF cap on the output. Also I would enlarge C1 to the value of C4 and reduce or get rid of C4. But that is just me and how I learned about making a linear power supply.

And like TomKatt wrote, the way to tackle this problem is to do measurements. Even a simple cheap USB based 8 bit logic analyzer can show if the display is being addressed as it should.

For more help a picture of your board and a copy of the used code would be nice.
Title: Re: lCD 16x2 turns on but doesn't show the white squares nor changes the contrast
Post by: timenutgoblin on February 14, 2023, 12:56:02 pm
Is the microcontroller being reset properly during power on? You may need a pull up resistor connected to VCC and a capacitor connected to ground to keep RESET (PC6 pin 1) low during the power on cycle. Try pulling the RESET (PC6 pin 1) low to ground briefly if necessary. Also, maybe the 16MHz crystal is too fast, but I think it should be adequate.
Title: Re: lCD 16x2 turns on but doesn't show the white squares nor changes the contrast
Post by: wasedadoc on February 14, 2023, 01:24:05 pm
My experience with those displays is that even if the control and data lines are not receiving proper signals, turning the contrast control should make visible change to the display.  If that is not the case here, I would suspect the contrast control is defective or not connected properly or that the display is not receiving power.

Some basic voltage checks are easy and quick to do before bothering with a 'scope or logic analyser.
Title: Re: lCD 16x2 turns on but doesn't show the white squares nor changes the contrast
Post by: timenutgoblin on February 14, 2023, 01:30:58 pm
Is the microcontroller sending 4-bit commands to the LCD? I noticed that only pins 11 to 14 of the LCD (D4 - D7) are being utilized for data. Probably not the issue, though.
Title: Re: lCD 16x2 turns on but doesn't show the white squares nor changes the contrast
Post by: TomKatt on February 14, 2023, 02:42:52 pm
I know this sounds stupid, but it wouldn't be the first time an lcd module was wired backwards because the pin numbering was confused  ;D
Title: Re: lCD 16x2 turns on but doesn't show the white squares nor changes the contrast
Post by: wasedadoc on February 14, 2023, 03:10:46 pm
I know this sounds stupid, but it wouldn't be the first time an lcd module was wired backwards because the pin numbering was confused  ;D
Not stupid at all.  Not the first time and I doubt it would be the last. :)
Title: Re: lCD 16x2 turns on but doesn't show the white squares nor changes the contrast
Post by: Brianf on February 14, 2023, 03:21:53 pm
Why haven't you connected BOTH 0V pins on the '328?

You also don't show the programming connections for the '328.
Title: Re: lCD 16x2 turns on but doesn't show the white squares nor changes the contrast
Post by: jwet on February 14, 2023, 06:33:56 pm
Post your code especially the LCD initization.  Some of these displays can be finnicky about initialization.  You could try to just double all the delays as a start.