Showing posts with label LCD. Show all posts
Showing posts with label LCD. Show all posts

Sunday, 17 January 2010

Building a Display Adapter for the HD44780 LCD

Having successfully written a library for controlling the LCD screen using a shift register I thought: "How great would it be to have a small circuit board that plugs onto the back of the LCD screen so I don't have to use valuable space on my bread board?" So I made one.

Step 1:

Start with the schematic from my last post:




Step 2:

Design the circuit layout. If I was going to make a PCB this would be quite straight forward as I created the schematic in EAGLE; I would just select 'File > Switch to board', position the components and hit autoroute. However, I am going to be using vero / strip board so I have to do the layout myself. I did it on paper, but I have re-done it using DIY Layout Creator
 


Step 3:

Cut out the board and start soldering in the components:



Once all the components are soldered in we can start placing the jumper wires:



The last thing to do is to attach the cable we will use to attach it to the arduino. I had a good length of 5 core cable from a Nintendo Gamecube controller which is perfect for this task, I just need to attach pins to the end of it so it can plug into the arduino.




Step 4:

Testing. This at least is simple. Just plug and play. Like windows, only this might actually work!



Step 5:

All I need now is a stand for it. Thankfully I have an old library card that will suffice just nicley. So two minutes work with a craft knife, a ruler and a screw driver and we have the finished product!



I know the stand looks a bit crude, but it does the job nicely.

Saturday, 16 January 2010

Controlling an LCD Display with a Shift Register

When I first ordered my Arduino Experimentation Kit from those nice people at oomlout I also ordered a 16 character by 2 line LCD display.

It was really easy to set up and use thanks to the instructions that came with it and the LiquidCrystal library bundled with the Arduino software.
The only problem is that it takes up a lot of valuable output pins, 6 in 4bit mode and 10 in 8bit mode, this makes it difficult to use in large projects, as you can quickly run out of pins.

The solution to this was quite obvious; use a shift register. So I fired up Google and had a look to see what other people had done. I found a great article on the Arduino playground (here) except I could figure out how to get their circuit to work with my shift register, as they use 74*LS*164 but I had a few 74HC595 registers knocking about. I also tried the other article on Arduino playground, but that one doesn't work very well, as it has large delays in it and you have to make sure that data you are sending to it is in the correct format (for example, it doesn't like numbers, you have to convert them into strings first)

So, here are my goals
  • Operate the LCD screen using a shift register
  • Use no more than three data pins
  • Maintain full compatibility with the LiquidCrystal library

The first two these are quite simple. Use the circuit below for a 4bit interface:


This circuit will allow us to control the output of the display, as well as the LED backlight. The backlight is controlled by an N-Channel MOSFT connected to pin QF on the shift register. We are using a MOSFET because the input impedance of the MOSFET is very very high which makes it ideal for using in logic circuits.

To meet the third goal I decided to modify the LiquidCrystal library. The reason being that the wonderful people who wrote it in the first place already did all the hard work of programming the methods for initialising the display and outputting data so it would be a bit daft to re-write all of that when all that is really needed is to change the way that the LiquidCrystal library sends data to the display.

After a couple of hours I had successfully rewritten the 'send', 'write8bits' and 'write4bits' methods and began testing.
The image above looks very complicated, but that is because those two bread boards contain both the 8bit and 4 bit versions (the screen is plugged into the 8bit interface).

In conclusion: the shift register interface is very simple to build and not too hard to program and makes the LCD screen easier to use in your projects.


You can download my completed ShiftLCD Library here