Tomi20
Posts: 1
Joined: Fri Dec 26, 2014 8:39 am

I2C to 16x2 LCD converter - voltage and RPi connection.

Fri Dec 26, 2014 9:31 am

Hello everyone!
I'm working on a simple project with my RPi, but I ran into a problem.
I've got a display powered by 5V ( and the i2c converter too! ). And hence RPi logical IO pins only accepts 3.3V.
The i2c converter has got a 4.7K Ohm pull up resistor for the i2c bus rails ( whatever that could mean :roll: )
And here my question: Can I connect the Display ( I mean the display with the converter ) to the Raspberry directly ( to the i2c bus ) or should I use a logical voltage shifter to run the display?

Btw. Here's a image from the i2c converter ( I haven't got a schematic from that.. ) ( this is from a local shop here in Poland :P ):
Image

Thanks in advance!

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5547
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: I2C to 16x2 LCD converter - voltage and RPi connection.

Fri Dec 26, 2014 10:46 am

Tomi20 wrote:Hello everyone!
I'm working on a simple project with my RPi, but I ran into a problem.
I've got a display powered by 5V ( and the i2c converter too! ). And hence RPi logical IO pins only accepts 3.3V.
The i2c converter has got a 4.7K Ohm pull up resistor for the i2c bus rails ( whatever that could mean :roll: )
And here my question: Can I connect the Display ( I mean the display with the converter ) to the Raspberry directly ( to the i2c bus ) or should I use a logical voltage shifter to run the display?
Btw. Here's a image from the i2c converter ( I haven't got a schematic from that.. ) ( this is from a local shop here in Poland :P ):
Image
Thanks in advance!
I usually use level converters with such.** It may be possible to to make it work by removing the on board pull-ups and lowering the (external) "5V" supply with a series diode but YMMV.
Trev.
** see here:
http://www.cpmspectrepi.webspace.virgin ... D_Backpack
http://www.cpmspectrepi.webspace.virgin ... e_Backpack
http://www.cpmspectrepi.webspace.virgin ... erial.html
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, and a A+) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

User avatar
dentex
Posts: 180
Joined: Sun May 20, 2012 7:58 am
Location: Italy
Contact: Website

Re: I2C to 16x2 LCD converter - voltage and RPi connection.

Sat Jan 17, 2015 9:31 am

Hello guys,
I've got the same LCD + I2C pack.
I'm sorry I don't understand if it's safe or not to connect the VCC pin directly to a RPi's 5V gpio pin.
Oh another thing (...this stuff comes with no instructions :D ); is the "LED" jumper to enable/disable the power-on LED?

Thanks for any help.
One of my projects with the Raspberry Pi:
--------------------------------------------------------
(Raspberry) Pi Aquarium Controller: https://github.com/dentex/piac

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5547
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: I2C to 16x2 LCD converter - voltage and RPi connection.

Sat Jan 17, 2015 9:47 am

dentex wrote:Hello guys,
I've got the same LCD + I2C pack.
I'm sorry I don't understand if it's safe or not to connect the VCC pin directly to a RPi's 5V gpio pin.
Oh another thing (...this stuff comes with no instructions :D ); is the "LED" jumper to enable/disable the power-on LED?
Thanks for any help.
Vcc can be connected to the Pi's 5V supply pin on the GPIO header (the GPIO pins themselves are all 3.3V logic high, or ~0V logic low when used as outputs). However, without a level-converter, the LCD module may not respond to the control signals as 3.3V is not quite "high enough" for 5V logic circuitry). (See my previous post for circuit examples etc.)
The jumper enables the display's backlight led.
Trev.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, and a A+) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

User avatar
B.Goode
Posts: 9818
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: I2C to 16x2 LCD converter - voltage and RPi connection.

Sat Jan 17, 2015 9:55 am

My apparently similar device worked fine following the instructions on the site of the vendor who supplied it.

http://store.ryanteck.uk/collections/el ... =751997007

No guarantees that your device is actually the same.

"I don't understand if it's safe or not to connect the VCC pin directly to a RPi's 5V gpio pin."

An RPi does NOT have a 5V gpio pin! All GPIO pins function at 3.3v. However, the header on the RPi board has a mixture of connection types: some are Ground (0v), some are 3.3v, some are 5v, and some are GPIO. I know that's pedantic, but it is an important detail.

User avatar
dentex
Posts: 180
Joined: Sun May 20, 2012 7:58 am
Location: Italy
Contact: Website

Re: I2C to 16x2 LCD converter - voltage and RPi connection.

Sat Jan 17, 2015 10:08 am

