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
Experimenting with Extreme Environments
  • Challenges & Projects
  • Design Challenges
  • Experimenting with Extreme Environments
  • More
  • Cancel
Experimenting with Extreme Environments
Forum Driving the LCD - share your experience
  • Blog
  • Forum
  • Documents
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Experimenting with Extreme Environments to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 35 replies
  • Subscribers 39 subscribers
  • Views 3825 views
  • Users 0 members are here
Related

Driving the LCD - share your experience

Anthocyanina
Anthocyanina over 1 year ago

Hi! So, I've been working on the software for this challenge and have reached the point where i need to figure out the LCD. The datasheet has a character map and and the addresses for the position of each character. I don't have much experience with driving LCDs so I'm struggling with where to start. Have any of you figured out the LCD yet? 

I found a couple threads on the arduino forum that talk about this display, with people saying you could use the HD44780 libraries, or similar to drive it. I'll be trying that with an arduino board first, but still would like to hear about your experience with this display so far. 

Thank you!

  • Sign in to reply
  • Cancel

Top Replies

  • javagoza
    javagoza over 1 year ago in reply to BigG +5
    This one is even simpler.. github.com/.../cfah2004ac community.element14.com/.../IMG_5F00_1443.mov
  • javagoza
    javagoza over 1 year ago in reply to jc2048 +5
    jc2048 A quick adaptation of your script. Works! Thanks for sharing! from smbus2 import SMBus LCD_CLEARDISPLAY = 0x01 LCD_FUNCTIONSET_4LINE_5x8DOTS_BITMODE = 0x38 LCD_DISPLAYCONTROL_ON = 0x0C LCD_ENTRYMODESET_LEFT…
  • Anthocyanina
    Anthocyanina over 1 year ago in reply to shabaz +4
    update time! when i soldered the board to the LCD, which also served as an I2C breakout board, the flux residue was so hard to clean, i couldn't get it all out. I decided to remove that board, which i…
