0

HELP! Adafruit 16x2 Character LCD + Keypad for Raspberry Pi
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

HELP! Adafruit 16x2 Character LCD + Keypad for Raspberry Pi

by jrprinter on Fri Jan 18, 2019 9:27 am

I was given this kit as a gift and have spent the past four hours putting it together following the instructions at https://learn.adafruit.com/adafruit-16x ... i/assembly. I then went on to the next step in the tutorial (using the Python code). I was able to get the libraries installed, and get through the first few lines of the code, and when I get to instantiating the board with this line of code:

i2c = busio.I2C(board.SCL, board.SDA)

I get the following error message:

Traceback (most recent call last):
File "<pyshell#5>, line 1, in <module>
i2c = busio.I2C(board.SCL, board.SDA)
File "/usr/local/lib/python3.5/dist-packages/busio.py", line 16, in __init__
self.init(scl, sda, frequency)
File "/usr/local/lib/python3.5/dist-packages/busio.py", line 31, in_init
"No hardware I2C on (scl,sda)={}\nValid UART ports: {}".format((scl, sda), i2cPorts)
NotImplementedError: No Hardware I2C on (scl,sda)=(1,0)
Valid UART ports: ((1, 3, 2),)

The LCD does not light up when the the Pi is switched on, but I'm reasonably sure it's getting power as when I turn the contrast knob to it's counter-clockwise limit, I see a row of blocks on the first line of the display.

Any help would be truly appreciated!

Thanks in advance,
pete
Attachments
IMG_1052_SM.jpg
IMG_1052_SM.jpg (123.98 KiB) Viewed 5031 times

jrprinter
 
Posts: 24
Joined: Fri Jan 18, 2019 9:02 am

Re: HELP! Adafruit 16x2 Character LCD + Keypad for Raspberry

by adafruit_support_mike on Sat Jan 19, 2019 2:05 am

What kind of RasPi are you using?

adafruit_support_mike
 
Posts: 64815
Joined: Thu Feb 11, 2010 2:51 pm

Re: HELP! Adafruit 16x2 Character LCD + Keypad for Raspberry

by jrprinter on Sat Jan 19, 2019 2:42 am

It's a Pi Model B ((C) 2011 on the board under the Raspberry Pi name).

jrprinter
 
Posts: 24
Joined: Fri Jan 18, 2019 9:02 am

Re: HELP! Adafruit 16x2 Character LCD + Keypad for Raspberry

by adafruit_support_mike on Sun Jan 20, 2019 1:03 am

Thank you. What output do you get from the command:

Code: Select all | TOGGLE FULL SIZE
sudo i2cdetect -y 1

adafruit_support_mike
 
Posts: 64815
Joined: Thu Feb 11, 2010 2:51 pm

Re: HELP! Adafruit 16x2 Character LCD + Keypad for Raspberry

by jrprinter on Sun Jan 20, 2019 7:56 am

(I hope I did this right; still kinda new to all this.)

I opened a terminal window and issued the command; this is the response:

Error: Could not open file '/dev/i2c-1' or '/dev/i2c/1': No such file or directory.

Did I miss a step in the setup somewhere?

Thanks.

jrprinter
 
Posts: 24
Joined: Fri Jan 18, 2019 9:02 am

Re: HELP! Adafruit 16x2 Character LCD + Keypad for Raspberry

by adafruit_support_mike on Mon Jan 21, 2019 2:16 am

It looks like you may have, yes.

Enter the command:

Code: Select all | TOGGLE FULL SIZE
sudo raspi-config
on the command line, then use the arrow keys to select 'Interfacing Options' and 'I2C' to tell the RasPi to enable the I2C interface. Then select 'Finish' and reboot the RasPi.

When it's running again, try the `i2cdetect` command again.

adafruit_support_mike
 
Posts: 64815
Joined: Thu Feb 11, 2010 2:51 pm

Re: HELP! Adafruit 16x2 Character LCD + Keypad for Raspberry

by jrprinter on Mon Jan 21, 2019 3:39 am

Okay, I went into the config and enabled the i2c interface, then opened a terminal window and issued the command; I got the same response:

Error: Could not open file '/dev/i2c-1' or '/dev/i2c/1': No such file or directory.

Just to be sure the i2c interface was enabled, I went into the GUI configuration tool and checked the Interfaces tab; sure enough, it was enabled.

What's next?

pete

jrprinter
 
Posts: 24
Joined: Fri Jan 18, 2019 9:02 am

Re: HELP! Adafruit 16x2 Character LCD + Keypad for Raspberry

by adafruit_support_mike on Mon Jan 21, 2019 3:50 am

Did you reboot the RasPi before trying the command again?

adafruit_support_mike
 
