i2c lcd works only if more one device connected

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
Kestel
Posts: 3
Joined: Sun Feb 12, 2017 5:48 pm

i2c lcd works only if more one device connected

Post by Kestel » Sun Feb 12, 2017 7:18 pm

Hello, I'm playing with i2c on my nodemcu board (LoLin v3), micropython version 1.8.7 (esp8266-20170108-v1.8.7.bin).
I'm trying to begin LCD 1604 (or 2004) works with my board.

When I connect just LCD to the ESP - it doesn't works.
i2c.scan() show nothing
>>> i2c = I2C(-1, scl=Pin(5), sda=Pin(4))
>>> i2c.scan()
[]

For tests I've connect BMP180 sensor to i2c bus and i2c.scan shows both devices!
>>> i2c.scan()
[39, 119]

BMP180 sensor works fine alone:
>>> i2c.scan()
[119]

But LCD can't works alone at all.

But this screen works well on my RPi2 board, or arduino.
I've tried it same wiring and same configuration with Arduino ESP8266 firmware with this sketch:
https://gist.github.com/kestel/e84115c5 ... 15804b4361
And it works well. Show all lines.

tech1337
Posts: 2
Joined: Mon Feb 13, 2017 12:58 am

Re: i2c lcd works only if more one device connected

Post by tech1337 » Mon Feb 13, 2017 1:08 am

I had two issues with my LCD display,

1) The signal voltage on the bus is 3.3v, my LCD takes 5v logic high, so grab some logic level changer ICs for that
2) On the electronics side, pullup resistors are needed on the bus, if they are on the i2c board, the above will be needed, if not and you already are using a level changer, try adding in some pullups to get the LCD to appear.

It would seem either could be an issue, due to the fact that adding more devices is either pulling the rails up in hardware or is leaking power onto the signal lines somehow.

Hope this helps somewhat! :)

User avatar
deshipu
Posts: 1388
Joined: Thu May 28, 2015 5:54 pm

Re: i2c lcd works only if more one device connected

Post by deshipu » Mon Feb 13, 2017 9:17 am

You don't actually need a level converter between 3.3V and 5V devices -- their logic levels are close enough to work. You just have to remember to put the pullup resistors to the 3.3V and not 5V, so that you don't damage the 3.3V device with 5V signal.

fdufnews
Posts: 76
Joined: Mon Jul 25, 2016 11:31 am

Re: i2c lcd works only if more one device connected

Post by fdufnews » Mon Feb 13, 2017 12:57 pm

@Kestel
You probably need to add pullup resistors on SDA ands SCL.
On I²C bus, the lines are open-collectors. You shall add a resistor (4,7k for a medium speed bus) to 3.3V on both SDA and SCL.
The board with the BMP180 you are using probably add those resistors for you.

Edit: corrected voltage error for pullup
Last edited by fdufnews on Mon Feb 13, 2017 6:14 pm, edited 3 times in total.

User avatar
deshipu
Posts: 1388
Joined: Thu May 28, 2015 5:54 pm

Re: i2c lcd works only if more one device connected

Post by deshipu » Mon Feb 13, 2017 3:00 pm

fdufnews wrote: On I²C bus, the lines are open-collectors. You shall add a resistor (4,7k for a medium speed bus) to 5V on both SDA and SCL.
Not to 5V. If you add it to 5V, the pins will receive 5V voltage, and they are not prepared for that and can be damaged. The pullups should be to the 3.3V.

Kestel
Posts: 3
Joined: Sun Feb 12, 2017 5:48 pm

Re: i2c lcd works only if more one device connected

Post by Kestel » Mon Feb 13, 2017 3:33 pm

Hello guys,

Thank you for help. Pull-up resistors help me.

I have tested it with two pull up resistors (4.7k and 10k also works fine). From SDA and SCL to 3v.

Kestel
Posts: 3
Joined: Sun Feb 12, 2017 5:48 pm

Re: i2c lcd works only if more one device connected

Post by Kestel » Mon Feb 13, 2017 3:34 pm

And as @fdufnews said - my BMP180 board already has resistors.

fdufnews
Posts: 76
Joined: Mon Jul 25, 2016 11:31 am

Re: i2c lcd works only if more one device connected

Post by fdufnews » Mon Feb 13, 2017 6:11 pm

deshipu wrote:
fdufnews wrote: On I²C bus, the lines are open-collectors. You shall add a resistor (4,7k for a medium speed bus) to 5V on both SDA and SCL.
Not to 5V. If you add it to 5V, the pins will receive 5V voltage, and they are not prepared for that and can be damaged. The pullups should be to the 3.3V.
Of course. Sorry for the mistake.

Post Reply