Comments: AS726X NIR/VIS Spectral Sensor Hookup Guide


Looking for answers to technical questions?

We welcome your comments and suggestions below. However, if you are looking for solutions to technical questions please see our Technical Assistance page.

  • Worth pointing out that the UART baud rate is 115200 (doc is a little vague on this).

  • I recently ordered both the AS7262 and AS7263 and Arduino shield and QWICK cables. I have an Arduino UNO board. I tried to configure the way it is shown on this website by stack it on. When I uploaded the program, I got an I2C Error on serial port monitor. Could you please let me know if this Qwick kit works for Arduino Uno and what could I be missing?

    • I am having the same problem. First of all, I am using a Redboard. When I run the simple Blink program, I am able to make the Blue LED blink with controllable duration and frequency. Next, I place the Qwiic shield on top of the Redboard. A Qwiic cable connects to an AS7263. The two sample programs load properly. But when I view on the Serial Monitor, all I get is I2C error messages.

      • Have you solved it somehow? Having the same problem. Was it a faulty board or did something else help?

        • Yes. Solved earlier this week. I did not realize that the header pins had to be soldered into the qwiic shield. So I soldered all 28 of em. Still did not work. So I had a friend bring over his spectral sensor and that one worked just fine. I must've fried my first one. Good luck to you.

  • I'm just getting an 'I2C Error'. I connected 3v3 to 3v3, gnd to gnd, SDA to SDA and SCL to SCL. Tested several arduino boards and esp8266, but I get the 'I2C Error' in the serial monitor all the time. What am I missing? Is my board just faulty? The status LED of the board is blinking, but I can't communicate via i2c. I even uploaded an I2C scanner sketch, but it can't find the sensor with the address 0x49. :/

  • Hello dear SparkFun.

    There is an option to connect this boards by the serial port, as mentioned on this page. So I'm planing to use several SoftSerial ports to connect several sensors to the same Arduino Nano.

    But here is no explanation how to set the library to work with SoftSerial... Can somebody please help me to find out how can I do this?

  • Under the Hardware Assembly it shows only a Qwiic cable connection between the AS7262 and Arduino Redboard. Then there is code further down the webpage. Does the code work ONLY with the Qwiic cable....or do I need to connect SCL SDA GND and Power as well? Sparkfun has a Qwiic Tutorial and a I2C SPI tutorial .

  • Hello, I have a Sparkfun blackboard. I downloaded the AS726x zipped library.I connected the Qwiic connector to one side of the AS726x (does it matter which end?). There is no I2C wires soldered and connected to blackboard. Only the Qwiic cable is connected. Please provide example code showing how to use the Qwiic cabling....

  • Hi,

    I notice that both the AS7262 and AS7263 have the same address. Is there anyway they can be used through the same bus? Is there any external pin that can put in IDLE one of the sensors while reading the other one?

  • Hi,

    Do you know what the Calibrated Measurements represents ? What is the difference between "getBlue" and "getCalibratedBlue" ? I wonder what the measures are calibrated to.


    • Hi Dear,

      In the latest version of the library, it doesn't make a difference. In the earlier versions, getRed() will give you an integer and getCalibratedRed() will give more accurate floating point numbers.

  • There are a few errors with this tutorial I think I should point out. First: the takeMeasurements () function should be called takeMeasurementsMode3 (), as the second line of this function in the library sets the device in mode 3. Now yes to use mode 3 according to the data sheet: "to perform a new One-Shot sequence, the control register BANK bits should be written with a value of Mode 3 again." Meaning that after each mode 3 reading the code needs to set the sensor to mode 3 again. This is fine for the simple example, however in the Sensor Settings example the sensor is initialized in mode 0 this is continuous reading of channels V, B, G, Y and channels O, R aren't read and will therefore appear as 0 if printMeasurements () is used. But in calling takeMeasurements first in the 2nd example sketch you are overriding any mode selection made during initialization by changing to mode 3 every time through the loop. This is the only reason both sketches produce the same output. If printMeasurements() had been used without takeMeasurements () in the second sketch R and O should be 0 because mode 0 only reads BANK 1 which is V, B, G, and Y. I don't have the AS7262 to test this but I have done it on the NIR version and by removing the takeMeasurements() from the second example the code still runs but R and W are 0 for every iteration because they are read in mode 1 not mode 0. The second problem is with the setIntegrationTime function. It says the integration time will be the value in the setIntegrationTime function * 2.8ms. This is only true when using mode 0 or 1. Mode 2 & 3 read both banks providing 6 readings, again from the data sheet: " Minimum IT for a single bank conversion is 2.8 ms. If data is required from all 6 photodiodes then the device must perform 2 full conversions (2 x Integration Time)." The data sheet also says that "Integration time = <value> * 2.8ms" So the integration time for mode 2 and 3 is 2integration value2.8ms.

If you've found a bug or have other constructive feedback for our tutorial authors, please send us your feedback!