Multiple AK9753 Human Presence Qwiic sensors on same I2C bus

Hi,

I’m trying to use three qwiic AK9753 Human Presence Sensors on the same bus.

After a board burning up and not ever getting the begin function to return true on 0x65 or 0x66/0x67 devices I dug into the brd. file and found that the address jumpers are labeled incorrectly in the silk. After looking at the datasheet, the address corresponding to a HL/10 should be 0x66. The hookup guide and schematic has this labeled as 0x67.

Now that I’ve got my jumpers set correctly for the right addresses, I’m still having trouble with my code - the begin function. I’m not too familiar with having to dig into Arduino libraries, but is the default address hard coded in the begin function? It doesn’t seem to accept any other address. I get through the first check fine. I never get through the next two and I’ve switched the order to see if one of the other two will work. It does not. Additionally, the second and third sensors get very hot. I’ve already checked for shorts, and measured voltages on all the lines. The I2C pullups have been disabled on sensor 2 and 3. I’m not using Qwiic cables - I’m using the header pins to connect them. The hardware seems to be connected correctly.

AK975X movementSensor1; //default address 0x64 (00)
AK975X movementSensor2;//(01)
AK975X movementSensor3; //(10)

void setup() {
  // put your setup code here, to run once:

  Serial.begin(115200);//Start the serial data at 115200 baud
  Wire.begin();// Start the I2C serial connection to the breakout board/ physical sensor

if (movementSensor1.begin(Wire, I2C_SPEED_STANDARD, 0x64) == false)
  {
    Serial.println("Sensor 1 not found. Check wiring.");
    while (1);
  }
if (movementSensor2.begin(Wire, I2C_SPEED_STANDARD, 0x65) == false)
  {
    Serial.println("Sensor 2 not found. Check wiring.");
    while (1);
  }
if (movementSensor3.begin(Wire, I2C_SPEED_STANDARD, 0x66) == false)
  {
    Serial.println("Sensor 3 not found. Check wiring.");
    while (1);
  }
}

Any help is appreciated.

Edit: One of sensors now burns up just on power connected – clocked it at 156 degrees F with my temp gun. How do I go about a replacement?

I read the datasheet, schematics, BRD file and library

The default address is NOT hardcoded but set as default in the header file. However, you overwrite that default with the begin() code in the sketch as you did correctly.

Also your observation about the I2C address 0x66 instead of 0x67 I share.

The one aspect I noticed in the library is that during begin() it does everytime also a new begin of Wire and sets the Wire-speed every time. That is an 'old" programming approach for a library, not applied in new code, as it is expected these days that multiple sensors are on the same wire. As such this should be handled in the sketch to prevent confusion. Depending on the board you use and the sensor reaction, it could explain the part of behavior you see. Some Wire.begin() code can cause the sensor to believe it has to reset and then when you read one sensor… you could actually read another.

Also during sensor begin() it will start a continued read for the sensor at a certain frequency. That would not explain why 2 sensors getting so hot.

The only times I have seen that happen is when the voltage is too high, the power is connected the wrong way around, or a short circuit. Do you have pictures of your setup?

Hi,

I don’t have pictures of my set up, but I know that the set-up not that problem with the heat. Power is from the 3.3V pin on the Arduino Uno. If it was connected improperly, the first sensor would also have a short but it operates fine. Do you have any suggestions for code I could look at that uses multiple of same sensors with selectable addresses to get an idea of what the wire.begin()/sensor.begin() should look like? What do you suggest for changes to the library so the Wire-speed isn’t reset after each sensor.begin() call in set-up? I’m going to try and rewrite the code so it doesn’t continuously read - could that be preventing start-up on the other two? As the library is currently written can three of these devices be on the same wire?

The two boards are hosed. My plan to bypass these issues was to just run three separate MCUs with one sensor on each, but the other two immediately get hot with just power applied- before a sketch is even loaded or SCL/SDA connected. I’m just going to have to order more boards and play around with the library.

studying the datasheet there is a remark in chapter 11.4.2 :

The data registers (ST1 to ST2) should not be accessed in Stand-by Mode. It causes the malfunction of AK9753.

It does not mention what malfunction… but maybe that is a reason why your 2 boards are hosed by a potential wire- reset ?

In an attempt to help, I have made some changes to the library:

  • By calling begin() with an i2Cspeed of zero the library will not be set or change Wire AND the sensor will not be set in running. In that case, it will set the sensor in standby, store the Wire channel and address to use and check for the device presence.

  • By calling the existing function reboot() after begin() from the sketch the sensor will start running.

  • By calling the existing function setMode(AK975X_MODE_STANDBY) from the sketch it will go in standby.

  • Code has been added that when the sensor is in standby it will NOT be accessed when trying to read ST1, ST2 or IRx or temperature from the sketch
  • SparkFun_AK975x_Arduino_Library-patched.zip (19.8 KB)

    Wow. Thank you so much for all your thoughtful work. I will let you know if this works. Thanks again!