Thanks for the link, I've just had a look: LCD seems the same, while I'm not so sure about the I2C module. I think I'll go for it, anyway.

... and of course you did right to point out the precise definition about connections.
One of my projects with the Raspberry Pi:
--------------------------------------------------------
(Raspberry) Pi Aquarium Controller: https://github.com/dentex/piac

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5547
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: I2C to 16x2 LCD converter - voltage and RPi connection.

Sat Jan 17, 2015 10:45 am

B.Goode wrote:My apparently similar device worked fine following the instructions on the site of the vendor who supplied it.
...
[Slightly off-topic] Out of curiosity do you happen to know the exact "LCD 'E' strobe" (high pulse) timing you are using? I've come across some intriguing issues w.r.t. that, especially for the "4-bit" interface using I2C port expanders such as the PCF8574 (as per the O.P.'s module) cf. the MCP23017 (which is quite often used w/o level conversion on the I2C bus). FWIW, some brief notes are here**:
http://www.cpmspectrepi.webspace.virgin ... gData.html
Trev.
** More detailed info. (w.r.t. circuit details etc.) can be found elsewhere in my webpages.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, and a A+) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

User avatar
B.Goode
Posts: 9818
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: I2C to 16x2 LCD converter - voltage and RPi connection.

Sat Jan 17, 2015 6:04 pm

FTrevorGowen wrote:
B.Goode wrote:My apparently similar device worked fine following the instructions on the site of the vendor who supplied it.
...
[Slightly off-topic] Out of curiosity do you happen to know the exact "LCD 'E' strobe" (high pulse) timing you are using?
Sorry, no. Because I have only used the i2c 'backpack' version of the device, so those details have been taken care of 'internally' and I have only used the 4-wire i2c physical connection and the sample code from Ryanteck. The driver code is only 100 lines - https://bitbucket.org/ryanteckltd/16x2- ... ?at=master but I don't think that exposes the level of interfacing you are concerned with.

In case it helps, there is a similar device with Ardunio support available from 4tronix - http://4tronix.co.uk/arduino/I2C_LCD_Module.php

I do have a 'bare' 16x2 LCD module together with a MyPiFi lcd adaptor board that needs soldering up, but I've never got round to putting them together and experimenting with them, so I've never encountered the issue you are trying to investigate.

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5547
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: I2C to 16x2 LCD converter - voltage and RPi connection.

Sat Jan 17, 2015 9:27 pm

B.Goode wrote:
FTrevorGowen wrote:
B.Goode wrote:My apparently similar device worked fine following the instructions on the site of the vendor who supplied it.
...
[Slightly off-topic] Out of curiosity do you happen to know the exact "LCD 'E' strobe" (high pulse) timing you are using?
Sorry, no. Because I have only used the i2c 'backpack' version of the device, so those details have been taken care of 'internally' and I have only used the 4-wire i2c physical connection and the sample code from Ryanteck. The driver code is only 100 lines - https://bitbucket.org/ryanteckltd/16x2- ... ?at=master but I don't think that exposes the level of interfacing you are concerned with.
...
Thank you for the feedback. I took a peek at the "Ryanteck driver code". Although it's in Python, which I don't use, if I'm interpreting the sleep() function's units correctly as seconds, then the "LCD 'E' strobe" is being pulsed high for 0.0005 seconds or 500 micro-seconds, similar to my findings of 612 micro-seconds needed within my wiringPi-based 'C' code for reliable** operation of PCF8574-based (I2C) 4-bit "backpack" interfaces to the 5V LCD displays I've tried****. This is significantly longer than the 1 microsecond usable with a direct (level-shifted) GPIO connection!
Trev.
** Some displays would work with a shorter pulse length.
**** http://www.cpmspectrepi.webspace.virgin ... plays.html
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, and a A+) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

sylvan
Posts: 118
Joined: Sun Nov 27, 2011 8:39 pm

Re: I2C to 16x2 LCD converter - voltage and RPi connection.

Thu Apr 23, 2015 6:32 am

I have a 20x4 display with what appears to be the same I2C adaptor originally pictured, using a PCF8574 I2C to 8-bit parallel chip.

My adaptor (because of the LCD) requires 5v. With the pullups on the I2C lines (clock and data are pulled toward 5v) it is not safe to connect those lines to the Raspberry Pi. It is fine to power the display from the Pi's 5v connection. With the I2C lines disconnected from the Pi, you can measure 5v on those lines. Danger!

I was able to remove (unsolder) the two pullups and now the lines measure 0v. So I connected them to my Raspberry Pi and the display works great.

