EAGLE library for 16X2 and 20X4 LCDs

These are the parts that I have used for quite some time for all circuit boards I designed that have LCDs. Free for the grab but please check the dimension of your LCD before using them as some suppliers have smaller/larger mounting holes and not all LCDs have the holes at the same locations. Some parts have only 3 mounting holes since the bottom right corner of the LCD would be right above the GPS connector on phi-2 shields. The 16X2 LCD with connectors on bottom left have been used for some projects too.

Link: http://code.google.com/p/phi-prompt-user-interface-library/downloads/detail?name=HD44780LCD.lbr&can=2&q=#makechanges

Super font upgraded

Now the super font is also upgraded to Arduino 1.0 compatible. Please find the library and sample code on the google code page:

http://code.google.com/p/phi-big-font/downloads/detail?name=phi_super_font%2020120322.zip&can=2&q=#makechanges

Big is back!

My phi_big_font library supports displaying big 3*5 dot matrix characters and numbers on HD44780 character displays. Since arduino has upgraded to 1.0, there have been constant requests to get this library upgraded to support arduino 1.0

I’ve finally done it! Please get the most recent version on my google code site:

http://code.google.com/p/phi-big-font/downloads/detail?name=phi_big_font%2020120322.zip&can=2&q=#makechanges

Don’t forget if you really really like my libraries, donate $5 to my cause.  Thanks!

BTW, I’ll make some changes to phi_super_font to upgrade it to arduino 1.0 compatible too.

Generate character LCD images for illustration

Add to FacebookAdd to DiggAdd to Del.icio.usAdd to StumbleuponAdd to RedditAdd to BlinklistAdd to TwitterAdd to TechnoratiAdd to Yahoo BuzzAdd to Newsvine

The above are definitely not pictures I took on my LCD but look just like one, only much better. How did I make them? I have recently made a Phi-1 shield with 16X2 character LCD on it. Here is a way I found to generate perfect character LCD images for manuals. How did I make them? I used Word.

First install the Ericsson font from dafont lcd font page 7: http://www.dafont.com/theme.php?cat=302&page=7

Then in Word, type the message you want, and pad with enough characters so both lines are 16 characters. Say if you want “Read data list”, you want to type “Read data listaa”. Then select everything, then use green high lighter. Then choose the padding “aa”, use the same green as the font color so they will be invisible and all you see is “Read data list [2 spaces]”. Tada!

Here is more illustration:

How to connect Arduino with a character LCD

A character LCD can be pretty useful to an Arduino project since Arduino has no display itself. You see them everywhere: vending machines, laser printers, fax machines, etc. You can use the serial port to output information to a PC but that ties the Arduino to a computer. Arduino can do a lot without a PC, taking data and interacting with a user at the same time.

There are many types of LCD, color, mono, dot-matrix, character. A color LCD is always dot-matrix. Some even has touch sensors. We won’t need a color display since information we will display won’t be more useful with a fancy display. The more complex the display gets, the more resources it consumes. An arduino has 20 general I/O lines. A character display uses 6, a dot-matrix display uses 14. In order to use a color dot-matrix display, a microcontroller needs a lot  of memory and send a lot of data to the display, neither of which is what Arduino is best for. The simpler, the better. We will use a mono character display. We need a display for information.

Once in a while you see a teaching equipment company comes up with a handheld all-in-one lab measurement equipment with color display and touch screen. It’s tempting but most of the function it does like spreadsheet, and calculation, can be much better done with even an entry-level netbook. So we’re better off letting what lab equpiment does best, measurement, and leave data analysis to a PC. Enough of unhappy feelings towards teaching equipment companies.

Back to how to hook up a 16 column X 2 row character display.

You can find a very cheap one here:

http://www.dipmicro.com/store/LCD-1602A-Y



Make sure you pick up some male header pins and a 10KOhm potentiometer:

http://www.dipmicro.com/store/HEADS40T

http://www.dipmicro.com/store/R4V10-3386

An LCD has a total of 16 pins. Here is a list of all pins and functions:

Pin 1 GND

Pin 2 +5V

Pin 3 Contrast