Parents
  • jc2048
    jc2048 over 1 year ago

    I did a project, informally as part of the PiCasso design challenge, that used some I2C LCD displays. They were 2 rows of 16 and had the common Hitachi chip compatible registers. The datasheet was very messy, and muddled up the different variants in a really confusing way (the panel was available as either a I2C, SPI, or parallel build), so I had to do some experimenting to get the interface to work.

    /challenges-projects/design-challenges/picasso/b/blog/posts/9-pieces-of-pi-slice-2-manifesto-for-art-electronic

    That might give you some ideas, but be warned that the interface to your panel looks different to the one I had, so don't blindly copy what I did there.

    One important aspect to be aware of is that the controller on the panel has an embedded microcontroller, but it runs very slowly, to minimise the power consumption, so you have to be careful to ensure that it can keep up with your much faster device. One of the registers has a status bit that can be polled to see if the last command is finished. That's the fastest way of talking to the panel, if you can read the registers. In the case of the panel I chose, the I2C interface was write-only, so I had to instead look at the timings given by the datasheet for the various commands and make sure I exceeded them. If you use a library, it's likely that it will make use of that register bit and would fail if the registers can't be read, but hopefully the panel you've been given will allow for reading back from the registers.

    A second factor that may not be obvious, if you've not worked with the panels, is that the voltage for the LCD section has a separate pin to the logic supply for the controller. That's so that the contrast can be adjusted. The complication is, though, that internally the common voltage between the logic part and the segment drive part is normally the positive logic voltage, not the ground that you might expect. For the panel I used, the LCD supply (Vo) had to be about 6V, so ended up negative relative to the ground for good contrast (easy to achieve because the panel itself had a charge-pump generator on it). In the case of your panel, it looks like the LCD supply only needs to be about 4.5V, so your Vo will be approx 0.5V above ground and you can just use a pot between the logic supplies to supply it. Adjust it to the right sort of area initially with a meter, because if it's too far out the display will look blank rather than just having poor contrast.

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • Cancel
  • javagoza
    javagoza over 1 year ago in reply to jc2048

    image

     jc2048 A quick adaptation of your script. Works! Thanks for sharing!

    from smbus2 import SMBus
    
    LCD_CLEARDISPLAY = 0x01
    LCD_FUNCTIONSET_4LINE_5x8DOTS_BITMODE = 0x38
    LCD_DISPLAYCONTROL_ON = 0x0C
    LCD_ENTRYMODESET_LEFT = 0x06
    LCD_1LINE = 0x80
    LCD_2LINE = 0xC0
    LCD_3LINE = 0x94
    LCD_4LINE = 0xD4
    
    
    # initialise the LCD panels
    # and write the static first line
    bus = SMBus(1)
    
    firstLineString = "#### ELEMENT14 #####"
    
    displayBuffer = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
    for i in range (0, 20):
      displayBuffer[i] = ord(firstLineString[i])
    
    bus.write_i2c_block_data(0x3C , 0x00, [LCD_FUNCTIONSET_4LINE_5x8DOTS_BITMODE])
    time.sleep(0.015)
    bus.write_i2c_block_data(0x3C , 0x00, [LCD_DISPLAYCONTROL_ON])
    time.sleep(0.001)
    bus.write_i2c_block_data(0x3C , 0x00, [LCD_CLEARDISPLAY])
    time.sleep(0.001)
    bus.write_i2c_block_data(0x3C , 0x00, [LCD_ENTRYMODESET_LEFT])
    time.sleep(0.01)
    bus.write_i2c_block_data(0x3C , 0x00, [LCD_1LINE])
    bus.write_i2c_block_data(0x3C , 0x40, displayBuffer)
    time.sleep(0.01)
    bus.write_i2c_block_data(0x3C , 0x00, [LCD_2LINE])
    bus.write_i2c_block_data(0x3C , 0x40, displayBuffer)
    time.sleep(0.01)
    bus.write_i2c_block_data(0x3C , 0x00, [LCD_3LINE])
    bus.write_i2c_block_data(0x3C , 0x40, displayBuffer)
    time.sleep(0.01)
    bus.write_i2c_block_data(0x3C , 0x00, [LCD_4LINE])
    bus.write_i2c_block_data(0x3C , 0x40, displayBuffer)

    • Cancel
    • Vote Up +5 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • javagoza
    javagoza over 1 year ago in reply to jc2048

    image

     jc2048 A quick adaptation of your script. Works! Thanks for sharing!

    from smbus2 import SMBus
    
    LCD_CLEARDISPLAY = 0x01
    LCD_FUNCTIONSET_4LINE_5x8DOTS_BITMODE = 0x38
    LCD_DISPLAYCONTROL_ON = 0x0C
    LCD_ENTRYMODESET_LEFT = 0x06
    LCD_1LINE = 0x80
    LCD_2LINE = 0xC0
    LCD_3LINE = 0x94
    LCD_4LINE = 0xD4
    
    
    # initialise the LCD panels
    # and write the static first line
    bus = SMBus(1)
    
    firstLineString = "#### ELEMENT14 #####"
    
    displayBuffer = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
    for i in range (0, 20):
      displayBuffer[i] = ord(firstLineString[i])
    
    bus.write_i2c_block_data(0x3C , 0x00, [LCD_FUNCTIONSET_4LINE_5x8DOTS_BITMODE])
    time.sleep(0.015)
    bus.write_i2c_block_data(0x3C , 0x00, [LCD_DISPLAYCONTROL_ON])
    time.sleep(0.001)
    bus.write_i2c_block_data(0x3C , 0x00, [LCD_CLEARDISPLAY])
    time.sleep(0.001)
    bus.write_i2c_block_data(0x3C , 0x00, [LCD_ENTRYMODESET_LEFT])
    time.sleep(0.01)
    bus.write_i2c_block_data(0x3C , 0x00, [LCD_1LINE])
    bus.write_i2c_block_data(0x3C , 0x40, displayBuffer)
    time.sleep(0.01)
    bus.write_i2c_block_data(0x3C , 0x00, [LCD_2LINE])
    bus.write_i2c_block_data(0x3C , 0x40, displayBuffer)
    time.sleep(0.01)
    bus.write_i2c_block_data(0x3C , 0x00, [LCD_3LINE])
    bus.write_i2c_block_data(0x3C , 0x40, displayBuffer)
    time.sleep(0.01)
    bus.write_i2c_block_data(0x3C , 0x00, [LCD_4LINE])
    bus.write_i2c_block_data(0x3C , 0x40, displayBuffer)

    • Cancel
    • Vote Up +5 Vote Down
    • Sign in to reply
    • Cancel
Children
No Data
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