Difference between revisions of "LCD2004 Module"

From Wiki
Jump to: navigation, search
(Experimental Procedures)
(The Experiment for Raspberry Pi)
 
(20 intermediate revisions by the same user not shown)
Line 3: Line 3:
 
[[File:LCD2004-1.jpg]]<br>
 
[[File:LCD2004-1.jpg]]<br>
  
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 number 2004 means on the display, 4 rows can be showed and 20 characters in each.<br>
+
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.<br>
 
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.<br>
 
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.<br>
  
===Pins of LCD2004 and their functions===
+
==Pins Functions==
VSS: connected to ground<br>
+
VDD: connected to a +5V power supply<br>
+
VO: to adjust the contrast<br>
+
RS: A register select pin that controls where in the LCD’s memory you are writing data to. You can select either the data register, which holds what goes on the screen, or an instruction register, which is where the LCD’s controller looks for instructions on what to do next.<br>
+
R/W: A Read/Write pin to select between reading and writing mode<br>
+
E: An enabling pin that reads the information when High level (1) is received. The instructions are run when the signal changes from High level to Low level. <br>
+
D0-D7: to read and write data<br>
+
A and K: Pins that control the LCD backlight. Connect K to GND and A to 3.3v. Open the backlight and you will see clear characters in a comparatively dark environment. <br>
+
  
==Components==
+
[[File:lcd1602-2.jpg]]<br>
- 1 * SunFounder Uno board<br>
+
 
 +
==The Experiment for Arduino==
 +
 
 +
'''<font color="green">Components</font><br>
 +
- 1 * SunFounder Uno Board<br>
 
- 1 * Breadboard<br>
 
- 1 * Breadboard<br>
 
- 1 * LCD2004<br>
 
- 1 * LCD2004<br>
 
- 1 * Potentiometer (50kΩ)<br>
 
- 1 * Potentiometer (50kΩ)<br>
- 1 * USB cable<br>
+
- 1 * USB Cable<br>
- Jumper wires<br>
+
- Several Jumper Wires<br>
==Experimental Principle==
+
  
[[File:5-5-5.png]]<br>
 
  
Connect K to GND and A to 3.3 V, and then the backlight of the LCD2004 will be turned on. Connect VSS to GND and the LCD2004 to the power source. Connect VO to the middle pin of the potentiometer – with it you can adjust the contrast of the screen display. Connect RS to D4 and R/W pin to GND, which means then you can write characters to the LCD2004.  Connect E to pin6 and the characters displayed on the LCD2004 are controlled by D4-D7. For programming, it is optimized by calling function libraries.<br>
+
'''<font color="green">Experimental Procedures</font><br>
 
+
''<font color="red">Note:</font> Before connecting circuit, need to plug the pin headers onto a breadboard, and then put the LCD2004 on to it for easy soldering.''<br>
==Experimental Procedures==
+
''<font color="red">Note:</font> before connecting circuit, need to plug the pin headers onto a breadboard, and then put the LCD2004 on to it for easy soldering.''<br>
+
  
 
[[File:LCD2004-2.jpg]]<br>
 
[[File:LCD2004-2.jpg]]<br>
  
Step 1: Build the circuit (make sure the pins are connected correctly. Otherwise, characters will not be displayed properly):<br>
+
'''Step 1:''' Build the circuit (make sure the pins are connected correctly. Otherwise, characters will not be displayed properly):<br>
  
 
[[File:LCD2004-0.png]]<br>
 
[[File:LCD2004-0.png]]<br>
  