On my board, and I suspect also on the O.P.'s the two pullups are the two tiny black parts labeled 472 nearest the PCF8574 - one immediately adjacent to the chip and the next beside it. Don't touch the other one labeled 472 or anything not labeled 472.

sdb

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5547
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: I2C to 16x2 LCD converter - voltage and RPi connection.

Thu Apr 23, 2015 7:09 am

sylvan wrote:I have a 20x4 display with what appears to be the same I2C adaptor originally pictured, using a PCF8574 I2C to 8-bit parallel chip.
My adaptor (because of the LCD) requires 5v. With the pullups on the I2C lines (clock and data are pulled toward 5v) it is not safe to connect those lines to the Raspberry Pi. It is fine to power the display from the Pi's 5v connection. With the I2C lines disconnected from the Pi, you can measure 5v on those lines. Danger!
...
sdb
Or interpose "I2C safe" level-shifters:
http://www.cpmspectrepi.webspace.virgin ... dules.html
Trev.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, and a A+) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

User avatar
mikronauts
Posts: 2770
Joined: Sat Jan 05, 2013 7:28 pm
Contact: Website

Re: I2C to 16x2 LCD converter - voltage and RPi connection.

Thu Apr 23, 2015 1:14 pm

FYI,

Pi Jumper provides a 5V I2C interface (and 3V3 interface), and also breaks out the original 26 pin GPIO to a single row header.

http://www.mikronauts.com/raspberry-pi/pi-jumper/
http://Mikronauts.com - home of EZasPi, RoboPi, Pi Rtc Dio and Pi Jumper @Mikronauts on Twitter
Advanced Robotics, I/O expansion and prototyping boards for the Raspberry Pi

CRImier
Posts: 37
Joined: Sat Apr 05, 2014 4:34 pm
Contact: Website

Re: I2C to 16x2 LCD converter - voltage and RPi connection.

Sat Apr 23, 2016 2:00 pm

Hi!

For all interested, I've tried the "remove pullups" method and it didn't work reliably for me. I did an Instructable on this: instructables.com/id/Raspberry-Pi-Using-1-I2C-LCD-Backpacks-for-1602-Sc/ , it tells tells you how to modify that backpack, as well as provides Python code for driving it.
hackaday.io/CRImier
Current project - ZeroPhone

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5547
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: I2C to 16x2 LCD converter - voltage and RPi connection.

Sun Apr 24, 2016 1:00 pm

CRImier wrote:Hi!

For all interested, I've tried the "remove pullups" method and it didn't work reliably for me. I did an Instructable on this: instructables.com/id/Raspberry-Pi-Using-1-I2C-LCD-Backpacks-for-1602-Sc/ , it tells tells you how to modify that backpack, as well as provides Python code for driving it.
Can you clarify - which pullups? OOC, did you also try varying the "E-strobe" timing/length (as per my observations**)
Trev.
** Updated link as my webpages have had to be moved:
https://www.cpmspectrepi.uk/raspberry_p ... gData.html
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, and a A+) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

User avatar
w4mmp
Posts: 54
Joined: Thu Mar 26, 2015 3:11 pm

Re: I2C to 16x2 LCD converter - voltage and RPi connection.

Sun Apr 24, 2016 2:57 pm

Hi,

In the "for what its worth" category. Attached is source code that will drive a LCD1602 display commonly available on the internet.
The source is from http://wiki.friendlyarm.com/wiki/index. ... 2C_LCD1602 and has been modified to use Mike McCauley's BCM 2835 library located here: http://www.airspayce.com/mikem/bcm2835/index.html. It is rude and crude but it works. A question remains (I think) if it safe to attach the I2C interface of the display to the RPi I2C interface. It has been attached to my RPi 2 for several days with no ill effects (so far). However, if I have read the spec document correctly for the I2C (PCF8574) expander chip, it has no internal pull ups. This means the pull ups on the RPi 2 I2C lines are bringing the lines to a 3.3V level. So it appears it is safe. However the spec sheet calls for .7 x Vdd. The display runs at 5V so it needs 3.5V for a high. The 3.3V of the RPi is not quite in the ball park. But, things seem to work anyway.

Regards,
Ron
Attachments
display-test.tar.gz
(26.12 KiB) Downloaded 147 times
73,
Ron / W4MMP

User avatar
joan
Posts: 14838
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: I2C to 16x2 LCD converter - voltage and RPi connection.

Sun Apr 24, 2016 5:27 pm

w4mmp wrote:Hi,

