16 x 2 Character LCD Module (HCMODU0013 & HCMODU0038)

LCD, TFT, OLED, LED modules
admin
Site Admin
Posts: 865
Joined: Sun Aug 05, 2012 4:02 pm

16 x 2 Character LCD Module (HCMODU0013 & HCMODU0038)

Post by admin » Sat Mar 09, 2013 3:22 pm

Image


Image

LCD display module with blue/white font (transmissive) or yellow backlight/black font (transflective).
Wide viewing angle and high contrast.
Can display 2-lines * 16-characters.
Small and light appearance, easy and convenient to use.

LCD type: Character
Character type: 16 * 2
Screen size: 7.1 * 2.4cm
Character size: 3.55 * 5.95 mm
Driving voltage: 5V DC
Backlight: Blue (HCMODU0013) or Yellow (HCMODU0038)
Working temperature: 0 - 50°C


Example Arduino Sketch:

Code: Select all

/* FILE:    ARD_1602_LCD_HCMODU0013_Hello_World_Example.pde
   DATE:    09/03/13
   VERSION: 0.1

This is a simple example of how to use the Hobby Components 1602 LCD module 
(HCARDU0023). To use this module you will require the standard Arduino LCD
library which is built into the Arduino development enviroment.

This code also demonstrates the correct pin assignment for the LCD. When you 
run this program you should see a greeting message appear on the display. 


DEVICE PINOUT:

LCD      ARDUINO

VSS      GND
VDD      +5V
VO       +5V VIA POTENTIOMETER
RS       D12
RW       GND
E        D11
D4       D5
D5       D4
D6       D3
D7       D2
A        +5V 
K        GND


You may copy, alter and reuse this code in any way you like but please leave 
reference to hobbycomponents.com in your comments if you redistribute this code. This software may not be used by other sellers.

THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS LTD MAKES NO WARRANTIES, WHETHER 
EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF 
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR LACK OF NEGLIGENCE.
HOBBY COMPONENTS LTD SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR ANY DAMAGES, 
INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY 
REASON WHATSOEVER.
*/

/* Include the LCD Library */
#include <LiquidCrystal.h>


/* Create an instance of the LCD library. */
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);


void setup() 
{
  /* Initialise the LCD */
  lcd.begin(16, 2);
}

/* Main program loop */
void loop() 
{
  /* Output the test message to the LCD */
  lcd.setCursor(0,0); 
  lcd.print("HOBBY COMPONENTS");
  lcd.setCursor(0,1); 
  lcd.print("**HELLO WORLD**");

  
  /* Do nothing */
  while(1);
}

PIC Great Cow Basic 1602 LCD Example:

Code: Select all

'  FILE:    PIC_GCB_16F877a_LCD_Example
'  DATE:    07/08/14
'  VERSION: 0.1
'  AUTHOR:  Andrew Davies
'
'This program was written using the Great Cow Basic IDE for use with our PIC 
'16F8777A development board (HCDVBD0003) and our 1602 parallel LCD module 
'(HCMODU0013 or HCMODU0038) to display some example text.
'
'You may copy, alter and reuse this code in any way you like, but please leave
'reference to HobbyComponents.com in your comments if you redistribute this code.
'This software may not be used directly for the purpose of selling products that
'directly compete with Hobby Components Ltd's own range of products.
'
'THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO WARRANTIES, 
'WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED 
'WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR
'LACK OF NEGLIGENCE. HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE
'FOR ANY DAMAGES INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR 
'CONSEQUENTIAL DAMAGES FOR ANY REASON WHATSOEVER.




'Chip Settings. Assumes our 16F877A development board with with external 4MHz 
' crystal
#chip 16F877A,4

'Use LCD in 4 pin mode and define LCD pins
 #define LCD_IO 4
 #define LCD_RW PORTE.1
 #define LCD_RS PORTE.0
 #define LCD_Enable PORTE.2
 #define LCD_DB4 PORTD.4
 #define LCD_DB5 PORTD.5
 #define LCD_DB6 PORTD.6
 #define LCD_DB7 PORTD.7


'Main program 
 Main:
 
   'Clear the LCD
   CLS
   
   'Display some text on both lines
   Locate 0,5  
   Print "HOBBY" 
   locate 1,3 '
   print "COMPONENTS"

  'Do nothing
   Do Loop

 Goto Main
For a guide of how to install GCB for the PIC microcontroller please see the software section of our forum here



Disclaimer: Libraries, example code, and diagrams are provided as an additional free service by Hobby Components and are not sold as part of this product. We do not provide any guarantees or warranties as to their accuracy or fitness for purpose.

Descriptions and diagrams on this page are copyright Hobby Components Ltd and may not be reproduced without permission.

Noobie doobie doo

Re: 1602 LCD Module (HCMODU0013)

Post by Noobie doobie doo » Wed Aug 14, 2013 4:50 pm

Does the LCD module have a separate power supply to the breadboard or
does it get it's power from the Arduino board itself please?

Noobie doobie doo

Re: 1602 LCD Module (HCMODU0013)

Post by Noobie doobie doo » Wed Aug 14, 2013 4:50 pm

Does the LCD module have a separate power supply to the breadboard or
does it get it's power from the Arduino board itself please?

andrew
Site Admin
Posts: 1374
Joined: Sun Aug 05, 2012 4:15 pm

Re: 1602 LCD Module (HCMODU0013)

Post by andrew » Wed Aug 14, 2013 5:14 pm

The module requires a 5V supply. You can use either a 5V supply from your Arduino, or via a separate supply (recommended).
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

