0
votes

I want to connect Raspberry Pi with 2 Devices via I2C. How is it possible to connect 1 SCL and SDA with two devices.

3
I do not have an answer for your question offhand, but I suspect that you might get more interest on raspberrypi.stackexchange.com or electronics.stackexchange.com . Best of luck! I will also point out that I2C is a serial daisy chainable format, where each device has it's own address, so I'm not sure what the trouble would be connecting 2 I2C devices. - Dan

3 Answers

0
votes

I believe that it's possible to operate both simultaneously. This site shows the pins on the raspberry pi 2 and later - pins 3 and 5 are SDA and SCL, in that order. RASPBERRY PI GPIO pin descriptions

For every project that I've used I2C with on the raspberry pi, I've had to use code to instruct the pins. Here's a good tutorial:

I2C on Raspberry Pi Tutorial

0
votes

You don't need any code to set up the camera. It plugs into a port specifically designed for the camera. You do need code to run the camera, though (like to take pictures and video and stuff). Here's an example of a shell script that will take a picture: (go to the terminal, type in the following command, hit enter, and the camera should blink red when it takes the picture):

raspistill -o testImage.jpg

Here's another example of code that will display the video output of the camera (though not recording) until you hit "CTRL + C":

raspivid -o video.h264

To view your picture, go to the GUI ("startx" + enter on the command line) of your operating system. If you go into your files, you should be able to find the image that you saved.

The GPIO pins are controlled quite differently. If you've never used them before, the best way to start is to look at the libraries available to control the GPIO pins. I like the wiringPi library: it's meant to set up the raspberry pi's GPIO pins to be controlled like an arduino. The following link will take you to the wiringPi website, with an example of how to get started by blinking an LED. WiringPi Library Tutorial: Blink

Good luck!

0
votes

You can do it. I2C protocol lets to connect up to 128 devices. For Raspberry Pi you can do it using one of popular libraries like WiringPi.

You have to have ID/address of each device to reach its internal registers using wiringPiI2CRead or other functions.