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.
If you've found an issue with this tutorial content, please send us your feedback!
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.
getVersion() is also a function that can be called in the libary but it is missing from library overview list of functions
I have a redboard, Qwiic shield, and spectral sensor. I don't have access to a soldering iron right now. When I try to use the tutorial code, the serial port monitor only reads "I2C Error". Is it absolutely necessary for the parts to be completely soldered or is there another problem here?
You should definitely completely solder header pins onto your Qwiic shield. If you don't have the pins soldered up, you probably won't make a good connection to the board.
so here is the deal, we've bought the Redboard and both the AS726X for NIR and VIS. Now we want to do a simple measurement test like in example one and this error is shown: 'class AS726X' has no member named 'printMeasurements'; did you mean 'takeMeasurements'? What is the deal with this? And how can we solve it?
Try opening the examples by heading to File -> Examples -> SparkFun AS726X
We've changed the library to bring the printing of those measurements out of the library and it looks like the example in the hookup guide weren't updated. I've updated them to match the examples that come packaged with the library.
thanks! it worked out fine. now the problem is we want to hook up both the as7262 and as 7263 at the same time, but this wont work with && statements. is there another statement we can use for this double hookup?
I think you are running into a bus contention issue. If my memory serves me correctly, both devices share the same I2C address. You will probably want to use something like the Qwiic Mux, unless the I2C address can be changed.
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. :/
connect two 1K ohm pull up resistors between SDA and 3V3 and also between SCL and 3V3
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 https://www.sparkfun.com/qwiic?_ga=2.201241000.723607872.1528841513-1615901391.1499092111 and a I2C SPI tutorial https://learn.sparkfun.com/tutorials/raspberry-pi-spi-and-i2c-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?
The easiest way would be to use the Qwiic Mux
Cool, thanks for the quick reply. Can I do this using any of the pins such as RST?
Thanks again for the advice
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.
Thanks!
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.