raschemmel@yahoo.com
Posts: 7
Joined: Wed Nov 06, 2013 6:38 am

Re: 1602 LCD Module (HCMODU0013 & HCMODU0038)

Post by raschemmel@yahoo.com » Wed Nov 06, 2013 6:51 am

Thank you so much for the example code !
I just got an Arduino UNO and I was having trouble finding a working example code online. Your's worked perfectly !
I'm going to try to figure out how to create a serial input character counter so I can output text 16 characters at a
time , alternating between Line 1 and Line 2.
I also want to figure out how to scroll text across the top line and then have it jump to the bottom line and
continue scrolling from left to right so it can handle an endless stream of incoming text/data.
I just started doing this a week ago so I have my work cut out for me!
Thanks again HOBBY COMPONENTS !

raschemmel@yahoo.com
Posts: 7
Joined: Wed Nov 06, 2013 6:38 am

Re: 1602 LCD Module (HCMODU0013 & HCMODU0038)

Post by raschemmel@yahoo.com » Fri Nov 08, 2013 6:31 am

I discovered that with a few modifications you can control the LCD contrast digitally by replacing the potentiometer with a wire going to digital pin 6 and adding the following to the program:
const int PIN_LCD_LED = 6; // analog
const int LCD_BRIGHTNESS = 46;
int state_lcd = LOW;

lcd.noDisplay(); // Start with LCD off // (add right after " lcd.begin(16,2);" )
and follow it with the statement

"digitalWrite(PIN_LCD_LED, state_lcd);"
analogWrite(PIN_LCD_LED, LCD_BRIGHTNESS);

The resulting setup is as follows:

void setup()
{
/* Initialise the LCD */
lcd.begin(16, 2);
lcd.noDisplay(); // Start with LCD off
digitalWrite(PIN_LCD_LED, state_lcd);

}

The only addition to the main loop is the following:

analogWrite(PIN_LCD_LED, LCD_BRIGHTNESS);
lcd.display();

(just BEFORE the line:)
/* Output the test message to the LCD */

You also need to add a 100k resistor and 1uF cap as an RC LOW PASS FILTER .
Connect the wire from digital pin 6 to one end of the resistor and connect the cap from the other end of the resistor to ground. Then remove the wire from the POT and conect the LCD Contrast pin 3 (VD) to end of the
resistor that is connected to the cap. If you connect ch-1 of an Oscope to digital-6 you'll see a 20% duty cycle [ (70uS) / (350uS) = 20%] PWM signal at the input of the RC filter and a more or less smooth 0.885Vdc analog
voltage at the output of the filter.
I really appreciated your example code and just wanted to try to give something back.

andrew
Site Admin
Posts: 1374
Joined: Sun Aug 05, 2012 4:15 pm

Re: 1602 LCD Module (HCMODU0013 & HCMODU0038)

Post by andrew » Fri Nov 08, 2013 2:19 pm

A nice little tip, I'll have to try that out myself next time I have one set up.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

raschemmel@yahoo.com
Posts: 7
Joined: Wed Nov 06, 2013 6:38 am

Re: 1602 LCD Module (HCMODU0013 & HCMODU0038)

Post by raschemmel@yahoo.com » Sun Nov 10, 2013 10:43 pm

I owe everyone an apology.
I made a stupid mistake and gave you the wrong information.
I am too embarassed to explain my error but here is the fix:
Replace the 100k resistor with a 4.7k ohm.
Connect a 1k resistor from the output of the RC filter (where the 4.7k connects to the 1uf Cap) to ground, creating a
Voltage devider with the PWM from digital pin 6 as the input and the cap connected to the center of the voltage
devider where the 4.7k connects to the 1k that goes to ground.
(the LCD VD pin stays connected to the cap)
Last but not least, change the LCD BRIGHTNESS value to 255.
This will generate a filtered 0.858Vdc for the VD pin.
Again, I apologize for my mistake.

raschemmel@yahoo.com
Posts: 7
Joined: Wed Nov 06, 2013 6:38 am

Re: 1602 LCD Module (HCMODU0013 & HCMODU0038)

Post by raschemmel@yahoo.com » Sun Nov 10, 2013 11:02 pm

FYI:
LCD-BRIGHTNESS=240 gives a 92.8% duty cycle (325uS ON, 25uS OFF). Voltage to VD pin=0.839Vdc.

Hici
Posts: 1
Joined: Thu Dec 17, 2015 6:18 pm

Re: 1602 LCD Module (HCMODU0013 & HCMODU0038)

Post by Hici » Thu Dec 17, 2015 6:48 pm

Hi All,


I'm new to this forum, even new in Arduino world. Never too late to learn new things :-)
We're having (my son and myself are doing Arduino together) an issue with the 1602 LCD module and asking some advise.
Module connected as needed. Sometimes working fine. Sometimes means: after the code uploaded and start running the display shows weird charecters. After pressing reset it continues. Or not. This issue appears randomly but 10/7 times. Except after power on. It works flawessly. And works always when powering up the module. This phenomenon happens after uploading the code or resetting the module. Whatever code uploaded all does (I tried "simple" words, counter, timer, etc). One of the codes I tried is the following:

#include <LiquidCrystal.h>
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
void setup(){

lcd.begin(16, 2);
}
void loop(){

lcd.setCursor(0,0);
lcd.print("Bekapcsolva:");
lcd.setCursor(0,1);
lcd.print(millis()/1000);
lcd.setCursor(13,1);
lcd.print("sec");


}

Any advise what to check?

Thanks ahead,
Hici

Post Reply

Return to “Display”