TransWikia.com

Simultaneous reading of multiple I2C devices with the same address

Electrical Engineering Asked by Aernout on December 19, 2021

I’m a teacher of a secondary school in the Netherlands. My students are working on a sun sensor placed on a moving object, with which the attitude w.r.t the sun is determined. A couple of ambient light sensors (BH1730FVC) in different directions are used for this. The sensor data is processed by an Arduino. The ambient light sensors have an I2C interface and all have the same address.

The sun sensor has 3 groups of 4 ambient light sensors. One group must take a measurement simultaneously. To work properly the sun sensor needs light intensity data from all sensors in a set measured at the same time. Time shift between measurements introduces an error in the final output. To minimize this negative effect, conversion is triggered in all sensors at exactly the same time. In order to do this, all four sensors in a set are connected in a special way.

The idea originates from a PW-Sat2 Cubesat project. See attached page from the CDR.

enter image description here

The SCL lines are connected and the SDAs of each sensor are connected to a GPIO pin of the MCU. A procedure for writing and reading is described.

Questions

  1. Does anyone have Arduino example code for this type of I2C connections? I was thinking to use SoftWire, but my experience in this field is limited.
  2. Are there (better) alternatives to simultaneously read I2C sensors with the same address?

One Answer

A 400 kHz I2C bus can transfer over 40 bytes per millisecond. So reading of result will be quite fast even if they are read sequentially instead of simultaneously.

1) It should be possible to use Software Wire by either using four Software Wire instances and using one of them at a time to access the sensor. Another option is to use single Software Wire instance to access one sensor at a time but reconfigure the data pin based on which sensor you want to access. There are other options as well, like writing your own Software I2C module to operate as you wish with the sensor quad.

2) Other options include hardware changes to add bus muxes to choose one sensor at a time. To allow accessing multiple sensors at the same time does require connecting them separately to microcontroller.

Answered by Justme on December 19, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP