SparkFun Triad Spectroscopy not working

Hi,

I just purchased a Spectral Triad along with a RedBoard Qwiic. I didn’t see anything in the RedBoard documentation that indicates which Board to select in the IDE for development, but since the RedBoard appears to have an ATmega328P processor I chose Arduino Mega or Mega 2560. This RedBoard has a Qwiic connector and I connected the Triad to the RedBoard with the 100mm Qwiic cable I also purchased. I compiled the Example 1 code in the IDE and uploaded it to the RedBoard. The code compiles fine and uploads to the board. The TX light on the RedBoard flashes on and off rapidly and the RED power light and BLUE status light on the spectrometer light up, but nothing happens for about 20 seconds. At that point I get this error message in the IDE window:

avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
An error occurred while uploading the sketch

Then the Serial Monitor reports:

AS7265x Spectral Triad Example
Sensor does not appear to be connected. Please check wiring. Freezing…
A,B,C,D,E,F,G,H,R,I,S,J,T,U,V,W,K,L
0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,

And the code in loop keeps printing zeros. I am pretty sure this should be like falling off a log, right? I am using your board with your sensor with your Qwiic connector environment. I installed the CH340 drivers as your website directed. I used you code example. There is certainly power getting to the spectrometer that is connect to the RedBoard via Qwiic. There is some question about whether or not I’ve selected the correct Board in the IDE (version 1.8.19).

Can you give me some suggestions on what to try next? I really need to get this working.

Thanks,

Merrick

OK - quick update - it works! But it doesn’t.

Shortly after I posted that first post I recompiled and uploaded again and this time I did not get the timeout and I got what looks like actual data in the Serial Monitor:

AS7265x Spectral Triad Example
A,B,C,D,E,F,G,H,R,I,S,J,T,U,V,W,K,L
139.06,1935.06,3422.63,1020.39,1873.86,2106.68,1305.87,1579.46,2801.56,575.17,692.00,143.68,178.95,137.67,269.84,102.83,44.89,50.98,
4.02,29.99,77.94,0.00,31.38,59.11,166.85,131.99,82.78,24.76,29.34,23.03,9.10,5.70,6.44,6.63,1.18,1.73,
5.63,44.51,98.59,32.23,38.85,47.85,45.39,36.26,81.69,25.51,31.36,7.91,9.10,5.70,7.25,5.53,1.18,1.73,
5.63,46.44,95.78,32.23,36.61,47.14,44.52,37.48,86.05,26.26,30.35,8.25,9.86,5.70,7.25,4.42,1.18,1.73,
2.41,17.42,49.77,0.00,20.92,32.37,39.77,30.55,69.71,21.39,24.28,7.56,6.82,4.89,4.83,4.42,0.59,0.86,
3.22,23.22,70.42,23.75,28.39,35.89,39.34,31.37,69.71,22.89,26.30,7.56,6.82,4.07,6.44,4.42,1.18,0.86,
3.22,23.22,72.30,26.29,28.39,38.00,39.77,31.78,70.80,22.51,26.30,7.56,7.58,4.89,6.44,4.42,1.18,0.86,
3.22,25.16,77.00,27.14,29.14,40.81,39.77,32.18,77.34,22.89,27.32,7.56,7.58,4.89,6.44,5.53,1.18,0.86,
3.22,24.19,106.11,55.13,41.09,235.01,580.96,464.02,668.80,30.39,250.90,61.87,31.09,51.32,86.19,68.55,7.09,2.59,
4.02,28.06,102.35,485.17,44.08,1038.56,459.93,499.05,1550.01,26.64,117.36,52.25,96.30,81.46,40.28,74.08,1.77,14.69,
135.04,1913.77,3426.39,1005.12,1921.68,2147.49,1324.03,1592.49,2715.51,554.16,707.17,144.71,174.40,136.85,277.09,106.14,45.49,49.26,
134.24,1898.29,3396.34,481.78,1906.74,947.09,493.21,644.09,1264.62,549.28,711.22,57.75,87.96,64.35,277.90,46.44,44.89,22.47,
5.63,42.57,105.17,32.23,44.08,54.18,204.03,154.81,84.96,31.52,31.36,25.78,8.34,5.70,7.25,6.63,8.86,1.73,
3.22,21.29,73.24,25.45,30.63,42.92,39.34,30.15,74.07,21.76,28.33,7.56,7.58,4.89,7.25,5.53,1.18,0.86,
3.22,23.22,80.75,27.14,32.87,45.74,39.77,30.15,70.80,21.01,28.33,7.56,7.58,4.89,6.44,6.63,1.18,0.86,
3.22,24.19,91.08,28.84,35.86,54.18,522.18,428.17,66.44,28.89,29.34,56.72,7.58,4.89,6.44,7.74,10.63,3.46,
3.22,24.19,88.27,27.99,36.61,56.99,693.35,579.72,68.62,58.16,29.34,73.56,7.58,4.89,6.44,7.74,15.36,6.91,
6.43,49.34,106.11,287.54,47.07,633.97,247.26,354.43,774.46,27.76,37.43,34.03,67.49,49.69,8.86,34.28,1.18,14.69,
128.61,1944.73,3835.79,877.04,1858.17,2205.19,1250.11,1516.72,2287.43,532.40,727.40,145.05,174.40,140.11,264.21,105.04,46.08,50.98,
129.42,1960.21,3866.78,869.41,1875.36,2184.79,1245.35,1509.39,2266.74,536.90,730.44,144.71,172.13,138.48,265.01,103.93,46.08,50.12,
129.42,1953.44,3859.26,868.56,1871.62,2185.49,1244.49,1508.57,2264.56,535.78,729.43,144.71,172.13,138.48,265.01,103.93,46.08,50.12,
129.42,1953.44,3859.26,868.56,1871.62,2189.01,1244.92,1508.57,2264.56,530.15,730.44,144.71,172.13,138.48,265.82,103.93,46.08,50.12,
128.61,1948.60,3852.69,0.00,1867.89,2190.41,1251.40,1516.31,2256.94,530.15,734.49,145.40,172.13,138.48,266.62,103.93,46.08,50.98,

