0

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.

asked Jan 14, 2016 at 21:16
2
  • Which gyro? Which accelerometer? Giving part numbers helps get a more specific answer. Commented 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. Commented Jan 15, 2016 at 4:00

1 Answer 1

2

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.

answered Jan 14, 2016 at 21:52
5
  • For a newbie this thing is a bit complex. Do you have a "noob" guide to link me? Commented 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. Commented 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. Commented 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 addresses Commented 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... Commented Jan 15, 2016 at 14:36

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.