element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Arduino Forum Undestanding the pin assignment LCD i2C
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 18 replies
  • Subscribers 393 subscribers
  • Views 2174 views
  • Users 0 members are here
  • lcd
  • i2c
  • arduino
Related

Undestanding the pin assignment LCD i2C

onemikeoscar
onemikeoscar over 10 years ago

Hi everyone!

First i need to admit something hahaha, i'm spanish and in first place sorry for my rought english.

 

I'm here for Ben Show, it's a incredible show and i love it hahaha but i think that i doesn't matter now xD

I bought one i2c adapter for LCD in ebay (you can see it here) the problems came when i tried to start typing something.

I have had a lot of problems with the LyquidCristalI2C library, all of this problems are for the pin assignment, the last combination

that works was this: LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);

My question now is How can i find the values of these parameters? I mean, i only try with the standard values but i think that it will have one way

to discover this values (maybe one datasheet or something else, i dont know).

 

I hope that you cand understand my question and again sorry for my english.

  • Sign in to reply
  • Cancel

Top Replies

  • Robert Peter Oakes
    Robert Peter Oakes over 10 years ago +1
    There are two variations of the serial to LCD adapters floating around The chip on the board linked is a PCF8574 I2C 8 bit port expander http://www.ti.com/lit/ds/symlink/pcf8574.pdf and as such does not…
  • Robert Peter Oakes
    Robert Peter Oakes over 10 years ago in reply to onemikeoscar +1
    So to see more about that I would suggest simply looking at the library CPP file (It will be the same name as the header file (.h) but with a .CPP extention instead, with luck it is commented but at least…
  • billpenner
    billpenner over 10 years ago in reply to Robert Peter Oakes +1
    I think the codes relate to the LCD not the expander. As I understand the port expander only translates the serial data to parallel. the actual code would be the same. Is this correct. Maybe I am looking…
  • bobcroft
    bobcroft over 10 years ago

    Jose, if I understand you correctly you want to know the connections between the Arduino and the LCD serial module.  There are several versions of the serial modules and they all use different pin configurations.  The best source of information and how to identify the modules that I have found is on "yourduino.com"  There is also some Arduino code for each module type.  I have used the serial or I2C modules with great sucess using the information on the site noted above.

     

    If you need more help please ask.

     

    Bob

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • billpenner
    billpenner over 10 years ago in reply to bobcroft

    I have the same question. Is there a complete list of codes for the display?  Some are used in the sketches such as blank the display, blink the cursor etc.

    Thanks Bill

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Robert Peter Oakes
    Robert Peter Oakes over 10 years ago

    There are two variations of the serial to LCD adapters floating around

    The chip on the board linked is a PCF8574 I2C 8 bit port expander  http://www.ti.com/lit/ds/symlink/pcf8574.pdf

    and as such does not support SPI even though the ebay add says it does

     

    so this is a standard library driver and it is probably connected in a standard way to what ever LCD display you hock it too providing it follows the 1602 / 2004 standard pin out which is most of them

     

    the codes needed for the display is found in the display documentation, not the I2C to LCD adapter and again is usualy following the Hitachi standard

     

    the standard driver and samples should all work for you

     

    What do you get on the display when you try to run the samples, have you verified your using the library for the PCF8574 ?

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • onemikeoscar
    onemikeoscar over 10 years ago in reply to Robert Peter Oakes

    Yes, finally I could run one example with succes, the problem is that i dont know how to know where is the docuementation for the values of the constructor

     

    LiquidCrystal_I2C LCD(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Set the LCD I2C address

     

    I know that 0x27 is the address of device but i dont know how to find the correct values of the next parameters, for example 2,1,0....

    I know also that 2 is for enable, 1 is for rw and so on... But WHY? hahaha, i found the correct values trying with differents examples

    but I always want to understand all that I wrote in my programs because if in the future I need to modify this program how I will do it? hahahah

     

    Thanks image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • bobcroft
    bobcroft over 10 years ago in reply to billpenner

    Bill,

            if you look on www.yourduino.com at these modules and the associated Wiki there is a full list of all the functions and some very good explanations.  With reference to Peter's comments the variants available on EBAY do, I believe, differ in the way the PCF8574 pins are connected to the LCD display.  I have two versions at least and I can get both versions to work perfectly by changing the pin list in LiquidCrystal_I2C.  There may also be modules that use a different I2C to parallel converter chip.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • onemikeoscar
    onemikeoscar over 10 years ago in reply to bobcroft

    Yes I know that the only thing that you need to do in order to work with differents modules (with differents pinouts) is change the constructor but my question and I think that it's the same for other people is what is the way to discover the pinout of the differents modules (all modules with the same controller).

    For example, you told that you have two version, okay, what way you followed to discover what values to put in the constructor? (the only way is yourduino.com)

     

    Thanks bob.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Robert Peter Oakes
    Robert Peter Oakes over 10 years ago in reply to onemikeoscar

    So to see more about that I would suggest simply looking at the library CPP file (It will be the same name as the header file (.h) but with a .CPP extention instead, with luck it is commented but at least you will see the signature of the method calls, the header file should also show the signatures and possibly more comments

     

    I have never yet found much actual user guides for these things

    Peter

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • billpenner
    billpenner over 10 years ago in reply to Robert Peter Oakes

    I think the codes relate to the LCD not the expander. As I understand the port expander only translates the serial data to parallel. the actual code would be the same.

    Is this correct. Maybe I am looking in the wrong place?

    Bill

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • bobcroft
    bobcroft over 10 years ago in reply to billpenner

    Bill, Jose,

                        The codes in the constructor reflect the way the I2C to parallel chip (PCF8574) is connected to the LCD.  These devices use the 4 bit data transfer method from the 8574 to the LCD. So in the example lcd(0x27,2,1,0,4,5,6,7,3,POSITIVE).  The numbers refer to En, RW, RS, data pins 4,5,6,7, 3 is the back light control pin and POSITIVE is the back light polarity.  The pins referred to are on the LCD module linked to the 8574 chip.  Thus provided the constructor is correct the data sent to the LCD via the I2C interface will be displayed correctly.  The code written and programmed into the Arduino will work correctly provided the constructor for the particular I2C to LCD module reflects the wiring between the 8574 and the LCD module.  Bill is therefore correct in his understanding.

    I do have a PDF file that shows the connections of one LCD backpack module but I don't know how to attach it to this note.  If anyone wants it please email me.

     

    Now the rub!  As Peter has noted there is very little information on these devices apart from that on yourduino.com, so to answer Jose'e question specifically there is no easy way to find the correct constructor for these back packs unless the supplier has the information.  Alternatively a logic analyser could be used.

    Again as Peter noted much of the information above can be gleaned from the comments of the library files.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • billpenner
    billpenner over 10 years ago in reply to bobcroft

    Yep, looks like the most complete data may be on Sparkfun.com. go there and lookup the LCD module their number (LCD-00790) the datasheet seems to be the most complete.

    It is difficult to comprehend but the data is there for all the codes for the display.

    Thanks guys.

    Bill

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube