Thanks! I will try and post the update here.DougieLawson wrote:Try this: https://github.com/DougieLawson/Raspber ... nified_LCD that's running right now on a RPi with a quick2wire MCP23017 I2C expansion board.
Yes.pkhandelwal wrote:One more thing, I am using python for development. Just wanted to know if there is something I can do with Python code from the Adafruit library to make it working.
DougieLawson wrote:Before posting a question when Dr. Google hasn't helped please read this: http://www.catb.org/esr/faqs/smart-questions.html (don't take it too seriously but it will help you form coherent questions).
MCP23017 example. I am using the sample code from their git repo and have connected the pins as per the code. But when I run it, the LCD displays blocks in the first line of the LCD. I have checked and re-checked the wiring.

I can't comment on any Python code (I use 'C' and my own MCP23017 interfaces) but if your "line of blocks" is like what I show here:pkhandelwal wrote:MCP23017 example. I am using the sample code from their git repo and have connected the pins as per the code. But when I run it, the LCD displays blocks in the first line of the LCD. I have checked and re-checked the wiring.

Thanks for the reply and sketch! I don't have a 10K pot. right now with me. V0 pin on my LCD is grounded. Will that work? When I use other Adafruit library to display text on LCD it work (when the LCD is connected directly to the PI). Or is it may be the LCD is not getting initialize correctly?DougieLawson wrote:Try using my C program, if that works then we know it's a bug in Adafruit's python library. If it doesn't work then it's a hardware problem.
The common hardware problem with LCDs is not wiring a 10K pot on the V0 pin. When the voltage on V0 isn't present (you get a blank display) when it is 5V0 you get nothing but blocks.
Code: Select all
def __init__(self, pin_rs=25, pin_e=24, pins_db=[23, 17, 21, 22], GPIO = None):
Code: Select all
lcd = Adafruit_CharLCD(pin_rs=0, pin_e=1, pins_db=[4,5,6,7], GPIO=mcp)Code: Select all
import Adafruit_CharLCD as LCD
lcd_rs = 27
lcd_en = 22
lcd_d4 = 25
lcd_d5 = 24
lcd_d6 = 23
lcd_d7 = 18
lcd_backlight = 4
lcd_columns = 16
lcd_rows = 2
# Initialize the LCD
lcd = LCD.Adafruit_CharLCD(lcd_rs, lcd_en, lcd_d4, lcd_d5, lcd_d6, lcd_d7, lcd_columns, lcd_rows, lcd_backlight)
i don't know the code, but are you sure this has not to bepkhandelwal wrote:Code: Select all
pins_db=[4,5,6,7]
Code: Select all
pins_db=[7,6,5,4]I tried changing the pins, but still same blocks are being displayed on the LCD.Massi wrote:i don't know the code, but are you sure this has not to bepkhandelwal wrote:Code: Select all
pins_db=[4,5,6,7]?Code: Select all
pins_db=[7,6,5,4]
if you swap datalines you'll get "something" on the display, but not what you expect (blocks and broken chars)
What's that MCP23017 doing there? Why are you trying to use the GPIO library when your LCD is connected on the MCP23017 on the I2C bus?pkhandelwal wrote:![]()
I am using the code which Adafruit has in their repository: https://github.com/adafruit/Adafruit-Ra ... XX_test.pyDougieLawson wrote:What's that MCP23017 doing there? Why are you trying to use the GPIO library when your LCD is connected on the MCP23017 on the I2C bus?pkhandelwal wrote:![]()
You need to find a python library that will drive an LCD on I2C (device 0x20) on GPIOA on the MCP23017.
My C code sample has a I2C version.
Thanks!! I will try it tonight and let you know.Douglas6 wrote:Adafruit has a Python library for their 16x2 display wired to an MCP23017: https://github.com/adafruit/Adafruit_Python_CharLCD.git. I'm not saying it's wired the same way.

Yes, it worked!!DougieLawson wrote:Check your Wiring.
My code uses GPIOB / OLATB
GPB0 (pin#1)LCD_D4 (pin#11)
GPB1 (pin#2)LCD_D5 (pin#12)
GPB2 (pin#3)LCD_D6 (pin#13)
GPB3 (pin#4)LCD_D7 (pin#14)
GPB4 (pin#5)LCD_EN (pin#6)
GPB6 (pin#7)LCD_RS (pin#4)
GPB7 (pin#8)LCD_BL+ (pin#15)
LCD_BL- (pin#16) is wired through a resistor to GND.