In this short tutorial we make an Arduino LCD shield.
Today we are going to make an Arduino shield with an LCD module. More often than not I have needed to use an LCD shield in one of my projects, or with the Arduino tutorials. Naturally you can buy a pre-made one, however doing your own is always fun and nice way to pass an afternoon. Before we start, let me say this: “to fail to plan is to plan to fail”. That saying is very appropriate when it comes to making your own shields.
The first step is to gather all of the parts you will need. In this case:
- an LCD module (backlit if possible, but I’m being cheap and using a non-backlit module) that is HD44780-compatible
- a 10k linear trimpot, used to adjust the LCD contrast
- a blank protoshield that matches your Arduino board
- various header pins required to solder into the shield (they should be included with your protoshield)
- plenty of paper to draw on
Next, test your parts to ensure everything works. So, draw a schematic so you have something to follow:
And then build the circuit on a solderless breadboard, so you can iron out all the hardware bugs before permanently soldering into the shield. If you have a backlit LCD, pins 15 and 16 are also used, 15 for backlight supply voltage (check your data sheet!) and 16 for backlight ground:
Once connected, test the shield with a simple sketch – for example the “HelloWorld” example in the Arduino IDE. Make sure you have the library initialization line:
filled with the appropriate parameters. If you’re not sure about this, visit the LCD display tutorial in my Arduino tutorials.
Now to make the transition from temporary to permanent. Place your components onto the protoshield, and get a feel for how they can sit together. Whilst doing this, take into account that you will have to solder some jumper wires between the various pads and the digital pin contacts and the 5V strip at the top row, as well as the GND strip on the bottom row. You may find that you have to solder jumper wires on the bottom of the shield – that’s fine, but you need to ensure that they won’t interfere with the surface of your Arduino board as well.
Furthermore, some protoshields have extra functions already added to the board. For example, the shield I am using has two LEDs and a switch, so I will need to consider wiring them up as well – if something is there, you shouldn’t waste the opportunity to not use them. If your shield has a solder mask on the rear, a great way to plan your wiring is to just draw them out with a whiteboard marker:
Remember to solder these wires in *before* the LCD … otherwise you will be in a whole world of pain. The LCD should be soldered in second-last, as it is the most difficult thing to desolder if you have made any mistakes. The last items to solder will be the header pins. So let’s get soldering…
After every solder joint, I pushed in the LCD module – in order to check my placement. You can never check too many times, even doing so I made a small mistake. Having a magnifying glass handy is also a great idea:
Now just to soldier on, soldering one pad at a time, then checking the joint and its relationship with where it should be on the board. Be very careful when applying solder to the pads, they can act as a “drain” and let lots of solder flow into the other side. If this happens you will spend some time trying to remove that excess solder – a solder sucker and some solder wick is useful for this.
Finally all the wires and pads were connected, and I checked the map once more. Soldering in the LCD was the easiest part – but it is always the most difficult to remove – so triple check your work before installing the display. Now it was time to sit in the header sockets, and test fit the shield into my arduino board. This is done to make sure there is sufficient space between the wires on the bottom of our shield and the top of the arduino:
Even though you wouldn’t normally put a shield on top of this shield, I used the header sockets to allow access to all of the arduino pins just in case. Soldering the sockets was easy, I used blu-tack to hold them into place. Crude but effective.
And we’re finished. Soldering is not the best of my skills, so I checked continuity between the pins on the LCD and where they were supposed to go, and also electrically checked for bridges between all the soldered pins to check for shorts. A multimeter with a continuity buzzer makes this easy. Naturally I had a short between LCD pin 14 and 13, but some solder wick helped me fix that. So electrically it was correct… time to see if it actually worked! At this point it is a good idea to clear up the workspace, switch off the soldering iron, put it somewhere safe to cool down, then wash your hands thoroughly. Here are some photos of the finished product on my arduino board:
As we’re using a Freetronics protoshield with onboard LEDs, the only thing to do was alter the demonstration sketch to take account for the pin placements, and insert some code to blink the LEDs.
LCD module shield test sketch
Created 20/05/2010 --- By John Boxall --- http://tronixstuff.com --- CC by-sa v3.0
Just send some random numbers to the LCD
#include <LiquidCrystal.h> // we need this library for the LCD commands
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
// LCD pins 4, 6, 11, 12, 13, 14 to Arduino digital pins 7, 8, 9, 10, 11, 12
float noisy = 0;
lcd.begin(16, 2); // need to specify how many columns and rows are in the LCD unit
randomSeed(analogRead(0)); // reseed the random number generator with some noise
I never need an excuse to make a video clip, so here is the result:
So there you have it. With a little planning and care, you too can make your own Arduino shield. An LCD shield would be useful for everyone, as they are great for displaying data and requesting input, yet quite fiddly to use with a solderless breadboard. High resolution photos are available on flickr.
In the meanwhile have fun and keep checking into tronixstuff.com. Why not follow things on twitter, Google+, subscribe for email updates or RSS using the links on the right-hand column? And join our friendly Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other – and we can all learn something.