This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
tutorials:learn:lcd:charlcd.html [2011/08/15 19:23] ladyada [RGB backlight LCDs] |
tutorials:learn:lcd:charlcd.html [2012/03/10 20:21] ladyada |
||
---|---|---|---|
Line 1: | Line 1: | ||
==== Introduction ==== | ==== Introduction ==== | ||
- | + | [[http://www.adafruit.com/category/63|We sell tons of lovely character LCDs for use with Arduino]], they are extremely common and a fast way to have your project show status messages. This tutorial will show how you can easily connect a character LCD, either 16x2 or [[http://www.adafruit.com/products/198|20x4]]. | |
- | This is a bit of a side note, there's no LCD included with the Arduino starter pack, but I figure its a popular request, so here we go! | + | |
- | + | ||
The LCDs we sell at Adafruit have a low power LED backlight, run on +5v and require only 6 data pins to talk to. You can use **any** data pins you want! | The LCDs we sell at Adafruit have a low power LED backlight, run on +5v and require only 6 data pins to talk to. You can use **any** data pins you want! | ||
Line 16: | Line 13: | ||
<class table> | <class table> | ||
- | |[[http://www.ladyada.net/images/parts/attiny2313dip.jpg|{{ http://www.ladyada.net/images/arduino/diecimilla.jpg?nolink&230x172 |}}]]|Assembled Arduino board, preferrably a Duemilanove, or Diecimila (or whatever the latest version is) but NG is OK too |[[http://www.adafruit.com/index.php?main_page=product_info&cPath=17&products_id=50|Adafruit]] \\ $30| | + | |[[http://www.ladyada.net/images/parts/attiny2313dip.jpg|{{ http://www.ladyada.net/images/arduino/diecimilla.jpg?nolink&230x172 |}}]]|Assembled Arduino board, preferrably a Duemilanove, or Diecimila (or whatever the latest version is) but NG is OK too |[[http://www.adafruit.com/products/50|Adafruit]] \\ $30| |
- | |[[http://www.ladyada.net/images/parts/10MHzcermosc.jpg|{{ http://www.ladyada.net/images/arduino/usbcable.jpg?nolink&232x174 |}}]]|USB Cable. Standard A-B cable is required. Any length is OK. |[[http://www.adafruit.com/index.php?main_page=product_info&products_id=62|Adafruit]] \\ Or any computer supply store \\ $4| | + | |{{ http://www.ladyada.net/images/arduino/usbcable.jpg?nolink&232x174 |}}|USB Cable. Standard A-B cable is required. Any length is OK. |[[http://www.adafruit.com/index.php?main_page=product_info&products_id=62|Adafruit]] \\ $4| |
- | |{{ http://www.ladyada.net/images/arduino/lcdtut/parts_t.jpg?nolink |}}|Character LCD with parallel interface \\ The one from Adafruit comes with extra parts below|[[http://www.adafruit.com/index.php?main_page=product_info&cPath=37&products_id=181|Adafruit]] \\ $12| | + | |{{ http://www.ladyada.net/images/arduino/lcdtut/parts_t.jpg?nolink |}}|Character LCD with parallel interface \\ The one from Adafruit comes with extra parts below|[[http://www.adafruit.com/index.php?main_page=product_info&cPath=37&products_id=181|Adafruit]] \\ $10| |
- | |{{ http://www.ladyada.net/images/parts/headerm36_t.jpg?nolink&200x84 |}}|Strip of 0.1" header - at least 16 pins long \\ This comes with the Adafruit LCD's but if you got some elsewhere you'll want to buy some|[[http://www.ladyada.net/wiki/partselector/header#male_header|Generic]]| | + | |{{ http://www.ladyada.net/images/parts/headerm36_t.jpg?nolink&200x84 |}}|Strip of 0.1" header - at least 16 pins long \\ This comes with the Adafruit LCD's but if you got some elsewhere you'll want to buy some|[[https://www.adafruit.com/products/392|Adafruit male header pack]]| |
- | |{{ http://www.ladyada.net/images/parts/bbpot_t.gif?nolink&151x120 |}}|10K linear potentiometer \\ The one that comes with the Adafruit kit is perfect, but you can use any 10K potentiometer or trimmer|[[http://www.ladyada.net/wiki/partselector/pots|Generic]]| | + | |{{ http://www.ladyada.net/images/parts/bbpot_t.gif?nolink&151x120 |}}|10K linear potentiometer \\ The one that comes with the Adafruit kit is perfect, but you can use any 10K potentiometer or trimmer|[[https://www.adafruit.com/products/356|Adafruit]]| |
- | |{{ http://www.ladyada.net/images/tools/100ftsolid_t.jpg?nolink&150x150 |}}|Hookup Wire \\ Make sure its //not// stranded wire!| Any hardware store | | + | |{{ http://www.ladyada.net/images/tools/100ftsolid_t.jpg?nolink&150x150 |}}|Hookup Wire \\ Make sure its //not// stranded wire!| [[https://www.adafruit.com/products/153|Adafruit]] | |
</class> | </class> | ||
Line 96: | Line 93: | ||
[[http://www.ladyada.net/images/arduino/lcdtut/bbpower.jpg|{{ http://www.ladyada.net/images/arduino/lcdtut/bbpower_t.jpg?nolink&500x375 |}}]] | [[http://www.ladyada.net/images/arduino/lcdtut/bbpower.jpg|{{ http://www.ladyada.net/images/arduino/lcdtut/bbpower_t.jpg?nolink&500x375 |}}]] | ||
- | Next we'll connect up the backlight for the LCD. Connect pin 16 to ground and pin 15 to +5V | + | Next we'll connect up the backlight for the LCD. Connect pin 16 to ground and pin 15 to +5V through a series resistor. To calculate the value of the series resistor, look up the maximum backlight current and the typical backlight voltage drop from the data sheet. Subtract the voltage drop from 5 volts, then divide by the maximum current, then round up to the next standard resistor value. For example, if the backlight voltage drop is 3.5v typical and the rated current is 16mA, then the resistor should be (5 - 3.5)/0.016 = 93.75 ohms, or 100 ohms when rounded up to a standard value. If you can't find the data sheet, then it should be safe to use a 220 ohm resistor, although a value this high may make the backlight rather dim. |
[[http://www.ladyada.net/images/arduino/lcdtut/backlitepower.jpg|{{ http://www.ladyada.net/images/arduino/lcdtut/backlitepower_t.jpg?nolink&500x375 |}}]] | [[http://www.ladyada.net/images/arduino/lcdtut/backlitepower.jpg|{{ http://www.ladyada.net/images/arduino/lcdtut/backlitepower_t.jpg?nolink&500x375 |}}]] | ||
Line 113: | Line 110: | ||
[[http://www.ladyada.net/images/arduino/lcdtut/potplace.jpg|{{ http://www.ladyada.net/images/arduino/lcdtut/potplace_t.jpg?nolink&500x382 |}}]] | [[http://www.ladyada.net/images/arduino/lcdtut/potplace.jpg|{{ http://www.ladyada.net/images/arduino/lcdtut/potplace_t.jpg?nolink&500x382 |}}]] | ||
- | |||
- | New Haven Displays [[http://www.newhavendisplay.com/index.php?main_page=index&cPath=119_576]] have recently released some character OLED displays which have the same 16 pin interface. The OLED displays do not require the contrast potentiometer. | ||
Connect one side of the pot to +5V and the other to Ground (it doesn't matter which goes on what side). The middle of the pot (wiper) connects to pin 3 | Connect one side of the pot to +5V and the other to Ground (it doesn't matter which goes on what side). The middle of the pot (wiper) connects to pin 3 | ||
Line 283: | Line 278: | ||
Now upload this code to your Arduino to see the LCD background light swirl! ([[http://www.flickr.com/photos/adafruit/6002862732/|Click here to see what it looks like in action]]) | Now upload this code to your Arduino to see the LCD background light swirl! ([[http://www.flickr.com/photos/adafruit/6002862732/|Click here to see what it looks like in action]]) | ||
+ | |||
+ | {{ flickrvid>6002862732 }} | ||
<code C> | <code C> | ||
Line 358: | Line 355: | ||
{{ http://www.ladyada.net/images/thermocouple/thermolcd_t.jpg?nolink&500x385 |}} | {{ http://www.ladyada.net/images/thermocouple/thermolcd_t.jpg?nolink&500x385 |}} | ||
- | You can do that with the **createChar** command, and to help you out [[http://icontexto.com/charactercreator/|we're going to point you to this really great website that does the hard work for you!]] | + | You can do that with the **createChar** command, and to help you out [[http://www.quinapalus.com/hd44780udg.html|we're going to point you to this really great website that does the hard work for you!]] |