HOME > > ARDUINO How To MAIN PAGE     Delicious.Com Bookmark this on Delicious    StumbleUpon.Com Recommend to StumbleUpon

$5 Liquid Crystal Display? Good deal!

In haste... this just a longwinded version of "The DataVision 16400 that ModernDevice were selling for $5 August 2015 WORKS, without any special adaptations, with the Arduino.cc Guide to LCDs". Pinout/ hookup is the same. Software needs no tweaks. Read on, if you want to hear that again, with details...



I had the chance to buy an inexpensive (in cash) LCD ("Liquid crystal display")... 4 lines, 16 characters.

I always forget to factor my time into the cost of "a bargain"

On the back it said "Data Vision/ 16400 / 2RB"

Off to the web. Found something.

Seemed to suggest that what I had needed 5v. Also had some pin assignments.

Tried to match what I had with what was at the Arduino.cc LCD tutorial, as at 16 Aug 15.

The Arduino page spoke of the common LCDs having 16 pins. I believe, hope, that pins 15 and 16 are just for the backlight. My display has 14 pins... but it doesn't have a backlight.

The Arduino page is written for displays using the Hitachi HD44780 driver IC. Mine, if I have the right data sheet uses the ST7066... but, at least in the main ways, that may be close enough.

Hookup

The end pins were numbered. The one nearest the PCB edge was pin 1.

I "translated" what I could lay my hands on to the terms used on the Arduino page as follows, and made the following connections. Some of these can be changed, if you make corresponding changes to...

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

Connections and names...

Module   Name   Connect it to ("Arduino's..." except as noted)
Pin
1        Gnd... *
2        5v (From Arduino or other)
3        Vee... see below.
4        RS         12
5        R/W        Tie low, i.e connect to Gnd
6        Enable     11
7        D0 of LCD  (No connection..
8        D1 of LCD    ditto  we are
9        D2 of LCD    ditto  using the
10       D3 of LCD    ditto  4 bit mode.)
11       D4 of LCD   5
12       D5 of LCD   4
13       D6 of LCD   3
14       D7 of LCD   2

(* If powering the display from source other than the 5v of the Arduino, be sure to connect the grounds of the LCD and the Arduino.)

Vee: Pin 4 should be connected to the wiper of a small pot. I believe 10K is an appropriate value for the pot, and the top and bottom of it go to 5v and 0v. The voltage on this input determines the contrast on the display. If you want to use two resistors, that's fine, if that's what you have, and you configure them as if they were a pot... but you need the right resistors, which you will have to determine by trial and error.

We are going to use the display in 4-bit mode, so the LCD pins 7, 8, 9, 10 are not used, and can be allowed to float. (Do not connect anything to them; do not tie them high or low.)

It is looking suspiciously like the device I have using the same pin assignments as the LCD in the Arduino.cc page, in spite of the fact that it, I think, uses a different controller. (I say "suspiciously", as nothing is ever simple, is it? But this is looking simple. So far. I haven't seen the display "do its thing" yet, of course.)

When you first apply power with all of the above connections made, you may see no change from the non-powered display. Do not be down-hearted! Run the voltage on pin three from low to high. When it gets too low, you may see rows of black rectangles, as if every pixel in every character has gone black. Raise the voltage again, until the rectangles are a faint gray. Then proceed with trying to do something more interesting.

Software

The Arduino IDE, vers 1/0/6 has as standard demos in the LCD category. I ran the HelloWorld demo, and it Just Worked.

/*
  LiquidCrystal Library - Hello World
 
 Demonstrates the use a 16x2 LCD display.  The LiquidCrystal
 library works with all LCD displays that are compatible with the 
 Hitachi HD44780 driver. There are many of them out there, and you
 can usually tell them by the 16-pin interface.
 
 This sketch prints "Hello World!" to the LCD
 and shows the time.
 
  The circuit:
 * LCD RS pin to digital pin 12
 * LCD Enable pin to digital pin 11
 * LCD D4 pin to digital pin 5
 * LCD D5 pin to digital pin 4
 * LCD D6 pin to digital pin 3
 * LCD D7 pin to digital pin 2
 * LCD R/W pin to ground
 * LCD VSS pin to ground
 * LCD VCC pin to 5V
 * 10K resistor:
 * ends to +5V and ground
 * wiper to LCD VO pin (pin 3)
 
 Library originally added 18 Apr 2008
 by David A. Mellis
 library modified 5 Jul 2009
 by Limor Fried (http://www.ladyada.net)
 example added 9 Jul 2009
 by Tom Igoe
 modified 22 Nov 2010
 by Tom Igoe
 
 This example code is in the public domain.

 http://www.arduino.cc/en/Tutorial/LiquidCrystal
 */

// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
  // set up the LCD's number of columns and rows: 
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("hello, world!");
}

