17maifra
Posts: 2
Joined: Wed Nov 13, 2019 5:06 pm

Both devices need to use SDA and SCL

Fri Dec 20, 2019 5:07 pm

Hello,

I am a beginner with physical computing. I would like to connect a joystick to a raspberry pi and also connect a I2C LCD screen to the raspberry pi. For the project, I want to make a menu appear on the LCD screen and I want to use the joystick to navigate through the menu. The problem is that the joystick connects to an analog to digital chip and that chip connects to the pins 3 and 5 (SDA and SCL) on the raspberry pi, but the LCD screen also needs to connect to the raspberry pi on those same pins. I have included a fritzing diagram of the connection for the joystick and another for the connection of the LCD screen. Is there a way to connect both these devices on one raspberry pi?

Image
Image
Attachments
Capture d’écran, le 2019-12-20 à 09.57.36.png
I2C LCD fritzing diagram
Capture d’écran, le 2019-12-20 à 09.57.36.png (72.02 KiB) Viewed 315 times
Capture d’écran, le 2019-12-20 à 09.58.17.png
Joystick fritzing diagram
Capture d’écran, le 2019-12-20 à 09.58.17.png (79.72 KiB) Viewed 315 times

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

Re: Both devices need to use SDA and SCL

Fri Dec 20, 2019 5:10 pm

I2C is a bus. Multiple devices may be connected in parallel.

alphanumeric
Posts: 2566
Joined: Tue Jan 19, 2016 2:17 pm
Location: Sydney, Nova Scotia, Canada

Re: Both devices need to use SDA and SCL

Mon Dec 23, 2019 8:46 pm

As mentioned i2c is a shared bus, multiple devices are allowed, as long as no two devices share the dame i2c address.
If you open a terminal window and run sudo i2cdetect -y 1 it will display what addresses are in use for the devices connected.

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