Back Forum New

Arduino Serial 1602 LCD

LCD screen is a character 1602 which is often used in the production of electronics and of course it's a simulation.It can be used to display two rows of characters, and each row is 16 characters:



However, to control such a common module is not so easy. First of all, we must occupy the corresponding Arduino pin according to its 4 lines work mode or 8 lines work mode, but this actually occupied more digital I/O pin, especially 8 lines connection mode. Second,although there are corresponding libraries to support,but you should pass the debug,and run on Arduino successfully, at the same time it can meet a lot of problems. Finally, the code to control LCD need take up corresponding memory space, which is difficult for 16K memory space of Arduino.

In order to solve these problems, we have designed this type of serial LCD module based on 1602 characters.To compared with the method before,the advantage is obvious:

1、Adopt serial port to control,to cut down the number of cables linking to the hardware;
2、Do not occupy the memory space of Arduino;
3、To minimize the debugging time through successfully verifying the code.



It can be easily connected with Arduino through sensor extended shield and special sensor cable.



In order to demonstrate its function, you can connected a button module on sensor extended shield , when push the button, Arduino will send corresponding controlling order through serial LCD. When this module is powered ,the effect shown as below:



The Arduino Code is :
  1. int switchPin = 7; // set the digital interface 7 as the interface of big button interface
  2. int value = 0;
  3. void setup()
  4. {
  5.   Serial.begin(9600); // set the baud rate as 9600
  6.   pinMode(switchPin, INPUT); // set the digital interface 7 as input mode
  7. }

  8. void loop() {
  9.   if (HIGH == digitalRead(switchPin)) // if the switchPin is high , then go on following command
  10. {
  11.     Serial.print("$CLEAR\r\n");   //clear screen
  12.     Serial.print("$GO 1 1\r\n");  // display address is : the line 1,the row 1
  13.     Serial.print("$PRINT Emartee  EDA\r\n");  // display the character "Emartee  EDA"
  14.     Serial.print("$GO 2 4\r\n");  // display address is : the line 2,the row 4
  15.     Serial.print("$PRINT Hello World!\r\n");  // display the character "Hello World!"
  16.     Serial.print("$CURSOR 1 1\r\n");  // CURSOR move to line 1 , row 1
  17.   }
  18. }
Copy Code
You can see that all serial port order to control LCD begin with "$"and end by "\r\n " when compared with this code,Both of them is corresponding order and parameters,different commands with different parameters.

"r" means (the current cursor movement to first line , do not move to the next line)

"n" means (the current cursor movement to the next line , do not move to the  first line)

Command Definition :


1、"GO" is cursor movement.

2、"PRINT" is to display the serial characters on the cursor position.

3、"CLEAR" is to clear screen .

4、"HOME" is to move the cursor to the initial position of the top left corner of the screen.

5、"CURSOR" is to set the effect of  cursor, the first parameter is whether display cursor (1 and 0), the second parameter is whether blink cursor (1 and 0).

Command List
:
  1. 1)  Serial.print("$CLEAR\r\n")  means "clear screen"

  2. 2)  Serial.print("$GO Line(1 or 2) Row(1 to 16)\r\n")

  3. 3)  Serial.print("$PRINT Display the characters \r\n")

  4. 4)  Serial.print("$GO Line(1 or 2) Row(1 to 16)\r\n")

  5. 5)  Serial.print("$PRINT Display the characters\r\n")

  6. 6)  Serial.print("$CURSOR 1 1\r\n")
Copy Code
Example :
  1. Serial.print("$CLEAR\r\n")

  2. Serial.print("$GO 1 1\r\n")

  3. Serial.print("$PRINT Emartee EDA\r\n")

  4. Serial.print("$GO 2 4\r\n")

  5. Serial.print("$PRINT Hello World!\r\n")

  6. Serial.print("$CURSOR 1 1\r\n")
Copy Code
When Arduino detect that the button was pushed down, it will send the corresponding commanding order of connectting to the serial LCD and the effect is shown as below:

Hello,
I buy a Arduino Serial 1602 LCD ( V3.0), but it is not like the photo.
it have  five dip switch on the back and a 2x3 pin connector .

I don't find any doc for switch configuration, and for the connector !.
please help me ...

PS: it work fine, but how can i print a variable on the lcd

TOP

Dear sir
  We have update the schematic diagram on http://www.emartee.com/product/4 ... ial-LCD-1602-Shield  , and you will get the information you need through download the schematic diagram .
  Hope this will help you.
Regards

TOP

3# emartee

I finially derived the solution to no output to Serial LCD
shield just before you posted the correct code...

It is working great now...

note:
If code doesn't upload...
one solution is to disconnect the Serial LCD....
upload the code...
then reconnect Serial LCD...

TOP

,
If code doesn't upload...
one solution is to disconnect the Serial LCD....
upload the code...
then reconnect Serial LCD...


Nice tips, everyone can refer, thanks for your share.
Regards

TOP

how to print a variable ???
i find this solution to print a variable

Serial1.print("$Print i=");
Serial1.print( i);
Serial1.print ("\r\n");

is there another solution more efficient ?

thanks

TOP

Hello,
I test you code to print variable but it doesnt run!
Do you have another solution now?
is it possible to update code in the  Arduino Serial 1602 LCD
(°^°)

TOP

hi is possible to change the serial port speed 9600 to 2400
thanks
ok...ok....ok...

TOP

I just bought one of your kits. The Arduino Mega2560 kit for $110.00.

I have a question. I got the LCD 1602 that came with the kit, but in reading further:

"It can be easily connected with Arduino through sensor extended shield and special sensor cable."

It appears I have to buy the above also, to make it work? Is that correct?

Jerry

TOP

Back Forum