Difference between revisions of "LCD2004 Module"

From Wiki
Jump to: navigation, search
(The Experiment for Arduino)
(The Experiment for Raspberry Pi)
 
(One intermediate revision by the same user not shown)
Line 52: Line 52:
 
- 1 * LCD2004<br>
 
- 1 * LCD2004<br>
 
- 1 * Potentiometer<br>
 
- 1 * Potentiometer<br>
- Jumper wires<br>
+
- Several Jumper Wires<br>
  
  
Line 58: Line 58:
 
'''Step 1:''' Build the circuit (please be sure the pins are connected correctly. Otherwise, characters will not be displayed properly):<br>
 
'''Step 1:''' Build the circuit (please be sure the pins are connected correctly. Otherwise, characters will not be displayed properly):<br>
  
[[File:2004-8.png]]<br>
+
 
 +
{| border="1" class="wikitable"
 +
|-
 +
! scope="col" | LCD1602/2004
 +
! scope="col" | SunFounder Uno board
 +
|-
 +
|align="center"|K
 +
|align="center"|GND
 +
|-
 +
|align="center"|A
 +
|align="center"|3.3V
 +
|-
 +
|align="center"|D7
 +
|align="center"|GPIO18
 +
|-
 +
|align="center"|D6
 +
|align="center"|GPIO23
 +
|-
 +
|align="center"|D5
 +
|align="center"|GPIO24
 +
|-
 +
|align="center"|D4
 +
|align="center"|GPIO25
 +
|-
 +
|align="center"|D0-D3
 +
|align="center"|No Connected
 +
|-
 +
|align="center"|E
 +
|align="center"|GPIO22
 +
|-
 +
|align="center"|R/W
 +
|align="center"|GND
 +
|-
 +
|align="center"|RS
 +
|align="center"|GPIO27
 +
|-
 +
|align="center"|OV
 +
|align="center"|Connect to the middle pin of potentiometer
 +
|-
 +
|align="center"|VDD
 +
|align="center"|5V
 +
|-
 +
|align="center"|VSS
 +
|align="center"|GND
 +
|-
 +
|}
 
[[File:2004-6.png]]<br>
 
[[File:2004-6.png]]<br>
  

Latest revision as of 03:35, 7 March 2018

Introduction

LCD2004-1.jpg

LCD2004, or 2004 character-type liquid crystal display, is a kind of dot matrix module to show letters, numbers, and characters and so on. It's composed of 5x8 dot matrix positions; each position can display one character. There's a dot pitch between two characters and a space between lines, thus separating characters and lines. The model 2004 means it displays 4 rows of 20 characters.
Generally, LCD2004 has parallel ports, that is, it would control several pins at the same time. LCD2004 can be categorized into eight-port and four-port connections. If the eight-port connection is used, then all the digital ports of the SunFounder Uno board are almost completely occupied. If you want to connect more sensors, there will be no ports available. Therefore, the four-port connection is used here for better application.

Pins Functions

Lcd1602-2.jpg

The Experiment for Arduino

Components
- 1 * SunFounder Uno Board
- 1 * Breadboard
- 1 * LCD2004
- 1 * Potentiometer (50kΩ)
- 1 * USB Cable
- Several Jumper Wires


Experimental Procedures
Note: Before connecting circuit, need to plug the pin headers onto a breadboard, and then put the LCD2004 on to it for easy soldering.

LCD2004-2.jpg

Step 1: Build the circuit (make sure the pins are connected correctly. Otherwise, characters will not be displayed properly):

LCD2004-0.png

Step 2: Download the package LCD2004_for_Arduino, then unzip it and open the LCD2004.ino file

2004-5.png

Step 3: Select correct Board and Port
Step 4: Upload the sketch to the SunFounder Uno board


Experimental Phenomenon

Note: You may need to adjust the potentiometer on the LCD2004 until it can display clearly.
You should now see the characters "LCD2004", "Hello, world!", "20 cols, 4 rows" and "www.sunfounder.com" on the LCD.

LCD2004-3.jpg

The Experiment for Raspberry Pi

Components
- 1 * Raspberry Pi
- 1 * Breadboard
- 1 * LCD2004
- 1 * Potentiometer
- Several Jumper Wires


Experimental Procedures
Step 1: Build the circuit (please be sure the pins are connected correctly. Otherwise, characters will not be displayed properly):


LCD1602/2004 SunFounder Uno board
K GND
A 3.3V
D7 GPIO18
D6 GPIO23
D5 GPIO24
D4 GPIO25
D0-D3 No Connected
E GPIO22
R/W GND
RS GPIO27
OV Connect to the middle pin of potentiometer
VDD 5V
VSS GND

2004-6.png

Note: After you run the code, characters may not appear on the LCD1602. You need to adjust the contrast of the screen (the gradual change from black to white) by spinning the potentiometer clockwise or anticlockwise, until the screen displays characters clearly.

Step 2: Transfer the package LCD2004_for_Raspberry_Pi to the Raspberry Pi

wget http://wiki.sunfounder.cc/images/b/bb/LCD2004_for_Raspberry_Pi.zip

Step 3: Extract the package

unzip LCD2004_for_Raspberry_Pi.zip

Step 4: Get into the folder of code

cd LCD2004_for_Raspberry_Pi

Step 5: Run

sudo python lcd2004.py


Experimental Phenomenon
You should see four lines of characters displayed on the LCD2004: "LCD2004", "Hello, world!", "20 cols, 4 rows" and "www.sunfounder.com".

2004-7.png.jpg

Resource

LCD2004_for_ArduinoZIP.jpg
LCD2004_for_Raspberry_PiZIP.jpg