Pin 4 RS (Register select)

Pin 5 R/W (Read or write)

Pin 6 EN (Enable signal)

Pin 7~Pin14 D0~D7 (Data)

Pin 15 A (Anode of back light LED)

Pin 16 C (Cathode of back light LED)

Luckly we only need to connect 6 of above pins to Arduino, and 5 additional pins to +5V, ground, or potentiometer.

If you want to do this on a breadboard, you will need some soft jumper wires.

First, you need to solder the male header pins to the LCD. Just break away 16 pins from your 40-pin male header pins, push them through the LCD pin holes and use possibly this iron (http://www.radioshack.com/product/index.jsp?productId=2062758). If you can’t find this in your local store, find a similar one around 30W and a sharp tip.

The LCD won’t stand well on its own with the pins. My trick is to take a piece of eye-glass cleaning cloth, fold it a couple of times, then stick it underneath the LCD as support. First heat up your iron for at least 3 minutes. Then add a little bit of solder to the tip. Wipe excess with sponge. Stick the tip of your iron against the first pin. The first pin takes a while to heat up. Just patiently count to 15. Bring the solder to the pin not the tip of the iron. If the solder melts, good, add around 1/4 inch of solder, wait for the solder to grab on the pin and get sucked in the pin hole. Move on to the next pin. If the solder doesn’t melt, don’t force it against the iron, just wait a few more seconds. When the pin and the hole are both hot enough, the solder will stick or wet them. The curvature is just the opposite when you force melted solder against cold pin.

Finish off all the pins. Check for shorts.

Now push your LCD into your breadboard, keep your Arduino near the LCD. Use a couple of jumper wires, bring the +5V and GND to the breadboard’s power rails. Add the potentiometer near the LCD pin 1. Connect left pin to +5V and right pin to GND. Connect the following LCD pins:

Pin 1 GND

Pin 2 +5V

Pin 3 middle of the potentiometer

This should power the LCD logic and contrast.

Now turn the potentiometer until you can see a row of black boxes on the display. This confirms that your display is working.

Now connect the following LCD pins:

Pin 15 +5V

Pin 16 220 Ohm resistor

The other side of the resistor goes to GND.

This should power up the LCD back light. If the back light is too dim, reduce the value of the resistor. Don’t connect Pin 16 directly to the ground. Doing so will reduce the life time of the back light by a lot. Most spec sheets tell you what to do regarding series resistors on back light. In doubt, try a 150 Ohm. Then gradually dial up or down the number (with a pot) to find the brightness you need.

I would turn my lights off at night and dial the brightness just enough for comfortable viewing in the dark. In this case the back light is not visible in well-lit rooms, which doesn’t need back light in the first place.

Now connect the following LCD pins to Arduino pins:

Pin 4 RS to Arduino digital Pin 7 (green on the left)

Pin 5 R/W to GND

Pin 6 EN to Arduino digital Pin 6 (orange on the left)

Pin 11~Pin14 D0~D7 (Data) to Arduino digital Pins 5~2. (blue, green, orange, white)

From left to right on LCD, black(GND), red (5V), blue (potentiometer middle), green(RS),orange(GND),another orange(EN, sorry running out of jumper wires), not connected (next 4 pins), blue, green, orange, white (D4-D7), red(5V), resistor (to GND)

We don’t need all 8 data pins. The LCD can work at 4-bit data mode, which saves 4 Arduino pins.

Now load the HelloWorld example code in Arduino IDE under examples->LiquidCrystal.

Make sure you change the line with LiquidCrystal(x,x,x,x,x,x); to LiquidCrystal lcd(7, 6,  5, 4, 3, 2);

Compile the sketch and upload it to Arduino. It should show “hello, world” and followed by a second count. If you’ve gone this far, you’ve made it. Go ahead and load more examples and modify them to learn how to work with the LCD. It’s easy, like LCD.print(“This is a message”);

If you want a more permanent installation of an LCD, instead of 12 loose wires, look at my Phi-1 shield. You can directly plug the LCD on the shield to make connection or take it off for a different project.

%d bloggers like this: