Spectral Triad (AS7265x) Hookup Guide

Pages
Contributors: Nate
Favorited Favorite 2

Introduction

The SparkFun Triad Spectroscopy Sensor is a powerful optical inspection sensor. Three AS7265x sensors are combined alongside a visible, UV, and IR LEDs to illuminate and test various surfaces for light spectroscopy.

SparkFun Triad Spectroscopy Sensor - AS7265x (Qwiic)

SparkFun Triad Spectroscopy Sensor - AS7265x (Qwiic)

SEN-15050
$69.95
13

AMS has combined the power of three sensors to cover the measurement of light from 410nm to 940nm in 18 individual bands.

18 Channel Spectral Response from the Datasheet

What Can You Do with Light Spectroscopy?

It’s an amazing field of study, and the SparkFun Triad brings what used to be prohibitively expensive equipment to the desktop. The AS7265x should not be confused with highly complex mass spectrometers, but the sensor array does give the user the ability to measure and characterize how different materials absorb and reflect 18 different frequencies of light.

Required Materials

To follow along with this hookup guide, you will need one of the following Qwiic shields with an Arduino. You may not need everything though depending on what you have. Add it to your cart, read through the guide, and adjust the cart as necessary.

SparkFun RedBoard - Programmed with Arduino

SparkFun RedBoard - Programmed with Arduino

DEV-13975
$21.50
50
SparkFun Qwiic Shield for Arduino

SparkFun Qwiic Shield for Arduino

DEV-14352
$7.50
9

You will also need a Qwiic cable to connect the shield to your AS726X, choose a length that suits your needs.

Qwiic Cable - 100mm

Qwiic Cable - 100mm

PRT-14427
$1.50
Qwiic Cable - 50mm

Qwiic Cable - 50mm

PRT-14426
$0.95

Qwiic Cable - 200mm

PRT-14428
Retired

Qwiic Cable - 500mm

PRT-14429
1 Retired

Tools

Depending on your setup, you may need a soldering iron, solder, and general soldering accessories.

Solder Lead Free - 100-gram Spool

Solder Lead Free - 100-gram Spool

TOL-09325
$9.95
8

Weller WLC100 Soldering Station

TOL-14228
2 Retired

Suggested Reading

If you aren't familiar with the Qwiic system, we recommend reading here for an overview.

Qwiic Connect System
Qwiic Connect System

We also recommend checking out these tutorials before continuing.

Light

Light is a useful tool for the electrical engineer. Understanding how light relates to electronics is a fundamental skill for many projects.

I2C

An introduction to I2C, one of the main embedded communications protocols in use today.

Qwiic Shield for Arduino & Photon Hookup Guide

Get started with our Qwiic ecosystem with the Qwiic shield for Arduino or Photon.

Hardware Overview

Sensors

The Triad is made up of three sensors; AS72651 (UV), AS72652 (VIS), and AS72653 (NIR). The AS72651 communicates with the x2 and x3 sensors over a dedicated I2C bus (the AS72651 is the master, the AS72652 and AS72653 are slaves). The AS72651 combines its sensor data with the data from the x2 and x3 sensors and exposes the datums to the user as a single array of registers. The SparkFun AS7265x Spectral Library makes it seamless to read any of the 18 frequencies of sensing.

Three sensors arranged in a circle

EEPROM

These sensors from AMS are interesting in that they ship without firmware. The firmware to drive the system is loaded onto a 4Mbit EEPROM that is read by the AS72651 at power on.

EEPROM containing the Spectral Triad firmware

LEDs / Bulbs

The Triad contains a 5700k white LED, a 405nm UV LED, and a 875nm IR LED mounted alongside the sensors. These LEDs were chosen to illuminate the target with the largest swath of visible and invisible light. The LEDs are individually enabled with software configurable drive current.

Three LEDs on Spectral Triad

The board also has multiple ways for you to illuminate the object that you are trying to measure for a more accurate spectroscopy reading. If you aren’t satisfied with the on-board, LEDs you can grab your own through hole incandescent bulbs. While you should find a bulb rated for 3.3V, a bulb rated for higher voltage, like 5V, will still work, but will not run as bright as it normally would with 5V. We’ve found that Mouser is a good place to look for these. If you are going to go that route and use your own bulb, be sure to disable the onboard LED by removing cutting the jumper to any 'bulb' footprint that is used. Cut the jumper next to each bulb footprint to disconnect the LED from the controller IC and solder in a bulb. We use the word ‘bulb’ to indicate any DC device (limited to 100mA max) but this signal pin could also be used to activate a larger MOSFET or control device to activate a much larger current device.

