Tuesday 4 September 2012

Simple Stick User Guide - Interfacing a LCD with Simple Stick

Simple Stick User Guide - Interfacing a LCD with Simple Stick

 The LCD interface on the Simple Stick lets you plug in a standard 16 pin LCD and drive it in 4-bit mode. Owing to the size of the Simple Stick and the fact that it has been designed to work on USB power, this LCD interface comes with a few trade offs
  • The Contrast Pin of the LCD is connected to a fixed resistor, so you will not be able to vary the contrast [Scroll to the bottom of this page to see how to overcome this ;) ]
  • The Backlight Power Supply uses a 470E resistor (to save current draw from USB) and as a result the back light will be very dim. [Scroll to the bottom of this page to see how to overcome this ;) ]
  • The Interface uses a fixed I/O for R/W mode select
  • The Interface is hard wired for 4-bit mode
  • The Interface works only with LCDs with the following Pin Mapping (commonly available!)

Character LCD - A Quick Overview
Here's an interesting Write up to get you understanding the working of LCDs
http://joshuagalloway.com/lcd.html

To try an LCD place it on the Simple Stick and run the Hello World Example under File->Examples->LiquidCrystal->Hello World, with the following changes

replace this line
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
with
LiquidCrystal lcd(3, 2, 0, 1, 4, 12, 6);



Heres a demo video of this code in action



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

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(3, 2, 0, 1, 4, 12, 6);

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);
}

Hacks to Overcome the LCD Shortfalls

Back light - To increase the intensity of the backlight, you can solder a resistor of lesser value between the 'BL-' pin and the GND pin on your LCD [Video Coming Soon!]

Contrast - You can achieve full contrast by directly grounding the Contrast Pin. Keeping this in mind, if you decrease the resistance value like in the above manner, you can increase the contrast.  Remember this time, you need to put in the resistor between the 'Contrast' pin and the GND pin on your LCD.  [Video Coming Soon!] Decreasing the contrast is not possible without de-soldering the fixed resistor.



No comments:

Post a Comment