I have a simple question to ask you about SDA and SCL pins. I have a gyro and I use these 2 pins to make it work; how can I use an accelerometer combined to a Gyro if these 2 pins are used? I should need another 2 SDA and SCL pins for the accelerometer... Tell me that I don't need to buy an IMU :D
EDIT: I'm using Gyro LG3D20H from Adafruit, reading gyro values each 10 ms.
-
Which gyro? Which accelerometer? Giving part numbers helps get a more specific answer.Nick Gammon– Nick Gammon ♦2016年01月14日 21:50:16 +00:00Commented Jan 14, 2016 at 21:50
-
Typically it should not be a problem to share them. Note that you can also get 6-axis sensors like the MPU6050 and similar which combine both functions in a single chip.Chris Stratton– Chris Stratton2016年01月15日 04:00:52 +00:00Commented Jan 15, 2016 at 4:00
1 Answer 1
I2C is designed to have multiple devices connected. Assuming the gyro and accelerometer have different I2C addresses they can both be connected to the same SDA and SCL pins.
For more information see http://www.gammon.com.au/i2c
Naturally you can only "talk to" one at a time. You may need pull-up resistors on both SDA and SCL, unless the hardware already has them.
-
For a newbie this thing is a bit complex. Do you have a "noob" guide to link me?Kowak– Kowak2016年01月14日 21:54:19 +00:00Commented Jan 14, 2016 at 21:54
-
As I said in my answer, you can share the SDA and SCL pins for both devices. If you have more questions please give more information.2016年01月14日 21:56:38 +00:00Commented Jan 14, 2016 at 21:56
-
As I said, I have a Gyro that use SDA and SCL. I'd like to buy an accelerometer and use both in the same time. I know that there are analog pins that I could use for accelerometer (or gyro, depends on which I put on SDA/SCL), but I need that both are on SDA and SCL. I'm not smart in electronics so I really don't know how to use that guide that you linked.Kowak– Kowak2016年01月14日 22:01:33 +00:00Commented Jan 14, 2016 at 22:01
-
@Kowak, to get specific answers you need to supply more-specific information. Please edit your question and add the model numbers or chip numbers of your gyro, and of accelerometers you are thinking of. Also tell how frequently you need to read them, and whether you've modified their I2C addressesJames Waldby - jwpat7– James Waldby - jwpat72016年01月14日 22:11:21 +00:00Commented Jan 14, 2016 at 22:11
-
I edited with my gyro name and frequency of gyro value readings. The problem is that I don't know which accelerometer I want to buy at the moment...Kowak– Kowak2016年01月15日 14:36:47 +00:00Commented Jan 15, 2016 at 14:36
Explore related questions
See similar questions with these tags.