Reply to topic  [ 48 posts ]  Go to page 1, 2, 3, 4, 5  Next
2004 20x4 I2C Serial LCD Module (HCMODU0010) 
Author Message
Site Admin

Joined: Sun Aug 05, 2012 4:02 pm
Posts: 669
Post 2004 20x4 I2C Serial LCD Module (HCMODU0010)
Image
Image
Above image showing LCD connected to an Arduino Uno with a V4.0 sensor shield and 4 way anti-reverse cable (additional items not supplied with LCD)

I2C 2004 Serial 20 x 4 LCD Module:


This the larger version of our 16x4 LCD display. Its 24 character by 4 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 from our support (see below).



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


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.

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


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


Arduino:

For library please see attached file


Example sketch:

Code:
/* FILE:    ARD_LCD_HCMODU0010_I2C_Hello_World_Example
   DATE:    24/05/13
   VERSION: 0.1

This is a simple example of how to use the Hobby Components 20 x 4 line
I2C LCD module (HCMODU0010). To use this module you will require the
appropriate LiquidCrystal_I2C library, which can be downloaded from our support
forum:

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.
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 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 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 SPI/IIC Library */
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

/* Create some custom graphic characters to make a simple border */
uint8_t TopLeftCorner[]  = {0x00,0x00,0x0f,0x08,0x0b,0x0a,0x0a,0x0a};
uint8_t TopRightCorner[]  = {0x00,0x00,0x1e,0x02,0x1a,0x0a,0x0a,0x0a};
uint8_t BottomLeftCorner[]  = {0x0a,0x0a,0x0b,0x08,0x0f,0x00,0x00,0x00};
uint8_t BottomRightCorner[]  = {0x0a,0x0a,0x1a,0x02,0x1e,0x00,0x00,0x00};
uint8_t VerticalBar[]  = {0x0a,0x0a,0x0a,0x0a,0x0a,0x0a,0x0a};

/* 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,20,4);
//LiquidCrystal_I2C lcd(0x3F,20,4);

void setup()
{
  /* Initialise the LCD */
  lcd.begin();
  /* Transfer the custom characters into the LCD's memory */
  lcd.createChar(0, TopLeftCorner);
  lcd.createChar(1, TopRightCorner);
  lcd.createChar(2, BottomLeftCorner);
  lcd.createChar(3, BottomRightCorner);
  lcd.createChar(4, VerticalBar);
}

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

  /* Use the custom graphic characters to draw a border */
  lcd.setCursor(0, 0);
  lcd.write(0); //Write the top left graphic
  lcd.print("==================");
  lcd.write(1); //Write the top right graphic
  lcd.setCursor(0, 1);
  lcd.write(4); //Write the vertical bar graphic
  lcd.setCursor(0, 2);
  lcd.write(4); //Write the vertical bar graphic
  lcd.setCursor(19, 1);
  lcd.write(4); //Write the vertical bar graphic
  lcd.setCursor(19, 2);
  lcd.write(4); //Write the vertical bar graphic
  lcd.setCursor(0, 3);
  lcd.write(2); //Write the bottom left graphic
  lcd.print("==================");
  lcd.write(3); //Write the bottom right graphic
 
  /* Display some text inside the border */
  while (1)
  {
    lcd.setCursor(2,1);
    lcd.print("HOBBY COMPONENTS");
    lcd.setCursor(2,2);
    lcd.print("**HELLO WORLD**");
    delay(500);
    lcd.setCursor(2,1);
    lcd.print("                ");
    lcd.setCursor(2,2);
    lcd.print("               ");
    delay(500);
  }
}


Arduino Library:
Attachment:
HCARDU0023_LiquidCrystal_I2C.zip


EDIT (16/01/16): New version now works with Arduino IDE version 1.6.7


Datasheet:
Attachment:
HD44780.pdf


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


Fri May 24, 2013 12:05 pm
Profile
Post Re: 2004 20x4 I2C Serial LCD Module (HCMODU0010)
Trying out my 20 x 4 LCD module.

a) it lights up -
row 1 is 20 white rectangles on blue with each rectangle being 5 x 8 (?) white dots
row 2 - nothing
row 3 (as row 1)
row 4 nothing.

If I verify the example code from the forum I get the following error messages