But, then I recompiled and uploaded again and it’s back to the original behavior. So what is the secret sauce? Is there any special sequence of events or particular thing I need to do to get this running correctly every time?

There was no difference I am aware of for the time it ran correctly and all the times it is not.

Thanks for any suggestions,

Merrick

OK - it worked again:

AS7265x Spectral Triad Example
A,B,C,D,E,F,G,H,R,I,S,J,T,U,V,W,K,L
154.33,2095.67,3569.11,832.09,1539.14,1050.53,876.63,1319.54,2531.43,578.17,523.04,80.09,207.01,137.67,216.68,44.23,43.12,60.49,
153.53,2082.12,3549.40,837.17,1529.42,1057.56,882.25,1327.69,2541.23,576.67,520.01,80.78,207.76,138.48,215.07,44.23,43.12,61.35,
153.53,2088.89,3561.60,838.87,1535.40,1064.60,880.09,1321.58,2551.03,577.80,517.98,80.78,208.52,139.29,214.26,44.23,43.12,60.49,
152.73,2078.25,3545.64,835.48,1528.68,1060.38,875.33,1314.65,2543.41,581.55,519.00,80.09,208.52,138.48,214.26,44.23,43.71,60.49,
153.53,2084.06,3556.91,829.54,1533.91,1046.30,871.01,1310.58,2523.80,579.30,521.02,79.75,206.25,137.67,215.07,44.23,43.12,60.49,
152.73,2071.48,3531.55,834.63,1522.70,1054.75,879.66,1323.21,2531.43,576.30,522.03,80.43,207.01,137.67,215.88,44.23,43.12,60.49,
152.73,2072.45,3531.55,0.00,1522.70,1059.67,880.95,1325.24,2554.30,579.30,517.98,80.43,209.28,139.29,214.26,44.23,43.12,60.49,

But it’s only working like 1 out of 30 times or something like that. Any guesses?

Thanks again,

Merrick

