Reply to topic  [ 42 posts ]  Go to page 1, 2, 3, 4, 5  Next
Serial I2C LCD 1602 Module (HCARDU0023) 
Author Message
Site Admin

Joined: Sun Aug 05, 2012 4:02 pm
Posts: 650
Post Serial I2C LCD 1602 Module (HCARDU0023)
Image

Image

This 16 character by 2 line display has a very clear and high contrast white text upon a blue background/backlight. It also includes a serial I2C/IIC adaptor board pre-soldered to the back of the LCD. This means it can be controlled with just 2 I2C serial data pins (SDA & SCL) and so requires far less digital IO pins when controlled from a microcontroller. In total the module only requires 4 wires including 5V power and GND. Contrast adjustment is also provided by the daughter board via a potentiometer. If you plan to use this with an Arduino board you can download a compatible library and example sketch (see below).

posting.php?mode=edit&f=75&p=1132

Product Code HCARDU0023
Features 64mm x 14mm LCD display, supports IIC / I2C
Application DIY Arduino based project. Allows remote panel mounting. Requires only 2 IO pins.


    PINOUT
    1.....GND
    2.....VCC (+5V)
    3.....SDA
    4.....SCL


Notes:

These modules are currently supplied with a default I2C address of either 0x27 or 0x3F. To determine which version you have check the black I2C adaptor board on the underside of the module. If there a 3 sets of pads labelled A0, A1, & A2 then the default address will be 0x3F. If there are no pads the default address will be 0x27.

The module has a contrast adjustment pot on the underside of the display. This may require adjusting for the screen to display text correctly.

If pressure is applied to the I2C daughter board it is possible for it to bend and come contact with the LCD module. Please ensure when the LCD is installed in your application that no external object is applying pressure to the back of the module.



ARD_LCD_HCARDU0023_I2C_Hello_World_Example.pde

Code:
/* FILE:    ARD_LCD_HCARDU0023_I2C_Hello_World_Example.pde
   DATE:    07/09/12
   VERSION: 0.1

This is a simple example of how to use the Hobby Components I2C LCD module
(HCARDU0023). To use this module you will require the appropriate library
which can be downloaded from the modules section of our support forum at the
following location:

http://forum.hobbycomponents.com
 
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 (SPI Interface):

PIN 1: GND
PIN 2: +5V
PIN 3: SDA - Connect to Arduino analogue PIN 4
PIN 4: SCL - Connect to Arduino analogue PIN 5


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. */


/* Include the SPI/IIC Library */
#include <Wire.h>
#include <LiquidCrystal_I2C.h>


/* Initialise the LiquidCrystal library. Note that the displays will have a default I2C
    address of either 0x27 or 0x3F. Uncomment one of the lines below depending on
    the address of your module. */

//LiquidCrystal_I2C lcd(0x27,16,2);
//LiquidCrystal_I2C lcd(0x3F,16,2);


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

