Raspberry Pi 1602 and 2004 LCD Interfacing

 

Using both 1602 AND 2004 Character LCD Modules with the Raspberry Pi – at the same time!

One of the advantages of character LCD modules is that you control multiple LCD displays with five shared GPIO’s, as long as you have a unique E clock for each LCD.

The lcd_module class takes full advantage of this, and allows you to control as many LCD modules as you can spare GPIO’s for!

To demonstrate this, I connected both the 1602 and 2004 modules at the same time.

They shared RS, D7, D6, D5, D4, but were supplied with a unique E clock.

I could easily control both LCD’s by simply instantiating two LCD objects!

1602 LCD on Raspberry Pi @ https://Mikronauts.com

(click on image for larger version)

Sample code:


  # initialize an object for the 2004 LCD
  lcd = lcd_module(2004, 17, 4, 25, 24, 23,22)

  lcd.disp(0,0,"https:/Mikronauts.com")
  lcd.disp(0,1,"20x4 character LCD's")
  lcd.disp(0,2,"make great embedded")
  lcd.disp(0,3,"status displays!")
  lcd.dec(lcd.type)

  # initialize a second lcd object for the 1602 LCD
  lcd2 = lcd_module(1602, 17, 27, 25, 24, 23,22)

  lcd2.str("Hello World!")
  lcd2.dec(lcd2.type)
  lcd2.disp(1,1,"Dual Screen Pi")

  # Note how only the E pin was different!

You could easily drive three, four or even more LCD’s if you needed to!

Download

Conclusion

Inexpensive character LCD modules are a great way of displaying status information with a Raspberry Pi.

Many data acquisition, robotics and entertainment projects can benefit from such displays – for example, you can use them to display a robot’s heading, voltage readings and much more. Media enthusiasts can use them to display media, volume and artist information from XBMC or other media centre software.

You can even use them in conjunction with an HDMI-connected TV or monitor to provide additional information without using the main display.

The only real limit is your imagination!

Related Articles

Related Links

Article Index:

  1. Introduction, Equipment Used, Connecting an LCD Module to the Raspberry Pi
  2. 1602 Character LCD Module, 2004 Character LCD Module, MikEzLCD.py library
  3. Using both 1602 and 2004 LCD Modules with the Raspberry Pi at the same time, Conclusion

Pages: 1 2 3

If you liked this article, please help us grow! "Like" us and let your friends know with the Twitter and Facebook buttons at the top left - We appreciate your support!