1

I'm trying to drive a 16x2 LCD board with i2c and running into some unexpected results. Basically, I can detect it, talk to it with my code, but nothing shows up on the screen. Same screen when driven by an Arduino works fine, so I know it's OK and brightness is correct.

First, it's being driven via an Adafruit LCD backpack (http://www.adafruit.com/product/292). Tested on Arduino using their code.

Second, the output of i2cdetect to show that it's there...

      0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
 00:          -- -- -- -- -- -- -- -- -- -- -- -- --
 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
 20: 20 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
 70: -- -- -- -- -- -- -- --

I can unplug it and have the "20" go away, so I know that it is the device I've connected to DC 5v, Ground, SDA1 and SCL1.

Third, I am running the code from http://www.rpiblog.com/2012/07/interfacing-16x2-lcd-with-raspberry-pi.html to test. I have modified it to reference device address 0x20 and port 1. If I use an address other than 0x20 or port other than 1, I get an error.

Lastly, when I run this code, I see nothing - just a blank screen.

So basically it's there, and I'm talking to it, but I'm not seeing any results.

Any advice on what I might be missing?

  • is there a contrast pot on the back of your display or did you include one in your wiring. If so you may just need to adjust the contrast. Just because it works witht the arduino does not mean it will work with the Pi. – Steve Robillard Mar 21 '15 at 21:09
  • Steve, I already confirmed the contrast was set properly when I hooked it up to the Arduino. I have also tried twisting it while on the RPi but I see no change. I did test the GND and 5V with an LED (very briefly) to confirm there was juice going to it. – Tim Holt Mar 21 '15 at 21:18
  • In that case we are going to need to see you source code and a picture or pictures of your wiring and connections. – Steve Robillard Mar 21 '15 at 21:35
  • The Pi is a 3V3 device. I guess you are powering the LCD with 5V. Perhaps use a diode in series to drop a bit of voltage. The device may need 0.7 * VCC to work at the logic level. – joan Mar 21 '15 at 23:13
  • I believe that it is wired correctly, as it is detected by i2cdetect, and reports the address (0x20) that I know it to use. As to 3v vs 5v, I've seen pretty conflicting comments about whether this makes a difference. Additionally, if it did not work at all with 5V I am assuming (per first sentence) it would not show up with i2cdetect. – Tim Holt Mar 22 '15 at 2:16
1

TLDR; Code referenced in question was for the wrong I2C chipset. Identifying chipset and finding appropriate code solved issue.

Upon further experimentation, I believe the issue was that the code examples I was finding online and testing (I tried multiple) were all for the wrong I2C I/O expander. I had not realized that there are different versions of that chip, and that different libraries are needed depending on the base I2C chip.

Specifically, the code I mentioned above for example was for the PCF8574, however the Adafruit LCD backpack uses the MCP23008 chip.

Further searching lead me to this Adafruit code for their Pi LCD shield...

https://github.com/eightamrock/Adafruit-Raspberry-Pi-Python-Code/tree/master/Adafruit_CharLCD

Though designed for the shield, the examples in this code properly display characters on the given LCD display.

1

I had a problem which manifested the same way, but had completely different cause. In my case, I was able to turn backlight on and off, but saw not text at all.

I powered the display at 3.3v, seems that the display is designed for 5v. I needed to adjust the contrast to the maximum with the potentiometer on the i2c converter. The contrast was still weak, but usable.

I have this display:

enter image description here enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.