Hi:
When boards with different functions are stacked on an UNO, how do you select which board you are communicating with? Is this like a CAN (Controller Area Network) where the various units on the network have unique addresses?
For instance on the UNO I have a shield that stores data in a Data Logging Shield, the UNO runs an FFT on the data and stores it via another shield on an SD card on another shield and that transform is sent over wifi to my computer.
How do you chip select on anther shield?
Thanks
Robert
Shield Stacking
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- michaelmeissner
- Posts: 1819
- Joined: Wed Aug 29, 2012 12:40 am
Re: Shield Stacking
It depends on the board. Basically when you are stacking shields, all pins on each board are connected at the same time to the other pins in the same position. It is like an old fashioned party line, where each person on the call chain could hear and talk to others on the same call chain.
You need to figure out which board uses which pins, and make sure they don't collide. For my personal use, I set up a google spreadsheet where I listed various Teensy shields, Feather wings, and QT PY BFF's. In these spreadsheets, I listed which pins each board used so that if I wanted to mix/match shields/wings, I would know which would be compatible. Since I moved away from the Arduino platform over 10 years ago, I haven't kept track of the various Arduino shields.
Some boards have solder jumpers that you can change which pins are used, to prevent conflicts.
If the boards just use I2C and not other pins, then they can be stacked, providing each I2C device has a unique address (all I2C devices share the same bus, but each device has an address to identify which I2C client the main board is talking to).
In a similar fashion, the 3 SPI main pins (MISO, MOSI, and SCLK) can be shared between SPI devices, but each SPI device has other pins (CS, D/C, reset, etc.) that must be unique. If you are sharing the main SPI bus, there are some devices that don't properly handle being shared, and you might also need to add pull-up or pull-down resistors on the CS and D/C pins.
You need to figure out which board uses which pins, and make sure they don't collide. For my personal use, I set up a google spreadsheet where I listed various Teensy shields, Feather wings, and QT PY BFF's. In these spreadsheets, I listed which pins each board used so that if I wanted to mix/match shields/wings, I would know which would be compatible. Since I moved away from the Arduino platform over 10 years ago, I haven't kept track of the various Arduino shields.
Some boards have solder jumpers that you can change which pins are used, to prevent conflicts.
If the boards just use I2C and not other pins, then they can be stacked, providing each I2C device has a unique address (all I2C devices share the same bus, but each device has an address to identify which I2C client the main board is talking to).
In a similar fashion, the 3 SPI main pins (MISO, MOSI, and SCLK) can be shared between SPI devices, but each SPI device has other pins (CS, D/C, reset, etc.) that must be unique. If you are sharing the main SPI bus, there are some devices that don't properly handle being shared, and you might also need to add pull-up or pull-down resistors on the CS and D/C pins.
- tultalk
- Posts: 64
- Joined: Thu May 14, 2020 7:00 pm
Re: Shield Stacking
Thanks for input. I have been ready to purchase some shields until I looked at pinout and saw conflicts and steered clear.
Regards
Robert
Regards
Robert
- tultalk
- Posts: 64
- Joined: Thu May 14, 2020 7:00 pm
Re: Shield Stacking
Hi: This sort of plays into shield stacking. The Arduinio library i2c_device_list.h contains addresses and I assume the addresses of cognizant boards/components.
For instance:
case 0x29:
return "BNO055 IMU (0x28 or 0x29)\n"
"TCS34725 color sensor (0x29 only)\n"
"TSL2561 light sensor (0x29, 0x39 or 0x49)\n"
"TSL2591 light sensor (0x29 only)\n"
"VL53L0x ToF distance (0x29, software selectable)\n"
"VL6180X ToF sensor (0x29)\n"
"CAP1188 8-channel Capacitive Touch (0x28 - 0x2D)";
The BNO055 IMU Sensor block reads data from the BNO055 IMU sensor that is connected to the hardware.
The BNO055 can output the following sensor data:
Absolute Orientation (Euler Vector, 100Hz) Three axis orientation data based on a 360° sphere
Absolute Orientation (Quatenrion, 100Hz) Four point quaternion output for more accurate data manipulation
Angular Velocity Vector (100Hz) Three axis of 'rotation speed' in rad/s
Acceleration Vector (100Hz) Three axis of acceleration (gravity + linear motion) in m/s^2
Magnetic Field Strength Vector (20Hz) Three axis of magnetic field sensing in micro Tesla (uT)
Linear Acceleration Vector (100Hz) Three axis of linear acceleration data (acceleration minus gravity) in m/s^2
Gravity Vector (100Hz) Three axis of gravitational acceleration (minus any movement) in m/s^2
Temperature (1Hz) Ambient temperature in degrees celsius
So each of the above breakouts will respond to a query on (0X29) return some data. So only one of these can be (0X29) on the IC2 bus
case 0x2A: These are all unassigned so can be used if the address can be hard coded on the board?
case 0x2B:
case 0x2C:
case 0x2D:
Thanks
Robert
For instance:
case 0x29:
return "BNO055 IMU (0x28 or 0x29)\n"
"TCS34725 color sensor (0x29 only)\n"
"TSL2561 light sensor (0x29, 0x39 or 0x49)\n"
"TSL2591 light sensor (0x29 only)\n"
"VL53L0x ToF distance (0x29, software selectable)\n"
"VL6180X ToF sensor (0x29)\n"
"CAP1188 8-channel Capacitive Touch (0x28 - 0x2D)";
The BNO055 IMU Sensor block reads data from the BNO055 IMU sensor that is connected to the hardware.
The BNO055 can output the following sensor data:
Absolute Orientation (Euler Vector, 100Hz) Three axis orientation data based on a 360° sphere
Absolute Orientation (Quatenrion, 100Hz) Four point quaternion output for more accurate data manipulation
Angular Velocity Vector (100Hz) Three axis of 'rotation speed' in rad/s
Acceleration Vector (100Hz) Three axis of acceleration (gravity + linear motion) in m/s^2
Magnetic Field Strength Vector (20Hz) Three axis of magnetic field sensing in micro Tesla (uT)
Linear Acceleration Vector (100Hz) Three axis of linear acceleration data (acceleration minus gravity) in m/s^2
Gravity Vector (100Hz) Three axis of gravitational acceleration (minus any movement) in m/s^2
Temperature (1Hz) Ambient temperature in degrees celsius
So each of the above breakouts will respond to a query on (0X29) return some data. So only one of these can be (0X29) on the IC2 bus
case 0x2A: These are all unassigned so can be used if the address can be hard coded on the board?
case 0x2B:
case 0x2C:
case 0x2D:
Thanks
Robert
- tultalk
- Posts: 64
- Joined: Thu May 14, 2020 7:00 pm
Re: Shield Stacking
More: HID I2C specification allows multiple DEVICES (I2C peripherals) to be connected to a single HOST (I2C Bus Controller), but each DEVICE must have its dedicated Interrupt line and I2C address.
The BNO055 can output the following sensor data:
Absolute Orientation (Euler Vector, 100Hz) Three axis orientation data based on a 360° sphere
Absolute Orientation (Quatenrion, 100Hz) Four point quaternion output for more accurate data manipulation
Angular Velocity Vector (100Hz) Three axis of 'rotation speed' in rad/s
Acceleration Vector (100Hz) Three axis of acceleration (gravity + linear motion) in m/s^2
Magnetic Field Strength Vector (20Hz) Three axis of magnetic field sensing in micro Tesla (uT)
Linear Acceleration Vector (100Hz) Three axis of linear acceleration data (acceleration minus gravity) in m/s^2
Gravity Vector (100Hz) Three axis of gravitational acceleration (minus any movement) in m/s^2
Temperature (1Hz) Ambient temperature in degrees celsius
How do all the sensors on the chip have their unique I2C address.
Thanks
Robert
The BNO055 can output the following sensor data:
Absolute Orientation (Euler Vector, 100Hz) Three axis orientation data based on a 360° sphere
Absolute Orientation (Quatenrion, 100Hz) Four point quaternion output for more accurate data manipulation
Angular Velocity Vector (100Hz) Three axis of 'rotation speed' in rad/s
Acceleration Vector (100Hz) Three axis of acceleration (gravity + linear motion) in m/s^2
Magnetic Field Strength Vector (20Hz) Three axis of magnetic field sensing in micro Tesla (uT)
Linear Acceleration Vector (100Hz) Three axis of linear acceleration data (acceleration minus gravity) in m/s^2
Gravity Vector (100Hz) Three axis of gravitational acceleration (minus any movement) in m/s^2
Temperature (1Hz) Ambient temperature in degrees celsius
How do all the sensors on the chip have their unique I2C address.
Thanks
Robert
- gammaburst
- Posts: 1013
- Joined: Thu Dec 31, 2015 12:06 pm
Re: Shield Stacking
The Arduino shield stacking concept works in some situations. If it doesn't work for you, consider buying compact smaller versions of all the boards, and interconnecting them with short wires. If you have I2C address conflicts, consider using an I2C multiplexer (Adafruit sells several types). Also, some Adafruit products include STEMMA connectors that bundle power and I2C into one inexpensive convenient cable. Be careful that all your connected devices have compatible voltages.
You mentioned the BNO055. It uses one I2C address, yet provides many internal registers. The BNO055 datasheet section "4.6 I2C Protocol" describes how that works. Basically, each I2C transaction includes the slave address, the registers address, and the data byte. Any connected I2C device with a wrong slave address will ignore the entire transaction.
You mentioned the BNO055. It uses one I2C address, yet provides many internal registers. The BNO055 datasheet section "4.6 I2C Protocol" describes how that works. Basically, each I2C transaction includes the slave address, the registers address, and the data byte. Any connected I2C device with a wrong slave address will ignore the entire transaction.
- tultalk
- Posts: 64
- Joined: Thu May 14, 2020 7:00 pm
Re: Shield Stacking
So the BN is a combination multiplexer and a bunch of sensors that can individually be interrogated. Thanks for head up. So the multiplexer breakout boards perform that same function as a gatekeeper. The BN is pretty impressive given its physical size.
Thanks
Robert
Thanks
Robert
- gammaburst
- Posts: 1013
- Joined: Thu Dec 31, 2015 12:06 pm
Re: Shield Stacking
Inside the BNO055 package you'll find a small ARM microcontroller chip and a sensor chip (accel/gyro/mag):
viewtopic.php?p=835190#p835190
The sensors are MEMS: https://en.wikipedia.org/wiki/MEMS
The internal microcontroller reads the internal sensors, applies calibration corrections and filtering, performs fusion math, and then probably stores the results into RAM. Your I2C connection talks to the microcontroller, which then probably fetches your requested "register" value from that RAM.
viewtopic.php?p=835190#p835190
The sensors are MEMS: https://en.wikipedia.org/wiki/MEMS
The internal microcontroller reads the internal sensors, applies calibration corrections and filtering, performs fusion math, and then probably stores the results into RAM. Your I2C connection talks to the microcontroller, which then probably fetches your requested "register" value from that RAM.
Please be positive and constructive with your questions and comments.