Page 2 of 2

Re: I2C LCD not detected

Posted: Tue Oct 29, 2013 9:08 pm
by jr1988
The way the I2C bus works:

(1) Each I2C line in the bus has a pull-up resistor to 3.3V. This means that when the device is idle, the Raspberry Pi will read a 'high' signal on the SDA and SCL lines, at 3.3V
(2) Devices communicate over the bus by pulling the lines down to ground.
(3) There is a master device and a slave device. In our case, the Raspberry Pi is the 'master', and the LCD subsystem is the 'slave'.
(4) Only the master can drive voltage. This means the LCD 'slave' cannot push the voltage up to 5V on the SDA or SCL.

Hence, the bus will have signals at either 3.3V or ground. You don't need a level shifter for an I2C slave device to talk with the Raspberry Pi. It's ok if the LCD device is a 5V device.

Hence, I suggest you keep your LCD device's supply voltage at the correct rated voltage (5V), and check your I2C driver to make sure it's operating as intended. Could be easiest to just download a module online. You could also easily get an EEPROM chip or something that also communicates via I2C to validate the setup.

Here's a good blog post I found which articulates this, perhaps more clearly:
http://blog.oddbit.com/post/i2c-on-the-raspberry-pi

Re: I2C LCD not detected

Posted: Wed Oct 30, 2013 1:49 am
by techpaul
jr1988 wrote:The way the I2C bus works:

(1) Each I2C line in the bus has a pull-up resistor to 3.3V. This means that when the device is idle, the Raspberry Pi will read a 'high' signal on the SDA and SCL lines, at 3.3V
(2) Devices communicate over the bus by pulling the lines down to ground.
(3) There is a master device and a slave device. In our case, the Raspberry Pi is the 'master', and the LCD subsystem is the 'slave'.
(4) Only the master can drive voltage. This means the LCD 'slave' cannot push the voltage up to 5V on the SDA or SCL.

Hence, the bus will have signals at either 3.3V or ground. You don't need a level shifter for an I2C slave device to talk with the Raspberry Pi. It's ok if the LCD device is a 5V device.
INCORRECT a lot of devices WILL work but NOT ALL, this depends on
  1. Input thresholds of the I2C device at 5V being able to recognise the 3V to 3V3 level as high
  2. Some devices have serial resistors internally most notably COG LCDs with I2C built into the glass of the LCD, I have seen some that will NOT work with Pi as they cannot pull the line low enough for ACK to be recognised by the Pi even if powered by 5V, in this case they expected the I2C to be pulled up to 5V with a minimum of 10k (see attached scope image of just this case)
In that case they expected me to patch the I2C driver to IGNORE ACKs and break I2C.

Re: I2C LCD not detected

Posted: Wed Oct 30, 2013 1:52 am
by techpaul
lolouk44 wrote:Hi rainierez,

Everything works fine when powered with +3.3V (when powering with +5V the LCD is not recognised.
I've been using the LCD for just a couple of weeks now and the only issue I still get is that sometimes the data will become scrambled on the LCD. would the same script be called simultaneously (or in very quick succession) send too much data at the same time on the I2C and therefore confuse the LCD?
Yes lots of I2C to LCD adapters rely on WAIT states (slowing the I2C temporarily), in ways that comply with I2C spec but not how the Pi hardware works
If so, do you have a suggestion on how to manage data sent / received via I2C as I'm planning on adding more I2C devices.
slow the speed of I2C or use a different method to control an LCD or alternative I2C LCD

Re: I2C LCD not detected

Posted: Wed Oct 30, 2013 2:12 am
by jr1988
I stand corrected.. Thanks for the explanation!

Re: I2C LCD not detected

Posted: Wed Oct 30, 2013 8:44 am
by techpaul
techpaul wrote:
lolouk44 wrote:Hi rainierez,

Everything works fine when powered with +3.3V (when powering with +5V the LCD is not recognised.
I've been using the LCD for just a couple of weeks now and the only issue I still get is that sometimes the data will become scrambled on the LCD. would the same script be called simultaneously (or in very quick succession) send too much data at the same time on the I2C and therefore confuse the LCD?
Yes lots of I2C to LCD adapters rely on WAIT states (slowing the I2C temporarily), in ways that comply with I2C spec but not how the Pi hardware works
Should have explained better these WAIT states are referred to as Clock Stretching and has been discussed many times in these forums.

Good set

Posted: Sat Oct 29, 2016 8:48 am
by Paysan
Thanks a lot for this article! Everything works perfect. To be save I removed the 2 pull-up resistors on the scl and sda lines on the I2C board.
The Raspberry has already build-in these pull-ups. And by removing them the Raspberry will never will receive 5 volt from the pull-ups on the I2C board.

Wim