errors message start>>>>>

hobbycomponents_LCD:51: error: invalid conversion from 'int' to 't_backlighPol'
hobbycomponents_LCD:51: error: initializing argument 3 of 'LiquidCrystal_I2C::LiquidCrystal_I2C(uint8_t, uint8_t, t_backlighPol)'
/Users/nigel/Documents/Arduino/libraries/LiquidCrystal/LiquidCrystal_I2C.h: In function 'void setup()':
/Users/nigel/Documents/Arduino/libraries/LiquidCrystal/LiquidCrystal_I2C.h:154: error: 'int LiquidCrystal_I2C::init()' is private
hobbycomponents_LCD:57: error: within this context
hobbycomponents_LCD.ino: In function 'void loop()':
hobbycomponents_LCD:74: error: call of overloaded 'write(int)' is ambiguous
/Users/nigel/Documents/Arduino/libraries/LiquidCrystal/LCD.h:479: note: candidates are: virtual size_t LCD::write(uint8_t)
/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/Print.h:49: note: size_t Print::write(const char*)

error message end.

I've downloaded the liquid crystal libraries as per forum and placed in documents\ardunio\libraries
the in documents\arduino\ is a folder called hobbyocomponents_lcd which holds hobbycomponents_LCD.ino

HELP! (please)

many thanks


Sat Jul 06, 2013 4:35 pm
Site Admin

Joined: Sun Aug 05, 2012 4:15 pm
Posts: 697
Post Re: 2004 20x4 I2C Serial LCD Module (HCMODU0010)
Hi,

It is perfectly normal for the display to do this when its uninitialised. I have just checked the library and example sketch, and its compiling fine on my set-up so it's likely there is something odd with your Arduino environment that's causing it not to compile. The place that you have put the library appears to be correct. I suggest checking that you haven't left any other versions of the libraries in there. If you can't see anything, temporarily move everything in your /Documents/Arduino/libraries/ folder to a safe place and just put the library downloaded from this forum in there. Also check that there's nothing in the C:\arduino\libraries folder that you may have left in there.

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


Sat Jul 06, 2013 6:00 pm
Profile
Post Re: 2004 20x4 I2C Serial LCD Module (HCMODU0010)
many thanks for the prompt (beyond speedy) reply. I've cleared out libraries, etc etc and re installed. Only items in (mac os x) documents/arduino/libraries are readme.txt and LiquidCrystal_i2c.

In liquidcrystal_i2c are examples folder and info folder and keywords.txt and liquidCrystal_i2c.cpp and liquidCrystal_i2c.h. (its v2.0)

I've re-copied the example code on the forum and saved it - this now verifies with no errors

However ...

the LCD panel is, as before connected to sensor shield via the 4 wire latched cables and to the GND. VCC etc on the LCD daughter board, but it does not light up at all. I've tried adjusting the potentiometer on the daughter board but makes no difference. In essence it appears 'dead'

The Arduino is getting power via USB and the LED on the sensor shield is lit up (one in front) of the i2c interface.

As always help much appreciated.


Sat Jul 06, 2013 7:33 pm
Post Re: 2004 20x4 I2C Serial LCD Module (HCMODU0010)
update to my last post:

I've got a pot wired to analogue 4, and when I've just loaded simple sketch to read values on A0 - A4 (each has a pot) I noticed that when I opened A4 to a value of 1023 the LCD lit up - so that's that problem solved. Obviously analog A4 is being used by the LCD for power.

back to testing the sketches, will let you know of outcome.

thanks


Sat Jul 06, 2013 8:06 pm
Post Re: 2004 20x4 I2C Serial LCD Module (HCMODU0010)
further update:

If I remove the connection from my potentiometer to A4 I loose all power to the LCD
I've powered off the arduino and turned it back on, have run test sketches to make sure arduino is ok (eg digital read on 12) and that works of.

So to recap,

