Spectral Triad (AS7265x) Hookup Guide

Contributors: Nate
Favorited Favorite 2

AS7265x Arduino Library Overview

Note: This example assumes you are using the latest version of the Arduino IDE on your desktop. If this is your first time using Arduino, please review our tutorial on installing the Arduino IDE. If you have not previously installed an Arduino library, please check out our installation guide.

We’ve written an Arduino library to make reading the Triad a breeze. The easiest way to install the library is by searching SparkFun Spectral Triad within the Arduino library manager. You can also manually install the AS7265x library by downloading a zip:

Example 1 provided with the library demonstrates how to read all 18 channels. The higher examples demonstrate all the features available through the SparkFun library on the Spectral Triad:

  • Example 1 - Basic readings of all 18 channels
  • Example 2 - Controlling the onboard LEDs
  • Example 3 - Changing the many settings on the AS7652x
  • Example 4 - Output the raw sensor readings without calibration adjustment
  • Example 5 - Setting the sensor up for maximum read speed
  • Example 6 - Reading the temperatures of the three ICs
  • Example 7 - Reading the various hardware and firmware versions

Below are the various functions that can be called from the library. Most of these functions are demonstrated in the examples so we recommend you go through each example first.

  • boolean begin(TwoWire &wirePort = Wire); -- Inits the sensor with default settings. Optional pass of wire port.
  • boolean isConnected(); -- Returns true if the sensor is detected on the I2C bus
  • boolean dataAvailable(); -- Returns true when data is available

  • uint8_t getTemperature(uint8_t deviceNumber = 0); -- Get temp in C of the master IC

  • float getTemperatureAverage(); -- Get average of all three ICs

  • void takeMeasurements(); -- Tell sensor to take one-shot measurement

  • void takeMeasurementsWithBulb(); -- Take one-shot measurement with all three LEDs illuminated

  • float getCalibratedA(); to getCalibratedW(); -- Returns the various calibration data

  • uint16_t getA(); to getW(); -- Get the various raw readings

  • void enableIndicator(); -- Enable the blue status LED

  • void disableIndicator(); -- Disable the status LED. Handy when taking snesitive readings

  • void enableBulb(uint8_t device); -- Turn on a given LED. 0 = White, 1 = IR, 2 = UV

  • void disableBulb(uint8_t device); -- Turn off a given LED

  • void setGain(uint8_t gain); -- 1 to 64x

  • void setMeasurementMode(uint8_t mode); -- 4 channel, other 4 channel, 6 chan, or 6 chan one shot
  • void setIntegrationCycles(uint8_t cycleValue); -- 2.78ms to 711ms

  • void setBulbCurrent(uint8_t current, uint8_t device); -- 12.5mA to 100mA

  • void setIndicatorCurrent(uint8_t current); -- 1 to 8mA

  • void enableInterrupt(); -- Enable the interrupt pin (active low)

  • void disableInterrupt();

  • void softReset(); -- Reset the device via software

  • uint8_t getDeviceType(); -- Should return 0x41

  • uint8_t getHardwareVersion(); -- Should return 0x40
  • uint8_t getMajorFirmwareVersion(); -- Returns the current firmware version, currently 0x0C
  • uint8_t getPatchFirmwareVersion();
  • uint8_t getBuildFirmwareVersion();