Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 4 of 4

Thread: Can the audio board be used along with an I2C sensor?

  1. #1
    Senior Member
    Join Date
    Sep 2014
    Posts
    112

    Can the audio board be used along with an I2C sensor?

    Well, what the title asks really. I want to use the audio board along with a gyroscope and the simplest way is to use an I2C sensor. In Teensy's website I saw that the audio board uses both the SDA and SCL pins of the Teensy. So, is it possible to connect an I2C sensor while using the audio board?

    Thanks

  2. #2
    Senior Member
    Join Date
    Jul 2014
    Posts
    3,459
    Quote Originally Posted by alexandros View Post
    Well, what the title asks really. I want to use the audio board along with a gyroscope and the simplest way is to use an I2C sensor. In Teensy's website I saw that the audio board uses both the SDA and SCL pins of the Teensy. So, is it possible to connect an I2C sensor while using the audio board?

    Thanks
    you have only to make sure that I2C addresses are different. So in principle, yes, you can.

  3. #3
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    4,271
    Quote Originally Posted by alexandros View Post
    Well, what the title asks really. I want to use the audio board along with a gyroscope and the simplest way is to use an I2C sensor. In Teensy's website I saw that the audio board uses both the SDA and SCL pins of the Teensy. So, is it possible to connect an I2C sensor while using the audio board?

    Thanks
    To amplify what WMXZ said, the i2c bus is a shared bus where you can hook up multiple devices to the bus. Each device has an address that it listens to, and it ignores the other requests that go on the bus. Think of it as the old shared party telephone line used many years ago in some rural areas. All of the neighbors could listen in the conversation, and there was a distinctive ring tone for each house. Unlike SPI, I believe all devices have to be running at the same i2c speed.

    In general, you want all of the devices on the i2c bus to be fairly short distances away from each other and the total wire length short. If you add lots of devices, use longer wires, and/or change i2c bus speeds, you may need to be more careful about how the i2c bus is set up. In particular, you may need to tune the pull-up resistors. But it should work to add 1-2 more devices.

    Speaking of pull-up resistors, the Audio board supplies appropriate pull-up resistors to the i2c bus, so you don't have to add them separately. If your gyroscope also has pull-up resistors, you may need to remove them. Typically having 2 sets of pull-up resistors work, until you get to higher bus speeds. But I've read that it can be problematical on really complicated i2c setups.

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    26,779
    The SGTL5000 chip on the audio board has 2 possible addresses. The bottom side has pads you can cut apart and solder bridge to configure for the other address. So for any 1 other I2C chip, even if it conflicts with the I2C address, you can always just reconfigure the audio board for the other address. Look in the audio lib HardwareTesting menu for the quad channel examples, which have the way to configure the audio lib to use the alternate I2C address.

    But odds are slim you'll need to use this. Of course, without knowing which chip you plan to use or what its I2C address is, the best I can say is the 2 possible addresses the STGL5000 uses are quite different from the addresses of all the motion sensor chips I've seen.

    For a list of known address for common chips, look at File > Examples > Wire > Scanner. (this example is only in Teensy's version.. so make sure Teensy is selected before clicking the examples menu)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •