lCD 16x2 turns on but doesn't show the white squares nor changes the contrast - Page 1
Forum section: electronics / beginners

author: Macros
author_rank: Newbie
timestamp: February 13, 2023, 09:46:11 pm
content: 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.

author: wasedadoc
author_rank: Super Contributor
timestamp: February 13, 2023, 10:18:08 pm
content: 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?

author: james_s
author_rank: Super Contributor
timestamp: February 13, 2023, 10:22:06 pm
content: The contrast pot is right there to the lower left of the display, it's drawn as a 3 pin connector.

author: wasedadoc
author_rank: Super Contributor
timestamp: February 13, 2023, 10:29:44 pm
content: Quote from: james_s on February 13, 2023, 10:22:06 pmOK, 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.

author: TomKatt
author_rank: Frequent Contributor
timestamp: February 14, 2023, 11:53:31 am
content: 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.

author: pcprogrammer
author_rank: Super Contributor
timestamp: February 14, 2023, 12:23:34 pm
content: Quote from: Macros on February 13, 2023, 09:46:11 pmYou got to love the faith in the professorsOnly 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.

author: timenutgoblin
author_rank: Regular Contributor
timestamp: February 14, 2023, 12:56:02 pm
content: 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.

author: wasedadoc
author_rank: Super Contributor
timestamp: February 14, 2023, 01:24:05 pm
content: 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.

author: timenutgoblin
author_rank: Regular Contributor
timestamp: February 14, 2023, 01:30:58 pm
content: 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.

author: TomKatt
author_rank: Frequent Contributor
timestamp: February 14, 2023, 02:42:52 pm
content: 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

author: wasedadoc
author_rank: Super Contributor
timestamp: February 14, 2023, 03:10:46 pm
content: Quote from: TomKatt on February 14, 2023, 02:42:52 pmNot stupid at all. Not the first time and I doubt it would be the last.

author: Brianf
author_rank: Regular Contributor
timestamp: February 14, 2023, 03:21:53 pm
content: Why haven't you connected BOTH 0V pins on the '328?You also don't show the programming connections for the '328.

author: jwet
author_rank: Frequent Contributor
timestamp: February 14, 2023, 06:33:56 pm
content: 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.