void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  // print the number of seconds since reset:
  lcd.print(millis()/1000);
}

LCD on NoviceGuard

NoviceGuard is a PCB and associated library (NovGrdCore) to make things easier for novices, and to protect their Arduinos from the novices first steps.

At August 15, a lot of work remains to be done on the NoviceGuard 12 way connector's use. But, as a taste of things to come, here is proof that a LCD can be connected to a NoviceGuard

In the example LCD code from Arduino.cc, we have...

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

If we connect the hardware as explained above, we need to use the LiquidCrystal initializer as above. But the choice of pins is not set in stone.

Consider the command in this general form...

LiquidCrystal lcd(p1, p2, p3, p4, p5, p6);

We can connect up the display as we see fit, as long as we supply....

In.... We supply the Arduino pin we've connected...

p1  ...to the display's RS line (LCD pin 4)
p2     to the display's En line (LCD pin 6)
p3     to the display's D4 line (LCD pin 11)
p4     to the display's D5 line (LCD pin 12)
p5     to the display's D6 line (LCD pin 13)
p6     to the display's D7 line (LCD pin 14)

... and as long as we make the Vcc, Gnd, and contrast control connections as before. And tie the R/W input (LCD pin 5) low, as before.

So! To hook up one of these displays to a NoviceGuard, on the Twelve Way Connector, we could assign the wires many ways, as long as we re-did the LiquidCrystal lcd(p1, p2, p3, p4, p5, p6); to match. And we need to tap the Gnd and 5v, and provide the contrast adjusting pot, and tie the LCD R/W line (LCD pin 5) low.

BEFORE connecting the LCD to the twelve way connector, load an Arduino with the same program as above except modify the following line to use the numbers shown...

LiquidCrystal lcd(9,8,7,6,11,10);

Disconnect the Arduino from the host, to kill the power to the board, while you connect everything up. (Eventually, it will just be a plug in module.)

Now reconnect the Arduino to power, and let the program run. You should see "Hello World" on the first line of the LCD, and on the second line a counter should go 1, 2, 3, etc. (Only one number showing at a time.)

Ta! Da!... and we still have two analog inputs available via the twelve way connector. I have actually tested the above on a NoviceGuard (ver_D_7_May_2015) and seen it working.

You could also connect one of the the clever LCD-with-input-buttons devices which are readily available. (A little tweaking of the numbers in the LiquidCrystal LCD(... statement as shown there would be necessary.) One of the analog inputs on the twelve way connector would be just what was needed for the clever 5 button circuit on the display+ keypad, and the other could be used as a digital output to turn the backlight on and off... (the job done by digital line 10 in the page cited), although to do it EASILY, we'd need to introduce our novices to "pinMode", which, for reasons related to the "protect the Arduino" goal of NoviceGuard we would rather not do. But a NoviceGuard protected Arduino COULD run one of the boards mentioned.



To search THIS site.... (Go to my other sites, below, and use their search buttons if you want to search them.)
Click this to search this site without using forms.

powered by FreeFind
Site search Web search

The search engine merely looks for the words you type, so....
*    Spell them properly.
*    Don't bother with "How do I get rich?" That will merely return pages with "how", "do", "I"....

Please also note that I have two other sites, and that this search will not include them. They have their own search buttons.
My site at Arunet.
My Sheepdog Software pages, another of this page's editor's sites.


Ad from page's editor: Yes.. I do enjoy compiling these things for you... hope they are helpful. However.. this doesn't pay my bills!!! If you find this stuff useful, (and you run an MS-DOS or Windows PC) please visit my freeware and shareware page, download something, and circulate it for me? Links on your page to this page would also be appreciated!
Click here to visit editor's freeware, shareware page.




Here is how you can contact this page's editor. This page, and the software it references, ©TK Boyd, 8/2015.

Page tested for compliance with INDUSTRY (not MS-only) standards, using the free, publicly accessible validator at validator.w3.org