I think this is the last minor information update I’m likely to get - sorry for the barrage of messages. I recompiled and reuploaded and got the 20 second timeout. Then I just kept hitting the reset button on the board every few seconds, and I got this:

AS7265x Spectral Triad Example
Sensor does not appear to be connected. Please check wiring. Freezing…
A,B,C,D,E,F,G,H,R,I,S,J,T,U,V,W,K,L
0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
AS7265x Spectral Triad Example
Sensor does not appear to be connected. Please check wiring. Freezing…
A,B,C,D,E,F,G,H,R,I,S,J,T,U,V,W,K,L
0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,AS7265x Spectral Triad Example
Sensor does not appear to be connected. Please check wiring. Freezing…
A,B,C,D,E,F,G,H,R,I,S,J,T,U,V,W,K,L
0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,AS7265x Spectral Triad Example
Sensor does not appear to be connected. Please check wiring. Freezing…
A,B,C,D,E,F,G,H,R,I,S,J,T,U,V,W,K,L
0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,AS7265x Spectral Triad Example
Sensor does not appear to be connected. Please check wiring. Freezing…
A,B,C,D,E,F,G,H,R,I,S,J,T,U,V,W,K,L
0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
0.00,AS7265x Spectral Triad Example
Sensor does not appear to be connected. Please check wiring. Freezing…
A,B,C,D,E,F,G,H,R,I,S,J,T,U,V,W,K,L
0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,AS7265x Spectral Triad Example
Sensor does not appear to be connected. Please check wiring. Freezing…
A,B,C,D,E,F,G,H,R,I,S,J,T,U,V,W,K,L
0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,AS7265x Spectral Triad Example
Sensor does not appear to be connected. Please check wiring. Freezing…
A,B,C,D,E,F,G,H,R,I,S,J,T,U,V,W,K,L
0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,AS7265x Spectral Triad Example
Sensor does not appear to be connected. Please check wiring. Freezing…
A,B,C,D,E,F,G,H,R,I,S,J,T,U,V,W,K,L
0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
0.00,0.00,0.00,AS7265x Spectral Triad Example
Sensor does not appear to be connected. Please check wiring. Freezing…
A,B,C,D,E,F,G,H,R,I,S,J,T,U,V,W,K,L
0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
0.00,AS7265x Spectral Triad Example
Sensor does not appear to be connected. Please check wiring. Freezing…
A,B,C,D,E,F,G,H,R,I,S,J,T,U,V,W,K,L
0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
0.00,0.00,0.00,0.00,0.00,0.00,AS7265x Spectral Triad Example
Sensor does not appear to be connected. Please check wiring. Freezing…
A,B,C,D,E,F,G,H,R,I,S,J,T,U,V,W,K,L
0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
0.00,AS7265x Spectral Triad Example
A,B,C,D,E,F,G,H,R,I,S,J,T,U,V,W,K,L
168.80,1996.01,2977.55,0.00,1538.39,821.14,985.99,1416.09,2848.40,681.35,343.97,73.90,214.59,134.41,226.35,57.49,40.76,57.03,
168.80,1999.88,2980.37,920.30,1539.88,818.33,982.97,1412.43,2847.31,680.98,344.99,73.56,214.59,134.41,226.35,57.49,40.76,57.03,
167.20,2001.82,3109.95,942.35,1588.45,998.46,1060.78,1464.57,2900.68,684.73,396.58,87.65,215.35,137.67,234.40,67.45,41.94,57.03,

So obviously there are no code changes and no possibility of something changing in the compile or upload - I’m just resetting the code already on the board again and again, and after 13 resets the sensor was recognized and started transmitting data. Please any suggestions would be very helpful.

Thanks!

Merrick

Apparently sensor.begin() is failing most of the time. Why don’t you try adding a delay(500) in setup() before the Sensor.begin() and see it that helps.

Arduino Mega or Mega 2560 is the wrong board type for a armega328. Use “arduino uno”.

Is your problem solved? I also have a similar problem to yours. If you solve it, can you share your solution with me? Thank you.

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++;
      }
    }