/* Main program loop */
void loop()
{
  /* Make sure the backlight is turned on */
  lcd.backlight();

  /* 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);
}



Image

Libraries:
Attachment:
HCARDU0023_LiquidCrystal_I2C.zip


EDIT (16/01/16): New version now works with Arduino IDE version 1.6.7
EDIT (01/12/12): New version 2.1 available. This should work with all versions of SDK

Datasheets:

Attachment:
1602_Datasheet.pdf

Attachment:
PCF8574_Datasheet.pdf




FAQ:

My screen just displays one row of squares along the top line. Is it faulty?

Image

It is normal for the module when first powered up to display a row of solid squares as show above. If your display is showing this then it is a sign that your sketch is not initialising the module correctly for some reason. Normally this is caused by one of 3 things, a bad or incorrect connection to the I2C interface on the module, an incorrect I2C address (for our modules the default address is either 0x27 or 0x37), or by far the most common cause is using an incompatible version of the LiquidCrystal_I2C library. For our screens you always use the version available for download in this post. If you have downloaded a version from elsewhere please also remember to delete it from your Arduino library folder(s) otherwise the Arduino IDE may still continue to use it.


The text of my screen is very faint

Under normal conditions text should be very clear and visible. If text on your module is hard to read this is normally caused by one of two things...

Firstly, this module requires the backlight to be on for text to be readable. If your backlight isn't on then check that there is a jumper fitted across the two pin header labelled 'LED' on the back of the module. This purpose of this jumper is to connect the 5V power to the backlight. Our modules are shipped with this jumper fitted but it is possible for it to shake loose during shipping. If the jumper is missing check the anti-static bag your module was shipped in.

If the backlight is on then see the next FAQ


My screen isn't displaying anything / my screen just displays two rows of solid squares

This could be caused by the screens contrast being set too low (no text) or too high (solid squares). On the back of the module there is a blue potentiometer, this adjusts the displays contrast. Normally our modules are shipped with it set to the ideal contrast position but in some cases it may need adjusting.



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 no 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.


You do not have the required permissions to view the files attached to this post.


Fri Sep 07, 2012 7:15 pm
Profile

Joined: Thu Nov 29, 2012 9:50 am
Posts: 1
Post Re: YwRobot Serial LCD 1602 Module (HCARDU0027)
Dear admin,

i've tried to use the V2 library but i cannot unzip the file with the following error:

Quote:
Inconsistent extfs archive


I've tried to download it multiple times but the error is the same.

Could you please check that the linked attachment is valid?


Thu Nov 29, 2012 10:58 am
Profile
Site Admin

Joined: Sun Aug 05, 2012 4:02 pm
Posts: 650
Post Re: YwRobot Serial LCD 1602 Module (HCARDU0027)
Hi,

We recently moved this forum to a new host and it looks like the move has somehow corrupted some of the attachments. We will fix this later today.

Andrew


Fri Nov 30, 2012 9:12 am
Profile
Post Re: YwRobot Serial LCD 1602 Module (HCARDU0027)
Hi
I recently got this lcd screen but without the serial thing on it in the master starter kit but for some reason i can't write to it but everything else is working
I have watched numerous tutorials online to make sure i wired it correctly but i can't find the error.
Any ideas on what could be wrong.
All help is highly appreciated.


Fri Mar 08, 2013 2:51 pm
Site Admin

Joined: Sun Aug 05, 2012 4:02 pm
Posts: 650
Post Re: YwRobot Serial LCD 1602 Module (HCARDU0027)
Hi,

We don't currently have any example code for this LCD that you can try out but we will set one up today and see if we can help you figure out what the problem is.

Andrew

EDIT:

I have now posted a new topic for this module which can be found here:

http://forum.hobbycomponents.com/viewtopic.php?f=25&t=1326&p=2603#p2603

Please use the example sketch to test your LCD. The comments contain a pinout table which you can check your connections against. If you still are unable to get it working after this please post another message in that forum.


Andrew


Sat Mar 09, 2013 12:42 pm
Profile

Joined: Wed Jun 26, 2013 4:57 pm
Posts: 2
Post Re: YwRobot Serial I2C LCD 1602 Module (HCARDU0023)
Hi,

This is my first post here so please, bare with me ;) As I do like service provided by Hobby Components store I will post some stuff to make other people life easy.
I just had my I2C Lcd delivered today and... well... It was a little bit of a struggle to get it up and runing, sample code did not work for me. So here's few tips that might save you few hours:

Lest analyse sample code provided by admin

Quote:
PIN 3: SDA - Connect to Arduino analogue PIN 4
PIN 4: SCL - Connect to Arduino analogue PIN 5


This applies sometimes and for some Arduino boards, keep in mind that if you are using Arduino Mega, you will use pins 20 and 21 marked with same symbols as those on lcd (sda/scl). If you already did some research you will find out that some people says it should be Analog pins 4 and 5 or digital 20 and 21, a lot confusing stuff if you are new to electronics.

Quote:
LiquidCrystal_I2C lcd(0x27,16,2);

This might be different for you, your display don't have to have 0x27 code, if you got the wrong code normal LCD will print gibberish instead of normal characters. You can scan your LCD for its code by simply runing I2C scanner which can be found here: http://playground.arduino.cc/Main/I2cScanner

Always make sure you are running the latest version of library, in our case you can check it up here:
https://bitbucket.org/fmalpartida/new-liquidcrystal/downloads
Also keep in mind this library overwrites the one that comes with Arduino which might cause some mess, its a good thing to get the original one renamed.

Now, some sample code that worked for me:

Quote:
/*
** Example Arduino sketch for SainSmart I2C LCD Screen 16x2
** based on https://bitbucket.org/celem/sainsmart-i2c-lcd/src/3adf8e0d2443/sainlcdtest.ino
** by
** Edward Comer
** LICENSE: GNU General Public License, version 3 (GPL-3.0)

** This example uses F Malpartida's NewLiquidCrystal library. Obtain from:
** https://bitbucket.org/fmalpartida/new-liquidcrystal 

** Modified – Ian Brennan ianbren at hotmail.com 23-10-2012 to support Tutorial posted to Arduino.cc

** Written for and tested with Arduino 1.0
**
** NOTE: Tested on Arduino Uno whose I2C pins are A4==SDA, A5==SCL

*/
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>

#define I2C_ADDR 0x27 // <<----- Add your address here. Find it from I2C Scanner
#define BACKLIGHT_PIN     3
#define En_pin  2
#define Rw_pin  1
#define Rs_pin  0
#define D4_pin  4
#define D5_pin  5
#define D6_pin  6
#define D7_pin  7

int n = 1;

LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);