Step 2: Copy the follwing code to the Arduino IDE ,click to the upload icon to upload the code to the control board.<br>
+
'''Step 2:''' Download the package [http://wiki.sunfounder.cc/images/8/86/LCD2004_for_Arduino.rar  LCD2004_for_Arduino], then unzip it and open the LCD2004.ino file
<pre>
+
  
//LCD2004
+
[[File:2004-5.png]]<br>
//You should now see your LCD2004 display the characters
+
//Email:support@sunfounder.com
+
//Website:www.sunfounder.com
+
//2017.3.7
+
#include <LiquidCrystal.h>// include the library code
+
/**********************************************************/
+
LiquidCrystal lcd(4, 6, 10, 11, 12, 13);
+
/*********************************************************/
+
void setup()
+
{
+
  lcd.begin(20, 4);  // set up the LCD's number of columns and rows:
+
}
+
/*********************************************************/
+
void loop()
+
{
+
    lcd.setCursor(6,0);  // set the cursor to column 19, line 0
+
    lcd.print("LCD2004");
+
    lcd.setCursor(4,1);
+
    lcd.print("Hello world!");
+
    lcd.setCursor(2,2);
+
    lcd.print("20 cols, 4 rows");
+
    lcd.setCursor(1,3);
+
    lcd.print("www.sunfounder.com");
+
 
+
}
+
/************************************************************/
+
  
</pre>
+
'''Step 3:''' Select correct Board and Port<br>
Step 3: Select correct Board and Port<br>
+
'''Step 4:''' Upload the sketch to the SunFounder Uno board<br>
Step 4: Upload the sketch to the SunFounder Uno board<br>
+
 
''<font color="red">Note:</font> you may need to adjust the potentiometer on the LCD2004 until it can display clearly.''<br>
+
 
 +
'''<font color="green">Experimental Phenomenon</font><br>
  
==Experimental Phenomenon==
+
''<font color="red">Note:</font> You may need to adjust the potentiometer on the LCD2004 until it can display clearly.''<br>
 
You should now see the characters "LCD2004", "Hello, world!", "20 cols, 4 rows" and "www.sunfounder.com" on the LCD.<br>
 
You should now see the characters "LCD2004", "Hello, world!", "20 cols, 4 rows" and "www.sunfounder.com" on the LCD.<br>
  
 
[[File:LCD2004-3.jpg]]<br>
 
[[File:LCD2004-3.jpg]]<br>
 +
 +
==The Experiment for Raspberry Pi==
 +
 +
'''<font color="green">Components</font><br>
 +
- 1 * Raspberry Pi<br>
 +
- 1 * Breadboard<br>
 +
- 1 * LCD2004<br>
 +
- 1 * Potentiometer<br>
 +
- Several Jumper Wires<br>
 +
 +
 +
'''<font color="green">Experimental Procedures</font><br>
 +
'''Step 1:''' Build the circuit (please be sure the pins are connected correctly. Otherwise, characters will not be displayed properly):<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>
 +
 +
''<font color="red">Note:</font> 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.''<br>
 +
 +
'''Step 2:''' Transfer the package [http://wiki.sunfounder.cc/images/b/bb/LCD2004_for_Raspberry_Pi.zip  LCD2004_for_Raspberry_Pi] to the Raspberry Pi<br>
 +
<pre>
 +
wget http://wiki.sunfounder.cc/images/b/bb/LCD2004_for_Raspberry_Pi.zip
 +
</pre>
 +
 +
'''Step 3:''' Extract the package<br>
 +
<pre>
 +
unzip LCD2004_for_Raspberry_Pi.zip
 +
</pre>
 +
 +
'''Step 4:''' Get into the folder of code<br>
 +
<pre>
 +
cd LCD2004_for_Raspberry_Pi
 +
</pre>
 +
 +
'''Step 5:''' Run  <br>
 +
<pre>
 +
sudo python lcd2004.py
 +
</pre>
 +
 +
 +
'''<font color="green">Experimental Phenomenon</font><br>
 +
You should see four lines of characters displayed on the LCD2004: "LCD2004", "Hello, world!", "20 cols, 4 rows" and "www.sunfounder.com".
 +
 +
[[File:2004-7.png.jpg]]<br>
 +
 +
==Resource==
 +
[http://wiki.sunfounder.cc/images/8/86/LCD2004_for_Arduino.rar  LCD2004_for_Arduino][[File:ZIP.jpg]]<br>
 +
[http://wiki.sunfounder.cc/images/b/bb/LCD2004_for_Raspberry_Pi.zip  LCD2004_for_Raspberry_Pi][[File:ZIP.jpg]]<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