Using multiple sensors
One of the best features of Trill sensors is their flexibility - you can use one sensor, or chain together up to 9 sensors of the same type to make large interactive surfaces. You can also mix and match tens of sensors of different types in your project, taking advantage of lots of different sensing types to make a totally custom interface.
This article explains how to use multiple sensors of one type, as well as sensors of different types.
Table of contents
- Changing addresses
- Using multiples of one Trill sensor
- Using different types of Trill sensors
- Reading from multiple sensors
In order to use more than one Trill sensor of the same type together, each sensor must have a unique I2C address.
To learn about the default addresses of each sensor type and about how to change the address of a sensor see the all about I2C page.
Using multiples of one Trill sensor
All Trill sensors use the same I2C bus. This means that all SCL, SDA, GND and VCC wires are connected.
In this example, a Bela Mini is used with three Trill Ring sensors. Though the side rails on a breadboard are usually used for power and ground, they’re a convenient way of connecting multiple wires to any single point:
You can connect up to 8 sensors of the same type together, providing they all have unique I2C addresses. See this article for a guide to customising I2C addresses.
Using different types of Trill sensors
To use different types of Trill sensor, just connect the groups of wires together as described above. Here is an example of what this would look like with 4 Trill sensor types and an Arduino Uno:
If you’re only using one of each type no further customisation is needed, as each type will have a different default I2C address. If you have more than one of the same type, make sure you change the address of each additional sensor of that type using the method described in guide to customising I2C addresses.
In the diagram above we don't include pullup resistors because in our testing they haven't been necessary. However, every project is different, and if you are using multiple Trill sensors and find they're inconsistent or unresponsive, we recommend trying pullup resistors. Check out this article section for a discussion on what pullups are and how to use them.
Reading from multiple sensors
If you have changed the default address of a sensor via the solder bridges because you are using multiple sensors of the same type at once then you will need to define that new address in the
.setup() function. The second optional argument to
.setup() will define the address of the sensor. If not provided, the default address for the specified device type will be used instead.