Posts | Comments

Planet Arduino

Hello readers

In this article you can follow the process of making another LCD shield for the Arduino Duemilanove or compatible boards. In the past (which explains the word another in this title) I made a 16 x 2 character LCD shield, however it was not backlit, nor large enough. Recently I acquired a 20 x 4 character backlit LCD for use in my Arduino tutorials, therein making this project necessary. To refresh your memories, here is the original shield:

However this time, I cannot mount the display on the shield, it is just too large. Furthermore, it is preferable to be able to stack other shields on top of the new LCD shield. Therefore the display will be external and connected with lengths of wire. So time to get cracking. The first step was to assemble all the parts together. The new LCD has a standard 16-pin  HD44780 interface, and is very easy to connect:

What we have: one 20×4 character backlit LCD, a Freetronics basic protoshield, some stacking pin headers, a button, 10k ohm trimpot for contrast adjustment, and some spacers and matching screws to give the LCD some legs. Afterwards I got some 0.1uF ceramic capacitors as well, to smooth supply current on the 5V rail of the shield. Here is the data sheet for the LCD: 2004 LCD.pdf.

As usual the first thing to do was to make a plan. The LCD interface is easy enough, but I still like to have something on paper to refer to:

The next step is to breadboard it – to make sure it works. However I did solder in the wires to the LCD at this stage:

And after assembling the circuit, a brief test:

Success. The demonstration sketch is the example provided with the Arduino IDE, modified for a 20×04 LCD – 2004LCDdemo.pdf. During the test above, I used an external 5V power supply for the breadboard. Remember to connect the ground line from the Arduino to the ground line of your breadboard, otherwise it will not work. At this point I was wondering how much current the LCD used by itself. The data sheet claimed it was five milliamps… I think not. Mr Multimeter had a different opinion:

Now it was time to finish the soldering work. Instead of trying to jam all the wires together along the digital pins, I used some wire jumpers to spread out the landing points for the wires from the LCD.

Furthermore, I decided to install a power LED and 560 ohm resistor – you can never have too many LEDs. :) The rear of the protoshield was also quite neat, dollops of solder easily bridged pads when required. Then after a visual inspection it was time to solder in the header pins. The easiest way to do this is to use an existing shield:

After soldering in the pins, the first attempt of using the display was unsuccessful. I had confused a couple of wires, but some reprogramming of the sketch fixed that. (It was Saturday night and my eyes were tired). But once the error had been fixed – success!

If this shield/display needed a name, I would call it the Dog’s breakfast. Now, hardware is only half of the solution – there are one or two things to take into account when writing your sketch. If you do not have the latest version of the Arduino IDE (v18), upgrade so you will have the new LiquidCrystal library. Also, when using .setCursor(x,y); to position the cursor, the top left position on the LCD is 0,0; and the bottom right is 19,3. For example, the image below was created by:

lcd.setCursor(0, 0);
lcd.print("A");
lcd.setCursor(1,1);
lcd.print("B");
lcd.setCursor(2,2);
lcd.print("C");
lcd.setCursor(3,3);
lcd.print("D");

Now to make something slightly more useful to take advantage of the screen area – another clock! (I like clocks) using my DS1307 real time clock shield. Here is the sketch: worldclock.pdf, (doesn’t allow for DST) and an action shot:

Question – from which organisation did my LCD module come from? :)

So there you have it. Another way to use an LCD with an Arduino, and show how you can do things yourself.

If you have any questions at all please leave a comment (below). We also have a Google Group dedicated to the projects and related items on the website – please sign up, it’s free and we can all learn something. High resolution photos are available from flickr. This article is a guide – always check your own work before committing to construction.

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



Comments are closed.



  • Newsletter

    Sign up for the PlanetArduino Newsletter, which delivers the most popular articles via e-mail to your inbox every week. Just fill in the information below and submit.

  • Like Us on Facebook