Jumper to cut to enable an external bulb

In addition to the illumination LEDs, there is a power LED and a status LED. The blue status LED indicates various states of the AS72651 sensor and can be disabled through the SparkFun library. The red power LED is provided to indicate the board is properly energized. If the red light is interfering with readings it can be disabled by cutting the neighboring jumper.

Jumper to cut to disable the power LED

I2C / Qwiic Interface

The Qwiic connectors provide a quick and easy way to connect the Triad over I2C. Alternatively, you can solder to the four pins: GND/3.3V/SDA/SCL. The sensors are 3.3V compatible so don’t use with a 5V Arduino Uno without proper conversion (use the Qwiic shield instead!). If you're using a 3.3V development platform that doesn't have a Qwiic connector, consider using the Qwiic Breadboard Cable.

Qwiic connectors and I2C jumper

Serial UART Interface

A serial interface is also available for those users who prefer using AT commands. Please refer to the AS7265x datasheet for a full list of commands. To enable the serial interface (and disable the I2C interface) you must modify two jumpers:

  1. The I2C jumper on the front of the board must be opened to remove the pull-up resistors from the TX and RX lines.
  2. The JP2 on the rear of the board must be closed with a solder jumper.

Serial Jumpers needing modification

Next, solder in a 6-pin right angle male header to the serial port.

Serial Pins and interface jumper on SparkFun Triad

The SparkFun Serial Basic connects directly to the Triad. The Serial Basic is set to 3.3V by default but if you’re using a different board, be sure it provides 3.3V on VCC and uses 3.3V logic signals.

Serial Basic connected to the serial connector on SparkFun Triad

The serial interface operates at 115200. To test the connection, open TeraTerm or your favorite terminal and connect to the Serial Basic. Send the command AT and look for an OK response. You’re all set! Check the AS7265x datasheet for a full list of AT commands.

Ok shown on the terminal window

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();

Example: Taking A Banana Reading

Let's get the Triad hooked up over Qwiic and begin illuminating a target to take some readings. Using a BlackBoard and a Qwiic Cable we're able to attach to the Triad quickly without soldering. Let's open and use Example 2 from the library so that the Triad will take all 18 readings while illuminating the target.

Once you have a series of readings, plug them into your favorite graph utility. For our purposes, we like to use Google spreadsheets. You can paste the comma delimited output from the sketch directly into a sheet. Once there, drop the small menu down and select Split text to columns.

Splitting text to columns

You can access our data here. The graph of the 18 frequencies is pretty neat!

Graph of various items spectral response

Now that we have a baseline we can take a reading from an unknown thing (in this case, Uranium ore we had sitting around used for testing the Pocket Geiger Counter). Note that the distance to your sample will cause the amplitude of the readings to increase or decrease. We took our readings holding the Triad about 1 inch away from the surface of the target sample but a 3D printed shroud would remove background illumination and remove read distance variations.

As you can see the unknown sample follows closely to the Uranium Ore signature.

Reading an unknown sample

Science! The Triad is a fantastic tool that will have you looking around your house for interesting things to measure.

Resources and Going Further

Now that you've successfully got your Spectral Triad up and running, it's time to incorporate it into your own project!

For more information, check out the resources below:

Need some inspiration for your next project? Check out some of these related tutorials:

Qwiic IR Array (MLX90640) Hookup Guide

The Melexis MLX90640 contains a 32x24 array of thermopile sensors creating, in essence, a low resolution thermal imaging camera. In this guide, we’ll go over how to connect your Qwiic Infrared Array with MLX90640 and get it communicating with Processing to produce a nice thermal image.

Using SparkFun Edge Board with Ambiq Apollo3 SDK

We will demonstrate how to get started with your SparkFun Edge Board by setting up the toolchain on your computer, examining an example program, and using the serial uploader tool to flash the chip.

Qwiic Scale Hookup Guide

Create your own digital scale quickly and easily using the Qwiic Scale!

SparkFun MicroMod Input and Display Carrier Board Hookup Guide

A short Hookup Guide to get started with the SparkFun MicroMod Input and Display Carrier Board