In the "for what its worth" category. Attached is source code that will drive a LCD1602 display commonly available on the internet.
The source is from http://wiki.friendlyarm.com/wiki/index. ... 2C_LCD1602 and has been modified to use Mike McCauley's BCM 2835 library located here: http://www.airspayce.com/mikem/bcm2835/index.html. It is rude and crude but it works. A question remains (I think) if it safe to attach the I2C interface of the display to the RPi I2C interface. It has been attached to my RPi 2 for several days with no ill effects (so far). However, if I have read the spec document correctly for the I2C (PCF8574) expander chip, it has no internal pull ups. This means the pull ups on the RPi 2 I2C lines are bringing the lines to a 3.3V level. So it appears it is safe. However the spec sheet calls for .7 x Vdd. The display runs at 5V so it needs 3.5V for a high. The 3.3V of the RPi is not quite in the ball park. But, things seem to work anyway.

Regards,
Ron
Connect 5V power and ground but don't connect SDA or SCL.

Measure the voltage between SDA/SCL and Pi ground. I reckon it will be 5V as the module itself has pull-ups to Vcc.

The advice always has been not to connect 5V to a Pi's GPIO.

The module pull-ups are probably 4k7. So I guess the excess current is limited to (5000-3300)/4700 mA, or 0.36 mA. I guess the GPIO protection is managing to sink the excess (a figure of 0.5 mA is mentioned).

User avatar
w4mmp
Posts: 54
Joined: Thu Mar 26, 2015 3:11 pm

Re: I2C to 16x2 LCD converter - voltage and RPi connection.

Sun Apr 24, 2016 6:34 pm

Hi,
Yes, you are absolutely correct. I can live with it for now as the final destination of the display is for different device. I use the RPi 2 for code development and initial testing. The code developed on the RPi 2 is about 80 to 90% portable to the final device (Cypress PSoC 5). Just much easy to develop here and then move the code over.

(If someone really wanted to use this display on the RPi, then yes, I suppose a level shifter is called for.)


Thanks for your insights,
Regards,
73,
Ron / W4MMP

CRImier
Posts: 37
Joined: Sat Apr 05, 2014 4:34 pm
Contact: Website

Re: I2C to 16x2 LCD converter - voltage and RPi connection.

Mon Apr 25, 2016 7:24 pm

FTrevorGowen wrote:
CRImier wrote:Hi!

For all interested, I've tried the "remove pullups" method and it didn't work reliably for me. I did an Instructable on this: instructables.com/id/Raspberry-Pi-Using-1-I2C-LCD-Backpacks-for-1602-Sc/ , it tells tells you how to modify that backpack, as well as provides Python code for driving it.
Can you clarify - which pullups? OOC, did you also try varying the "E-strobe" timing/length (as per my observations**)
Trev.
** Updated link as my webpages have had to be moved:
https://www.cpmspectrepi.uk/raspberry_p ... gData.html
The I2C pullup resistors on the I2C backpack board. I don't remove them, basically, I run the backpack from 3.3V and the LCD from 5V, and it works great. Raspberry Pi fully safe, and LCD runs good. I don't even have any delay between (send byte without pulse, send byte with pulse, send byte without pulse) - my LCD is OK with that, I2C is slow enough for it.
hackaday.io/CRImier
Current project - ZeroPhone

Lalo_UY
Posts: 1
Joined: Mon Jul 29, 2019 1:18 pm

Re: I2C to 16x2 LCD converter - voltage and RPi connection.

Mon Jul 29, 2019 1:29 pm

Th I2C board work ok a 3,3V, so just separate the Vcc of LCD & I2C board.
Cut the trace on the top layer from Vcc pin in the side 4 pin I2C connector to the second pin on the top Display connector. Add a pin in that last pin for providing 5V to the LCD.

Look like this:

Image

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5547
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: I2C to 16x2 LCD converter - voltage and RPi connection.

Mon Jul 29, 2019 5:01 pm

Lalo_UY wrote:
Mon Jul 29, 2019 1:29 pm
Th I2C board work ok a 3,3V, so just separate the Vcc of LCD & I2C board.
Cut the trace on the top layer from Vcc pin in the side 4 pin I2C connector to the second pin on the top Display connector. Add a pin in that last pin for providing 5V to the LCD.

Look like this:

Image
Unfortunately that just moves the possible 3.3V vs 5V "logic high" potential mismatch to the main LCD interface. Since my previous posts here (quite some time ago!) I built and tested a reduced (from 5V to ~4.4V) supply for both the I2C chip and the LCD - details are here:
http://www.cpmspectrepi.uk/raspberry_pi ... iPlus.html
Trev.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, and a A+) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

Return to “Interfacing (DSI, CSI, I2C, etc.)”