Wiring up a surplus-store LCD display to an Arduino (Shallow Thoughts)

Akkana's Musings on Open Source Computing and Technology, Science, and Nature.

Sat, 11 Jun 2011

Wiring up a surplus-store LCD display to an Arduino

[Densitron LCD display with Arduino] Every now and then I think it might be handy to have some sort of display on the Arduino ... something a little more detailed than an LED that either blinks or doesn't.

Adafruit's 2-line LCD text display comes with a great Character LCD tutorial, but it's quite heavy, and includes a backlight I don't need. I wanted something more minimal.

The local surplus store always has lots of cheap LCDs, but they unfortunately tend to be unlabeled, so you can't tell which pin is which. But the other day I spied a very lightweight little display for $2.95 that actually had a label on it, so I grabbed it, figuring I'd be able to get the pinout from google. It said:

DENSITRON 2
617ASNG0441
0201 TAIWAN

Alas, googling produced no useful information for any of those numbers. Foiled again! It might as well have been unlabeled!

Wait -- let's not give up quite so quickly.

Adafruit's LCD Shield tutorial says most parallel displays have either 14 or 16 pins, while this one has 15. That's close, at least ... but comparing the two Ada tutorials, I could see that the pin assignments for the two displays were completely different even though both were 16-pin. I wasn't going to get pin assignments there.

Searching for just densitron 15-pin lcd found lots of displays that clearly weren't this one. But apparently a lot of them were similar to a display called an LM50. Perhaps mine used that pinout too.

So I tried it, and it worked with only a little experimentation. Here's the pinout:
LCD pin Function Arduino pin
1 Gnd Gnd
2 +5 V +5 V
3 Contrast pot
4 RS 7
5 RW Gnd
6 EN 8
7 D0  
8 D1  
9 D2  
10 D3  
11 D4 9
12 D5 10
13 D6 11
14 D7 12
15 (nonexistent backlight)

Or I can use the nice cable with the 8x2 connector that came with the display, which maps to these functions:
1 = Gnd Contrast RW D0 D2 D4 D6       
+5V RS EN D1 D3 D5 D7       

The Arduino LiquidCrystal library works just fine with it, using this initialization:

LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
in the Liquid Crystal Arduino sketch.

Works great! I went back and grabbed another $3 display. So the moral is, even a complete hardware klutz shouldn't give up too easily: with the right web search terms and a little fiddling, you might just get it to work after all.

Update: apparently something has changed in the LiquidCrystal library, and you now need a trick to get this to work. Specifically, to see the rightmost 8 characters, you need to call lcd.setCursor(40, 0). See this discussion: 16x1 LCD showing only first 8 characters (lcd.setCursor(0,1) not working).

Tags: , , ,
[ 20:25 Jun 11, 2011    More hardware | permalink to this entry | ]

Comments via Disqus:

blog comments powered by Disqus