Wednesday, 22 March 2017

LCD Displays - Arduino

 Here is a basic LCD project.
A LCD is a  Liquid Crystal Display.
It uses a 16x2 LCD display. 
The exercise uses an Arduino.
Some of the older LCDs that Ive tinkered around with have a different pin out, but the basic ideas are the same.
 
 
I'm doing this project as it's good way to learn a bit about this older but proven technology.
LCD displays are often used in DIY projects, so  this info should come in useful one day.
I'll add to this page over time as I fix the odd synth. 

 LCD's are pretty commonly found in older synths. It is sometimes possible to restore older synths with newer OLEDs , but you may wish to stay as close to the original.
 

For many instruments such as the Yamaha SY99 & Korg Wavestation, there are no OLED replacements. They need LCD display replacements.
 
LCD's are different to OLEDS.
LED LCD screens use a backlight to illuminate their pixels, while OLED's pixels actually produce their own light. 
The back light commonly burns out. 
Some of these LCDs had no backlight o

 

LCDs are thicker, heavier and consume more power than OLEDS.
 
 
1.VSS = GND
2. VDD = VCC = 5V
3. Vo = display contrast pin - you will often connect the wiper of a pot to this
4. RS = register select
5. RW = Read/Write
6. E = Enable
7 to 14. D0 to D7 = data pins 
15. A = Anode - for the LED Backlight
16. K = Cathode - for the LED Backlight
 
I've used TinkerCad to test these circuits.
 
 Example 1
This LED screen  displays "Hello World"
Such a simple project.
These are the connections:
The resistor is 220 ohms
The pot is 250K ohms


/*
  LiquidCrystal Library - Hello World

 Demonstrates the use of 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
we are creating a LC object
The parameters of this object should be the numbers of the Digital Input pins of the Arduino Board 
respectively to the LCD’s pins as follow: (RS, Enable, D4, D5, D6, D7).
*/
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);
}
 --------------------------------------------------------
Example 2
Many thanks to
www.HowToMechatronics.com
This uses the same circuit as above.
 I've changed the code a bit, so it works with the old circuit.
 


* Arduino LCD Tutorial
*
* Crated by Dejan Nedelkovski,
* www.HowToMechatronics.com
*
*/
#include <LiquidCrystal.h> // includes the LiquidCrystal Library
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); // Creates an LC object. Parameters: (rs, enable, d4, d5, d6, d7)
void setup() {
 lcd.begin(16,2); // Initializes the interface to the LCD screen, and specifies the dimensions (width and height) of the display }
}
void loop() {
 lcd.print("Arduino"); // Prints "Arduino" on the LCD
 delay(3000); // 3 seconds delay
 lcd.setCursor(2,1); // Sets the location at which subsequent text written to the LCD will be displayed
 lcd.print("LCD Tutorial");
 delay(3000);
 lcd.clear(); // Clears the display
 lcd.blink(); //Displays the blinking LCD cursor
 delay(4000);
 lcd.setCursor(7,1);
 delay(3000);
 lcd.noBlink(); // Turns off the blinking LCD cursor
 lcd.cursor(); // Displays an underscore (line) at the position to which the next character will be written
 delay(4000);
 lcd.noCursor(); // Hides the LCD cursor
 lcd.clear(); // Clears the LCD screen
}
 
----------------------------------------------------
 
 
Links (Paul McWhorter)
 

No comments:

Post a Comment