Triad Spectroscopy Sensor - AS7265x Communication Failure

I encountered some problems while using the three-in-one spectral sensor AS7265X. The following is a representation of the problems I encountered:

Use platform and code:

  1. The devices used are: three-in-one spectrum sensor AS7265X, Arduino Mega 2560 development board;

  2. Use DuPont cable to correctly connect the IIC interface of the sensor to the IIC interface of the Arduino Mega 2560 development board. It has been verified that there is no problem with the DuPont cable and there is no error in the connection;

  3. The communication method between the sensor AS7265x and the Arduino Mega 2560 development board is IIC communication;

  4. Use Arduino IDE to write, compile, upload code to Arduino Mega 2560 development board and view serial port information;

  5. Use the code officially given by SparkFun Electronics for the example: Example3_Settings.ino https://github.com/sparkfun/SparkFun_AS … ttings.ino, and no modifications were made to the sample code.

Problems that arise:

I successfully compiled the program Example3_Settings.ino and uploaded it to the Arduino Mega 2560 development board to run the program. The Arduino Mega 2560 serial port returned the error message:

Sensor does not appear to be connected. Please check wiring. Freezing...

As shown in picture_1 below, the corresponding code in Example3_Settings.ino is as shown in picture_2:

In order to determine what exactly went wrong, I added some printing information to the SparkFun_Spectral_Triad_AS7265X\src\SparkFun_AS7265X.cpp code:

Among them is the original content of SparkFun_AS7265X.cpp, and the right side is the content of the file I modified. The red part is the specific modified part, and only printing is added.

I downloaded the modified code to Arduino Mega 2560 and executed it, but it still reported an error. I pressed the reset button multiple times to re-execute the program. The serial port print result returned by the execution is as shown in picture_3:

After pressing the Arduino Mega 2560 reset button multiple times, there is a small probability that the program can be executed successfully and the sensor data is obtained. The result is shown in picture_4:

But normal situations like picture_4 are very small.

In order to verify whether it was a problem with the Arduino Mega 2560 development board, I replaced it with another Arduino Uno development board for testing. I connected the IIC interface of the Arduino Uno development board and the IIC interface of the sensor AS7265X correctly with Dupont wires. I have confirmed that the wires and There are no problems with the connection.

After compiling and downloading the sample program Example3_Settings.ino to the Arduino Uno development board for execution, the above connection failure problem still occurs frequently and an error is reported:

Sensor does not appear to be connected. Please check wiring. Freezing...

There is still a small probability that the program can be executed successfully and the sensor data is obtained.

Through the above verification, I think there is no problem with my operation and the Arduino device. What makes me even more suspicious is that there is a problem with the three-in-one spectrum sensor AS7265X itself.

I would like to ask, is there a problem with the three-in-one spectrum sensor AS7265X itself? If not, how can I solve this problem?
If you can help me solve this problem, please write detailed steps to solve the problem.

image_2.png

Try disabling the i2c pull up resistors on the backside of the board (cut the trace between the pads; can also re-enable later if needed) and re-try

The mega and uno are 5v boards; the sensor is a 3.3v board. You need to use level shifters between them.

After encountering the same problem using the ESP32-C6-MINI, I implemented a for loop to give the sensor some additional chances to initialize. This has solved the problem for me:

Serial.println("AS7265x Spectral Triad Example");

for (int j=0; j<15;)
    {
      sensor.begin();
      delay (50);

      if (sensor.begin()==true)
      j=50
      ;

      else
      {
        Serial.print("Sensor failed to initialize, retrying... ");
        Serial.print(j+1);  
        Serial.println("/15");

        j++;
      }
    }