Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    LCD not receiving commands/strings

    Scheduled Pinned Locked Moved SiPy
    3 Posts 2 Posters 20 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • L Offline
      Lennac
      last edited by Lennac

      I have a HD44780 styled LCD screen (4x20) and am using a library I found that was widely used and recommended through my google searching. However, despite the LCD powering on, I'm not getting anything to actually display on the device and would like some guidance to fix this if possible.

      Files used from the github library:
      LCD API
      ESP32 GPIO LCD

      My main looks like this:

      from machine import Pin
      from gpio_lcd import GpioLcd
      import time
      
      lcd = GpioLcd(rs_pin=Pin('P4'),
                        enable_pin=Pin('P11'),
                        d4_pin=Pin('P5'),
                        d5_pin=Pin('P18'),
                        d6_pin=Pin('P21'),
                        d7_pin=Pin('P22'),
                        num_lines=4, num_columns=20)
      
      lcd.putstr("It Works!\nSecond Line\nThird Line\nFourth Line")
          sleep_ms(3000)
          lcd.clear()
          count = 0
      
      while True:
          lcd.move_to(0, 0)
          lcd.putstr("%7d" % (ticks_ms() // 1000))
          sleep_ms(1000)
          count += 1
      

      I initially followed the code exactly as shown in the test file. However, I was getting a ValueError issue with the initialization of the LCD, so I changed that to send a string for each pin as shown in GPIO pin initialization in the pycom documentation (as opposed to the general micropython documentation).

      In the command line, I'm able to check the pins and they seem to be initialized properly. I'm also able to sometimes get a value of 1 or 0 for the various data pins when checking lcd.d4_pin.value() (for example).

      robert-hhR 1 Reply Last reply Reply Quote 0
      • robert-hhR Offline
        robert-hh @Lennac
        last edited by

        @Lennac A few notes.

        • P18 is an input only pin. You cannot use that for the LCD.
        • These LCD have an additional R/W pin. Usually this is Pin5. That must be set to low level, since you need to write only.
        • Usually these are 5V devices. Writing to it at 3.3Level should work, but the LCD requires 5V for operation.
        • There is also the LCD contrast pin 3 at the LCD, with which the contrast of the LCD is controlled. Some LCD have a potentiometer instead, some require a proper voltage somewhere between 0 and 5V.
        L 1 Reply Last reply Reply Quote 2
        • L Offline
          Lennac @robert-hh
          last edited by

          @robert-hh Thank you so much. It was literally just my misuse of P18. I was just not paying attention to that detail and should have been referring back to the pinout.

          1 Reply Last reply Reply Quote 0

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • 1 / 1
          • First post
            Last post

          Pycom on Twitter

          Pycom