Jaggedpath
Posts: 4
Joined: Wed Dec 31, 2014 7:09 pm
Location: Canada

Simultaneously running 2 or more 16x2 LCD's causes them to stop working

Fri Mar 16, 2018 2:37 pm

Hi Everyone,

I have a project where I need to connect up to 4 16x2 LCD's to a Pi 3's i2c bus.
Each screen works great on it's own, but won't play nice when all connected together.

I've got 4 basic 16x2 LCD's and backpacks wired up, connected to the Pi's 5V, GND, SCL and SDA pins.

I set each LCD's backpack to a different address:

0x24
0x25
0x26
0x27

I also have a real time (RASclock) clock on the i2c bus, running at 0x51.
I can scan the i2c bus using: sudo i2cdetect -y 1 and it returns all the addresses no problem.

If I run a test Python program that displays characters on a single specific LCD address, it works great.
As soon as I try to run the same program (different addresses obviously) on two of the screens (using sudo python lcd1.py & sudo python lcd2.py &) it works for about 20 or 30 seconds then gives an error and one of the LCD's will stop working.

There are 4 rotary encoders (with push button) in the project as well connected to GPIO pins and they all work fine together.

I'm learning, but a bit stumped by this one.
I suspect it's something simple I'm overlooking (or just ignorant of at this point) in the lcd python code conflicting with the two instanced of the program running.

Any help or pointers greatly appreciated!
Thanks
Aaron

danjperron
Posts: 3095
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: Simultaneously running 2 or more 16x2 LCD's causes them to stop working

Fri Mar 16, 2018 3:53 pm

Hum what type of i2c signal you need to send. It is possible that the I2C commands you send are split in multiple packet of i2c . This is one of the problem with i2c eerom. So my question is how do you prevent cross communication on your i2c. do you use a locking mecanism? Normally because of the I2C address is not suppose to be a problem but I got it once when I hardcode in low level.

Also about power where is the lcd connected. Is all lcds powered with the PI connector? What is their current consumption?

On I2C there should be only one place with pull-up resistors. Does your lcd have pull-up on the i2c pins?

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 20929
Joined: Sat Jul 30, 2011 7:41 pm

Re: Simultaneously running 2 or more 16x2 LCD's causes them to stop working

Fri Mar 16, 2018 4:38 pm

Does it work if you have one program that accesses all the displays from one? I wonder if there is some sort of conflict with opening up the I2C bus from different processes.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Please direct all questions to the forum, I do not do support via PM.

Jaggedpath
Posts: 4
Joined: Wed Dec 31, 2014 7:09 pm
Location: Canada

Re: Simultaneously running 2 or more 16x2 LCD's causes them to stop working

Sat Mar 17, 2018 12:16 am

Hi Everyone,

Thank you for the quick and helpful responses!

With some effort (a lot) I combined my python scripts for the LCDs into one package and I can now control all of them (and the 4 rotary encoders) separately without any errors or outright crashes of the code.
There must have been a conflict somewhere when the old code was forced to run simultaneously.
I'm learnding. lol
Screen Shot 2018-03-16 at 8.12.17 PM.png
Screen Shot 2018-03-16 at 8.12.17 PM.png (79.44 KiB) Viewed 374 times
Thanks again for your help!
It's greatly appreciated.

Take care
Aaron

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