2004 20x4 I2C Serial LCD Module (HCMODU0010)

LCD, TFT, OLED, LED modules
trystan
Posts: 3
Joined: Mon Nov 04, 2013 10:25 pm

Re: 2004 20x4 I2C Serial LCD Module (HCMODU0010)

Post by trystan » Mon Nov 11, 2013 1:24 pm

I managed to get the 20x4 display working using the instructions, and the library function. It works really well - thank you!

Is there any documentation for the library at all to see if there are any other functions? Can text be right-justified or something like that? Is there a function for flashing the backlight on & off?

I've never used an LCD before, so it's a bit of a learning curve.

I don't quite understand how to to update a section on the screen, and also erasing what was shown before hand without doing the following:

Code: Select all

    lcd.setCursor(17,3);
    lcd.print("   ");
    lcd.setCursor(17,3);
    lcd.print(angle);
It results in the text flickering, is there a more elegant way of doing it?

By the way, the 'angle' in the above example can be between 0 and 359 - if I don't blank with a " " (three blank spaces) then if the angle changed from 359 to 0 then it would show 059.

(I've attached an image of the display, with an angle of 181 displayed - and I've used the cardboard box that it came in to keep it propped up - very 'Blue Peter'!)

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

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

Re: 2004 20x4 I2C Serial LCD Module (HCMODU0010)

Post by andrew » Mon Nov 11, 2013 2:23 pm

I think the best solution would be to test for the size of the angle and pad it out with spaces depending on its size. E.g....

Code: Select all

lcd.setCursor(17,3);
if(angle < 10)
{
    lcd.print("  "); //Double space
    lcd.setCursor(19,3);
}
else if(angle < 100)
{
    lcd.print(" "); //Single space
    lcd.setCursor(18,3);
}
lcd.print(angle);
I've not tested the above code but it should at least give you an idea of what to do.

The library was written by DFRobot and unfortunately there is very limited documentation for it. Here are the list of commands the library supports:

LiquidCrystal()
begin()
clear()
home()
setCursor()
write()
print()
cursor()
noCursor()
blink()
noBlink()
display()
noDisplay()
scrollDisplayLeft()
scrollDisplayRight()
autoscroll()
noAutoscroll()
leftToRight()
rightToLeft()
createChar()
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

trystan
Posts: 3
Joined: Mon Nov 04, 2013 10:25 pm

Re: 2004 20x4 I2C Serial LCD Module (HCMODU0010)

Post by trystan » Wed Nov 13, 2013 10:17 am

Andrew,

That is most helpful - thank you. I hadn't thought of formatting it in the code like that, but that makes perfect sense.

I'll have a play with some of those functions to see what they do.

Thanks again,
Trystan

trystan
Posts: 3
Joined: Mon Nov 04, 2013 10:25 pm

Re: 2004 20x4 I2C Serial LCD Module (HCMODU0010)

Post by trystan » Wed Nov 13, 2013 10:33 am

init() - Initializes the LCD

clear() - Cursor position to zero and clears screen

home() - cursor position set to zero

createChar() - Fill the first 8 CGRAM locations with custom characters

setCursor() - position of the cursor

cursor() - Underline cursor on
noCursor() - Underline cursor off

blink() - Blinking cursor on
noBlink() - Blinking cursor off

display() - Turn on the display
noDisplay() - Turn off the display

backlight() - Backlight on
noBacklight() - Backlight off

scrollDisplayLeft() - Display scroll to the left without altering the RAM
scrollDisplayRight() - Display scroll right without altering the RAM

autoscroll() Right justifification from the cursor position
noAutoscroll() - Left justification from the cursor position

leftToRight() - Left to Right text (Arabic??)
rightToLeft() - Right to Left text


Also found this really good description of the memory addressing of the display (which also covers other displays too) which explains why if you send too many characters to a line it 'overflows' to another line:
http://arduino-info.wikispaces.com/file ... essing.pdf

Trystan

williamdanger
Posts: 1
Joined: Fri Jan 03, 2014 8:53 pm

Re: 2004 20x4 I2C Serial LCD Module (HCMODU0010)

Post by williamdanger » Fri Jan 03, 2014 9:40 pm

Thanks you guys! I'v been working on this for 9 hours. Found this post and joined. in minuets i had the solution. I'm an old guy learning new things. Thanks a million! Peace, williamdanger

joenew
Posts: 2
Joined: Wed Jan 08, 2014 9:37 am

Re: 2004 20x4 I2C Serial LCD Module (HCMODU0010)

Post by joenew » Wed Jan 08, 2014 9:42 am

hi I am very new to this so if I got things wrong, I apologise now. My Problem is I have a Ardunio Uno bought with a Kit. I also got a 24/4/12c LCD marked with ( YwRobot Ardunio LCM1602 IIC V1 ) I2C LCD module (HCMODU0010) it will not display any text. two 0s on the top right, and on the next line 16 0s.but no text I have tried other codes and most work and upload, but never any text. is it bricked ? can anyone show me what I am doing wrong.
connected PIN 1: GND PIN 2: +5V PIN 3: SDA - Connect to Arduino analogue PIN A4 PIN 4: SCL - PIN A5
the Code I got from Hobby Components .

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

Re: 2004 20x4 I2C Serial LCD Module (HCMODU0010)

Post by andrew » Wed Jan 08, 2014 10:39 am

There is nothing obvious that's wrong with your setup but what you describe sounds like what you would see if you had an incorrect library version. Can you confirm that you are using the library available from the first post in this thread and that you don't have any other versions of the library in your 'library' folder.

Edit: this of course assumes that the LCD was purchased from us.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

joenew
Posts: 2
Joined: Wed Jan 08, 2014 9:37 am

Re: 2004 20x4 I2C Serial LCD Module (HCMODU0010)

Post by joenew » Wed Jan 08, 2014 1:16 pm

FIXED!
Thank you very much. I have spent two days trying to find out what was wrong. Yes I bought this from you plus a lot of other things. should have come to you the first time.

kenco
Posts: 13
Joined: Tue Jan 14, 2014 4:25 pm

Re: 2004 20x4 I2C Serial LCD Module (HCMODU0010)

Post by kenco » Tue Jan 28, 2014 7:29 pm

hi trying to get my lcd to work with my mega 2560 conected as per forum and download library and copied software put in folders as stated uploaded to mega but lcd dosnt change just as 1st post in forum
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.

aslo tried it with xp on main comp and laptop in win8 tried it with my other mega board same thing (got 2 megas from you )

this was stated after up load if its any use
Sketch uses 4,290 bytes (1%) of program storage space. Maximum is 258,048 bytes.
Global variables use 369 bytes (4%) of dynamic memory, leaving 7,823 bytes for local variables. Maximum is 8,192 bytes.

ok sorted it pins are differnt on the mega duh lol Mega2560 20 (SDA), 21 (SCL) as soon as i connected it worked :) now flashing hobby componants heelo world

civicbcn
Posts: 1
Joined: Fri Jan 31, 2014 11:32 am

Re: 2004 20x4 I2C Serial LCD Module (HCMODU0010)

Post by civicbcn » Sat Feb 08, 2014 2:25 pm

Ayuda!!! no me funciona el lcd en arduino mega con shield v4 y sin el, ayudaaaaaaaaaaaaaaaaaaa!!!!!!!!!!!!!!!!

Post Reply

Return to “Display”