void setup()
{
  lcd.begin (16,2); // <<----- My LCD was 16x2

  
// Switch on the backlight
lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
lcd.setBacklight(HIGH);
lcd.home (); // go home

  lcd.print("Wajrak");
}

void loop()
{
  // Backlight on/off every 3 seconds
  lcd.setCursor (0,1); // go to start of 2nd line
  lcd.print(n++,DEC);
  //lcd.setBacklight(LOW); // Backlight off
  delay(3000);
  lcd.setBacklight(HIGH); // Backlight on
  //delay(3000);
}



If you have any questions, please don't hesitate to ask, I covered a wide range of problems today (Installing/uninstalling libraries and missing some functions and parameters like POSITIVE) ;)
Oh and i do apologise for not posting code in [code] but the one from arduino looks way more clear.
Cheers


Wed Jun 26, 2013 7:07 pm
Profile

Joined: Tue Sep 24, 2013 6:52 am
Posts: 3
Post Re: YwRobot Serial I2C LCD 1602 Module (HCARDU0023)
I just got this display and it's excellent - does "almost" everything I wanted, however there is one thing I can't quite figure out - what's the character set?

I'm trying to access the copyright symbol, "©" and trying to use char(169) but I get garbage. Bear in mind I'm very new to all this!


Thu Sep 26, 2013 8:04 am
Profile
Site Admin

Joined: Sun Aug 05, 2012 4:15 pm
Posts: 645
Post Re: YwRobot Serial I2C LCD 1602 Module (HCARDU0023)
These type of 1602 LCD's tend to have a very limited character set and I don't believe that there is a copyright symbol. This will also be partly due to the fact that it is very difficult to display a legible copyright symbol with only 5 pixels width. As a solution you may want to look at our 2004 LCD sketch (viewtopic.php?f=39&t=1368) which shows how to create your own custom characters. We have not tested this with the 1602 LCD but we would expect it to work.

_________________
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.


Thu Sep 26, 2013 11:34 am
Profile

Joined: Tue Sep 24, 2013 6:52 am
Posts: 3
Post Re: YwRobot Serial I2C LCD 1602 Module (HCARDU0023)
Thanks Andrew - I'll give it a try and let you know how it goes.


Fri Sep 27, 2013 7:04 am
Profile

Joined: Wed Nov 06, 2013 6:38 am
Posts: 7
Post Re: YwRobot Serial I2C LCD 1602 Module (HCARDU0023)
I just got the same display, exactly like the photo posted and couldn't find any code that worked on the net. I'm new at programming so
there's no way I could do it. I saw the photo of the one with the Hobby Components URL on it an thought I hit the jackpot
so I:
1. connected the pullups to A4 & A5
2. and downloaded the zip file and copied the Keywords.txt and LiquidCrystal_I2C.h to the My Documents\Arduino\Libraries\LiquidCrystal_I2C folder 3. opened the IDE and selected Sketch\add file and selected the "ARD_LCD_HCARDU0023_I2C_Hello_World_Example"

Result: numerous compile errors.
I'm so new at this I'm probably doing something wrong.

Any thoughts?


Fri Nov 15, 2013 3:41 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 42 posts ]  Go to page 1, 2, 3, 4, 5  Next

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Thank you to phpBB.com & phpBB.ro.
Design created by Florea Cosmin Ionut.
© 2011 All contents of this site are © Hobby Components LTD