Posts: 64815
Joined: Thu Feb 11, 2010 2:51 pm

Re: HELP! Adafruit 16x2 Character LCD + Keypad for Raspberry

by jrprinter on Mon Jan 21, 2019 4:18 am

Yes, sir, I did. I tried doing so twice, and double-checked the i2c interface was enabled after the second reboot; it was.

pete

jrprinter
 
Posts: 24
Joined: Fri Jan 18, 2019 9:02 am

Re: HELP! Adafruit 16x2 Character LCD + Keypad for Raspberry

by jrprinter on Mon Jan 21, 2019 6:45 am

Some additional things:

I tried a fresh installation of Jessie Stretch on another SD card. Re-enabled the i2c interface. Same problem.

I also tried on a different Pi, a Model 3 B+ designated for a different project, and that one gave me the results seen in this image:

3B+i2c.jpg
3B+i2c.jpg (76.79 KiB) Viewed 4962 times


What the heck is going on?

pete

jrprinter
 
Posts: 24
Joined: Fri Jan 18, 2019 9:02 am

Re: HELP! Adafruit 16x2 Character LCD + Keypad for Raspberry

by adafruit_support_mike on Tue Jan 22, 2019 2:01 am

Ah.. the original RasPi used I2C bus 0 instead of I2C bus 1.

I think the hardware detection code should still let the Python code work on an original RasPi though. What output do you get from:

Code: Select all | TOGGLE FULL SIZE
sudo i2cdetect -y 0
on the older RasPi?

adafruit_support_mike
 
Posts: 64815
Joined: Thu Feb 11, 2010 2:51 pm

Re: HELP! Adafruit 16x2 Character LCD + Keypad for Raspberry

by jrprinter on Tue Jan 22, 2019 3:34 am

This is what I get; looks like what I got on the 3B+ with one noteable difference on line 20 -- column 0 on that line has a 20 in it instead of two dashes:

B-i2c.jpg
B-i2c.jpg (78.83 KiB) Viewed 4937 times


What does this mean?

pete

jrprinter
 
Posts: 24
Joined: Fri Jan 18, 2019 9:02 am

Re: HELP! Adafruit 16x2 Character LCD + Keypad for Raspberry

by adafruit_support_mike on Tue Jan 22, 2019 5:15 am

That's good. It means the RasPi sees an I2C device connected to its SDA and SCL pins, and that the device responds to messages for address 0x20.

0x20 is the correct address for the MCP23017 that controls the LCD, so it looks like the RasPi is talking to the LCD Plate.

Try running one of the test scripts again and see if the LCD responds.

adafruit_support_mike
 
Posts: 64815
Joined: Thu Feb 11, 2010 2:51 pm

Re: HELP! Adafruit 16x2 Character LCD + Keypad for Raspberry

by jrprinter on Tue Jan 22, 2019 5:48 am

I tried the code on the tutorial page again:
-------------------------------------------------------------------------------------------------------
import board
import busio
import adafruit_character_lcd.character_lcd_rgb_i2c as character_lcd
lcd_columns = 16
lcd_rows = 2
i2c = busio.I2C(board.SCL, board.SDA)
-------------------------------------------------------------------------------------------------------

Once I input that last line in the Python 3.5.3 Shell, I got the error message I originally reported:
-------------------------------------------------------------------------------------------------------
Traceback (most recent call last):
File "<pyshell#5>", line 1, in <module>
i2c = busio.I2C(board.SCL, board.SDA)
File "/usr/local/lib/python3.5/dist.packages/busio.py", line 16, in __init__
self.init(scl, sda, Frequency)
File "/usr/local/lib/python3.5/dist.packages/busio.py", line 31, in init
"No hardware I2C on (scl,sda)={}\nValid UART ports: {}".format((scl, sda), i2cPorts)
NotImplementedError: No Hardware I2C on (scl, sda)=(1,0)
Valid UART ports: ((1, 3, 2),)
--------------------------------------------------------------------------------------------------------

If I'm reading that right, and in light of what you've said, it almost looks to me like the code is pointing to the wrong bus then? How would I fix that? (I used to be a VB/SQL coder about 10 years ago.)

Thanks,
pete

jrprinter
 
Posts: 24
Joined: Fri Jan 18, 2019 9:02 am

Re: HELP! Adafruit 16x2 Character LCD + Keypad for Raspberry

by adafruit_support_mike on Wed Jan 23, 2019 1:05 am

That could mean the code doesn't support the oldest RasPis with I2C on bus zero. Let me check with the folks who handle that code.

adafruit_support_mike
 
Posts: 64815
Joined: Thu Feb 11, 2010 2:51 pm

Please be positive and constructive with your questions and comments.