Monday, October 4, 2010

Quick Project – Arduino Backlit LCD shield

Hello everyone

Once more a future project has required another type of LCD shield, so today you can follow along and see how simple it is to make your own Arduino LCD shield. In the past I have made a few however they used Arduino digital pins above nine – which is not good for GPS or microSD card shields, as they use pins ten to thirteen. As usual, please read the article before starting any work…

So time to make another shield…

Our LCD is a two line, sixteen character backlit LCD. It has a typical HD44780-compatible interface, which makes it very easy to use with Arduino. The other parts required are laid out along with the LCD:

We have the LCD, a Freetronics Protoshield Basic, a button, a 0.1 uF capacitor and some header pins. We also need some solid core, thin wire to make some jumpers.

Next is the plan – our schematic. Even for the smaller projects, this is a wise step. You can iron out the bugs before soldering. From experience with these backlit LCDs, there are two ways to wire them up. Either with a trimpot so you can adjust the display contrast, or without. With my example screen, the display was only clear with the trimpot turned all the way to one side, however your screen may vary.

Please note that the voltage for LCD backlights can vary, some are 5V, some are 3.3V. Check your data sheet and plan accordingly!

Consider the following schematics:

and

It would be wise to test your LCD using the setup on pin 3 as shown in the second schematic. Then you will have a good idea about the display brightness and contrast. This was done with the usual breadboard setup, but not before soldering the pins into the LCD:

which allowed the LCD to slot into the breadboard nicely:

The brightness shown in the image above is satisfactory, so I measured the resistance between each of the outside pins of the trimpot and the centre. The resulting resistance between the centre and ground was around 15 ohms, so basically nothing. So for this LCD, there will not be any adjustments – and the full schematic above will be used (with LCD pin 3 going straight to GND).

The sketch to drive this LCD is quite simple, for example this will do:

/* LCD shield test October 2010 tronixstuff.com/projects - CC by-sa v3.0 liquidCrystal library originally added 18 Apr 2008 by David A. Mellis library modified 5 Jul 2009 by Limor Fried (http://www.ladyada.net) */ #include <LiquidCrystal.h> // we need this library for the LCD commands // initialize the library with the numbers of the interface pins LiquidCrystal lcd(4,5,6,7,8,9); // this line will stay the same for this shield void setup() { lcd.begin(16, 2);             // need to specify how many columns and rows are in the LCD unit lcd.clear(); } void loop() { lcd.println("tronixstuff.com "); lcd.setCursor(0,1); lcd.println("/projects       "); delay(60000); lcd.clear(); }

For more information about using LCD modules with your Arduino, please refer to chapter two of my tutorials.

The next step is to consider the plan for the shield. Thankfully this is a pretty simple operation, and minimal extra components to worry about. There is a catch with regards to the LCD module itself, it has six large metal tabs that need to be avoided if the LCD is to sit flush on the shield:

Kudos to the engineers who had the pinouts printed on the back of the LCD. Thanks!

You can see that one of the tabs has been … removed. Just carefull use a pair of pliers and bend it slowly back and forth. Metal fatigue will take care of the rest. Anyhow, back to the shield. It is a simple task of soldering in some jumper wires to connect LCD pins 4, 6, 11~14 to the Arduino digital pins 4~9:

Also during this stage the reset button and the 0.1 uF capacitor were soldered in. When fitting the capacitor, leave around 5mm of length above the board, so you can push it over to one side, this is to give the LCD enough clearance. Furthermore, the lead from the 3.3V pad to LCD 15 is curved so as to avoid another metal tab on the rear of the LCD. The underside of the shield is quite simple:

To ensure a good solder joint when working with these shields – it is very important to heat the ring around the hole for two seconds if you need to create a solder bridge, or heat the wire for two seconds before attempting to solder it on. Otherwise you will either get a cold joint; or become frustrated and keep adding solder, at which point it leaks through to the other side and becomes a problem to remove.

Now to solder in the LCD. If you can, try and bend the LCD pins 1, 3, 5 and 16 towards the GND line, this will help when you need to connect them later. However, please be careful, if you position the LCD incorrectly you will have to basically start all over again with a new shield. When trimming the header pins, be sure to put a finger over the end to stop the cutting flying into your face:

Once you have the LCD module soldered in, and the ends trimmed – the final soldering task is to bridge the pins to the necessary points. This is relatively easy, just heat up one side of the junction and coax the solder across to the required spot. Sometimes the gap will be too large, so trim up the excess legs of the capacitor into small jumpers, say 3~4 mm long. You can then solder these in between the pads quite easily:

Now – the final soldering task. Snap off some header pins, two of six-pin, and two of eight-pin. Insert them into your Arduino or compatible board as such:

Then place your shield on top and solder the header pins to the shield. And we’re finished… well almost. Before you use the shield, use a multimeter or continuity tester to make sure none of the pins are shorted out, and generally double-check your soldering. You don’t want any mischievous short circuits ruining your new LCD or Arduino board.

Once you are satisfied, plug in your new shield and enjoy your success!

 

So there you are, another useful Arduino shield ready for action. I hope you enjoyed reading about this project, and hopefully some of you have made one as well. If you have any questions, please leave a comment in our Google Group - dedicated to the projects and related items on this website – please sign up, it’s free and we can all learn something.

High resolution images are available from flickr.

Don't forget to check out the range of fun stuff at Little Bird Electronics!

 

Otherwise, have fun, stay safe, be good to each other – and make something! :)

No comments:

Post a Comment