You are on page 1of 7

Home Sign Up!

Browse Community Submit


All

Art

Craft

Food

Games

Green

Home

Kids

Life

Music

Offbeat

Outdoors

Pets

Photo

Ride

Science

Tech

Controlling a character LCD with an Arduino


by baharini on October 7, 2009

Table of Contents
Controlling a character LCD with an Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Intro: Controlling a character LCD with an Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Step 1: Parts needed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Step 2:

..................................................................................................................

Step 3: Connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Step 4: Test Code 1: Hello World . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Step 5: Test Code 2: Using 2 lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Step 6: Test Code 3: Custom Characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

http://www.instructables.com/id/Controlling-a-character-LCD-with-an-Arduino/

Intro: Controlling a character LCD with an Arduino


Hello! Today I will be introducing Character LCDs and showing how to connect them to an Arduino.
It is all very simple and uses only 6 PINS TO INTERFACE WITH !

Note: the image is not mine and comes from http://www.micro-examples.com/public/microex-navig/doc/078-lcdscope.html

Image Notes
1. Custom Characters
2. Information
3. More information
4. Backlight 5. Backlight +
6. Data bus 0-7
7. Read/Write
8. Register Select
9. Contrast Connect to gnd via a pot for adjustment
10. Enable
11. Negative (-)
12. Posotive (+)
13. Backlight is here. NOTE: most displays have backlights, but this one has none.

Step 1: Parts needed


You will need the following components to perform this project:
1x '''Arduino (any kind will do)'''
1x '''HD44780 character LCD'''
'''lots of non-stranded wire'''
One 10k Potientiometer

Step 2:
LCDs are pretty usefull things.
They can be used for a project which needs to display something small, to huge machinery.
After all, they are always used for the same purpose.
I will be using a HD44780 Character LCD, with a 16x2 display. (2 lines, 16 characters per line)
They come in all sizes, from 8x2 to 40x4.
they have a 8x5 font and can use up to 8 custom characters.
These LCDs have 16 pins, but only 11 of them are for communication. we will use 6 of them for 4 bit mode.
These LCDs can be run in 4 or 8 bit mode, depending on how many pins you have.
4 bit mode is usefull for saving pins, but only has a refresh rate of 74ms
8 bit mode is usefull for a fast refresh rate (5ms), usefull for displaying custom character animations.
The image shows a few Custom Characters.
Note: the image is not mine and comes from http://www.micro-examples.com/public/microex-navig/doc/078-lcdscope.html

http://www.instructables.com/id/Controlling-a-character-LCD-with-an-Arduino/

Image Notes
1. Custom Characters
2. Information
3. More information
4. Backlight 5. Backlight +
6. Data bus 0-7
7. Read/Write
8. Register Select
9. Contrast Connect to gnd via a pot for adjustment
10. Enable
11. Negative (-)
12. Posotive (+)
13. Backlight is here. NOTE: most displays have backlights, but this one has none.

Step 3: Connections
Connect the LCD according to this picture:

Step 4: Test Code 1: Hello World


First, open the file i have added to this step.
Second, copy and paste the file into the Arduino IDE.
Lastly, click the UPLOAD TO I/O board button, or CTRL+U
if everything went to plan, it should now say "Hello World!".

File Downloads

Arduino_Hello_World.txt (336 bytes)


[NOTE: When saving, if you see .tmp as the file ext, rename it to 'Arduino_Hello_World.txt']

http://www.instructables.com/id/Controlling-a-character-LCD-with-an-Arduino/

Step 5: Test Code 2: Using 2 lines


NOTE: For this to work, you will need Arduino - 0017.
open and upload this next program.
it will now say:
Hello
World

File Downloads

Arduino_Hello_World_2_lines.txt (621 bytes)


[NOTE: When saving, if you see .tmp as the file ext, rename it to 'Arduino_Hello_World_2_lines.txt']

Step 6: Test Code 3: Custom Characters


NOTE: to use this feature, you will need Arduino - 0017 or higher.
Now what we will need to do is download LCD CUSTOM CHAR CREATOR.exe (download below)
Also open the Arduino IDE and copy and paste Arduino_custom_char_example.txt into the IDE.
Open up LCD CUSTOM CHAR CREATOR.exe and type ",0x" into the "Insert before entries" box.
Then click on the pixels to create a character. (I made a smiley)
Then, copy the hex code (highlited in the picture to this part in the IDE:
uint8_t custom_hex1[8] = {0x00,0x0A,0x00,0x11,0x0E,0x00,0x00,0x00};
NOTE: on the program, it has a comma at the beginning, so just highlight the text after the first comma, and press CTRL+C to copy.
Then click UPLOAD TO I/O BOARD

(Or CTRL+U)

Image Notes
1. Hex code, for copying to the IDE NOTE: Highlight the text and press CTRL+C to copy.
2. Type ",0x" here
3. Click on the squares to make them dark, and again to make them light

http://www.instructables.com/id/Controlling-a-character-LCD-with-an-Arduino/

File Downloads

LCD CUSTOM CHAR CREATOR.exe (2 MB)


[NOTE: When saving, if you see .tmp as the file ext, rename it to 'LCD CUSTOM CHAR CREATOR.exe']

Arduino_custom_char_example.txt (318 bytes)


[NOTE: When saving, if you see .tmp as the file ext, rename it to 'Arduino_custom_char_example.txt']

Related Instructables

Truck Lane - a
16x2 LCD
Arduino game
(video) by thedod

Arduino with
4x20 LCD and
LCD Smartie
over USB (video)
by
FrancisShanahan

Connecting an
LCD to the
Arduino by
josestude

HD44780 LCD to
I2C adapter
Assembling the
board for the
Bus Pirate by ian LCD117 Kit by
youevolve

Display lcd chip


hd44780 for pc
modding by
monex89

Comments
15 comments Add Comment

robotjam says:

Jan 26, 2010. 9:13 AM REPLY


Hi, this instructable is exactly what i have been looking for but i am having a problem downloading the custon character creator it keeps wanting to download
as a .tmp file amd my computer keeps asking if i want to go online to find a program to open it , which does not work either. I am using a Windows Vista
machine. Is this the only character creator that will work with my Arduino? Your help in this matter will be greatly appreciated.
Thank you

grampafish says:

Nov 23, 2010. 4:34 AM REPLY

change the .tmp to .exe that works for me because i had the same problem

Arduino Guy says:

Aug 3, 2010. 7:12 PM REPLY

you do know that the pot has to be connected to GND - LCD3 - +5volt. yet it will probably work your way.

thanh000 says:

Jun 24, 2010. 9:43 AM REPLY

thank, i use AVR and this help me much

zenoture says:

Apr 29, 2010. 8:10 PM REPLY


Hmm, i must be doing something wrong because when I hooked it up and ran the code, all I saw on the first line was squares, nothing else. When i was
looking at it from an angle I saw an 'o' and saw a cursor blinking but that's about it... Wired it up exactly like the image, but didn't seem to work. Also, in the
Arduino code, it says pin 11 is RW, but on the image, there is no pin 11 connected, and RW on my LCD module is actually pin 5... I tried rewiring it according
to the comments in the Arduino code, but then the boxes didn't even come up, so i'm at a loss...

thecageybee says:

Feb 5, 2010. 3:10 PM REPLY


Hi there. Hopefully I can field this one.
I've just been creating my own symbols for use on a weather station I'm making.
I've found out that the arduino IDE (0.17 at least, not sure about 0.18) and the LiquidCrystal library that comes with it is only capable of assigning 8 custom
characters.
Hopefully someone knows of a workaround or can supply us with a library.
Also, the 5x8 matrix is a technical limitation to do with how the LCD is made and controlled, completely different approach than graphical LCDs.
If you wanted to use a 6x10 matrix you'd have to make each char take up 2 charactors horizontally and 2 vertically. I guess it might be possible, but you'd
end up with an 8x1 display.
Hope I've explained this clearly enough. The Cageybee

http://www.instructables.com/id/Controlling-a-character-LCD-with-an-Arduino/

Simpson_jr says:

Mar 12, 2010. 4:59 PM REPLY

A workaround of just 8 characters.


I just received my first arduino + 20 x 4 display 6 days ago, so don't shoot me, I'm just a beginner.
As PC-programmer I normally would define all characters in the setup-part of my program, but I tried to define different characters in the loop part for my
Arduino and... it works !
Just define all characters you want in several arrays and use those to recreate the characters you want while... you're in the loop. Every time you need a
new character you'll have to recreate it. "Old" characters will be replaced by new ones, so... you'll have to recreate the old ones as well if you want to
use those again. It's probably easiest to recreate every non-standard character each time you use it.
A small example which displays a smiley with and one without a nose using the same self defined character address . I've used the pins for the display
(12, 11, 5, 4, 3, 2) as used in the arduino examples and you might need to change the setup part if you've got a different lcd-display.
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
byte smiley[8] = {
B00000,
B10001,
B00000,
B00000,
B10001,
B01110,
B00000,
};
byte nose[8] = {
B00000,
B10001,
B00000,
B00100,
B10001,
B01110,
B00000,
};
void setup() {
lcd.begin(20, 4);
}
void loop() {
lcd.createChar(0, smiley);
lcd.write(0);
delay (1000);
lcd.createChar(0, nose);
lcd.write(0);
delay (1000);
}

Simpson_jr says:

Mar 13, 2010. 2:25 AM REPLY

Already noticed some mistakes in my example, sorry...


I've connected the LCD as described on most pages of http://www.arduino.cc/. which is a little different as described in this article.
One should replace my
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

- line with

LiquidCrystal lcd(12, 11, 2, 7, 8, 9, 10);

to use the setup of this instructable.

Next, it's possible to create more as 8 characters using my routine, but I guess there still is a limit. With 5x8 pixels for each character one would need
1600 self defined characters to display all possibilities. ((5*8)^2)
Arduino will probably not be able to do that.
How ever, one should be able to create characters like the waveform-characters of this instructable by converting the outcome of analog readings
(they look analog to me) to self defined characters, that won't use much memory.
Besides, most of those 1600 characters won't be very useful anyway.

blackwellj says:

Jan 1, 2010. 2:59 PM REPLY

is there a mac version of the program?

nadav says:
I just found this site that will create characters on any OS... all you need is a web browser.
icontexto.com/charactercreator/

http://www.instructables.com/id/Controlling-a-character-LCD-with-an-Arduino/

Feb 16, 2010. 6:10 PM REPLY

VALKIR says:

Dec 31, 2009. 12:15 PM REPLY


hey, i really like this, and the char creator will prove invaluable over the next few days for me... i have a question though - the program generates code for a
5x8 or smaller matrix (addresses to be exact) , but what if i want to use it for a different matrix , say 6x10 for example , what would I have to add for aditional
"dots" that are "outside" this 5x8 matrix? i'm studying the pattern right now but as far as "outside" goes- i'm kinda stuck.

Jodex says:

Nov 22, 2009. 10:50 AM REPLY

Thank you for the instructable! It will help me if and when I buy LCD

duckythescientist says:

Nov 24, 2009. 8:09 PM REPLY


I suggest that you do buy one. I have two, and I'm very glad that I purchased them. Make sure to find cheap ones though if you don't care about the
specific colors/backlights.

Jodex says:

Dec 17, 2009. 10:10 AM REPLY

Oh sorry, can't link....=(

Jodex says:
Okay. I think I'm gonna buy that or that same but with different colors.
www1.elfa.se/elfa~ex_en/b2b/catalogstart.do

http://www.instructables.com/id/Controlling-a-character-LCD-with-an-Arduino/

Nov 24, 2009. 9:30 PM REPLY

You might also like