I can now verify the code (sample "hobby components - hello world", but no power to the LCD unless I connect my potentiometer to A4 and leave it open.
Sketches verify and download but still not showing on the LCD.

I assume the power issue is to do with " PIN 3 SDA Connect to Arduino analogue PIN 4.
How do I get to reset this so its not dependent for power on a potentiometer (or others imagine).


sorry for the trouble.


Sat Jul 06, 2013 8:31 pm
Site Admin

Joined: Sun Aug 05, 2012 4:15 pm
Posts: 697
Post Re: 2004 20x4 I2C Serial LCD Module (HCMODU0010)
Analogue pin 4 does not power the back light, as with the LCD, the backlight is powered from the VCC and GND pins and the state of the backlight (on or off) is controlled in software. Although when first powered up the LCD is in an un-initialised state, and no communication to the LCD, the backlight usually defaults to being on.

When running the sketch, the two Analogue pins on your board are actually reconfigured as serial digital (SPI) IO pins and are used to communicate serially with the device. Their voltage level should not affect the state of the backlight directly. I also recommend disconnecting your external pot as whist these pins are in the SPI mode you risk damaging your LCD and board. Don’t apply any external voltages to these pins whilst they are in this mode.

I am having trouble locating you on our system; did you buy this hardware from us? If so could you either PM or email us your order number if you purchased it from our website, or your eBay user name if you got them via eBay. This will help us determine exactly what hardware you have so that we can replicate your setup.
Can I also confirm that the example sketch posted above not only compiles correctly, but downloads to your Arduino without any errors?

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


Sun Jul 07, 2013 7:58 am
Profile
Post Re: 2004 20x4 I2C Serial LCD Module (HCMODU0010)
Hi:

re purchase: Hobby Components o/n [removed by admin] (for the LCD) and [removed by admin] for the sensor shield.

marks on unit are LCM1602 IIC, Hoya, Funduino, LD1, 111330, and on the main board are J204A with QC sticker implies QC pass on 2013 06.

example code verifies with no problems, and is received by ardunio uno ok.

changes to code eg Delay in teh while loop do have an effect, ie by altering the delay in the unit lighting up. (on/off/on off etc)
LDA1 Led is on


Having toned down the brightness (doh !) i get

on row 1 - eight blank cells and 2x '0' and on row 3 16 x '0' and 4 blank cells
If I change

lcd.setCursor(0, 0);
lcd.write(0); //Write the top left graphic
lcd.print("==================");

to read
lcd.setCursor(0, 0);
lcd.write(0); //Write the top left graphic
lcd.print("==");

I get on row 1 eighteen blank cells and 2 x "0' in columns 19 and 20
(in row column numbers above I've started at 1 to be the top row, and not used 0,0)

if I replace say the second "=" and the second to last "=" in the lcd.print("=================="); statement the 'X''s are replaced with a blank cell

can send photos of results if that would help


Sun Jul 07, 2013 9:56 am
Site Admin

Joined: Sun Aug 05, 2012 4:15 pm
Posts: 697
Post Re: 2004 20x4 I2C Serial LCD Module (HCMODU0010)
Thanks for the information. I’ve pulled an LCD out of stock with the same batch date and the example sketch works fine. The symptoms you have now are typical of a wrong library version, but I have confirmed that the library version in this forum is fine with the current screens. So long as this is the version of library you are using there should be no problems with the software and shouldn’t require any modification to work.

Is it possible for you to connect the display directly to the Uno, bypassing the sensor shield? The connections would be as follows:

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


Sun Jul 07, 2013 2:52 pm
Profile

Joined: Sun Jul 07, 2013 9:57 am
Posts: 1
Post Re: 2004 20x4 I2C Serial LCD Module (HCMODU0010)
:) :D

Hi Andrew --- I've got an LCD with "Hobby components ** Hello World ***" flashing on and off. - via the sensor shield.

Here's what I did:
cleaned out any docs in documents\arduino\libraries so had empty library.
installed libraries from https://bitbucket.org/fmalpartida/new-l ... /wiki/Home and got no joy.

Started again, and looked for the library on this forum, and then realised, if I logged on to the forum I could see the files attached to the forum so downloaded the HCARDU0023_LiquidCrystal_I2C_V2_1 and then imported that library into a clean and empty library. Deleted old sketches for the LCD (probably not a step that was required), copied and pasted sketch from this forum and 'started again'.

So the key was use HCARDU0023_LiquidCrystal_I2C_V2_1 and not the ones from malpartida/new-liquidcrystal ....

thanks for all the help and support.


Wed Jul 10, 2013 6:19 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 48 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