Skip to content

Latest commit

 

History

History

sparkfun_spectroscopy_as7265x

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

AS7265x - Sparkfun Triad Spectroscopy Sensor

Summary

This project shows the implementation of the Triad Spectroscopy Sensor using a Triad Spectroscopy Sensor-AS7265x with Silicon Labs platform based on I2C communication.

The SparkFun Triad Spectroscopy Sensor is a powerful optical inspection sensor also known as a spectrophotometer. Three AS7265x spectral sensors are combined alongside visible, UV, and IR LEDs to illuminate and test various surfaces for light spectroscopy. The Triad is made up of three sensors; the AS72651, the AS72652, and the AS72653 and can detect light from 410nm (UV) to 940nm (IR).

For more information about the Triad Spectroscopy Sensor-AS7265x, see the specification page.

Required Hardware

Hardware Connection

A Triad Spectroscopy Sensor - AS7265x can be easily connected with two I2C wires (SDA and SCL) along with 3v3 and GND. For the designated boards, SparkFun qwiic compatible STEMMA QT connectors can be used.

  • If the BGM220P Explorer Kit is used:

    The connection is shown in the image below:

    board

  • If the SiWx917 Wi-Fi 6 and Bluetooth LE 8 MB Flash SoC Pro Kit is used:

    The hardware connection is shown in the table below:

    Description BRD4338A GPIO BRD4002 EXP Header A Triad Spectroscopy Sensor
    I2C_SDA ULP_GPIO_6 EXP_16 SDA
    I2C_SCL ULP_GPIO_7 EXP_15 SCL

Setup

You can either create a project based on an example project or start with an empty example project.

Create a project based on an example project

  1. From the Launcher Home, add your board to My Products, click on it, and click on the EXAMPLE PROJECTS & DEMOS tab. Find the example project filtering by "as7265x".

  2. Click Create button on the Third Party Hardware Drivers - AS7265X - Triad Spectroscopy Sensor (SparkFun) example. Example project creation dialog pops up -> click Create and Finish and Project should be generated.

    Create_example

  3. Build and flash this example to the board.

Start with an empty example project

  1. Create an "Empty C Project" for your board using Simplicity Studio v5. Use the default project settings.

  2. Copy the file app/example/sparkfun_spectroscopy_as7265x/app.c into the project root folder (overwriting the existing file).

  3. Install the software components:

    • Open the .slcp file in the project.

    • Select the SOFTWARE COMPONENTS tab.

    • Install the following components:

      • If the BGM220P Explorer Kit is used:

        • [Services] → [IO Stream] → [IO Stream: USART] → default instance name: vcom
        • [Application] → [Utility] → [Log]
        • [Application] → [Utility] → [Assert]
        • [Platform] → [Driver] → [I2C] → [I2CSPM] → qwiic instance
        • [Third Party Hardware Drivers] → [Sensors] → [AS7265x - Triad Spectroscopy Sensor (Sparkfun) - I2C]
      • If the SiWx917 Wi-Fi 6 and Bluetooth LE 8 MB Flash SoC Pro Kit is used:

        • [Application] → [Utility] → [Assert]
        • [WiSeConnect 3 SDK] → [Device] → [Si91x] → [MCU] → [Peripheral] → [I2C] → [i2c2]
        • [Third Party Hardware Drivers] → [Sensors] → [AS7265x - Triad Spectroscopy Sensor (Sparkfun) - I2C]
  4. Install "Printf float"

    • Open Properties of the project.

    • Select C/C++ Build > Settings > Tool Settings > GNU ARM C Linker > General > Check "Printf float".

  5. Build and flash the project to your device.

Note:

  • Make sure that the Third Party Hardware Drivers extension is installed. If not, follow this documentation.

  • SDK Extension must be enabled for the project to install AS7265x - Triad Spectroscopy Sensor (Sparkfun) - I2C component.

How It Works

API Overview

sparkfun_as7265x.c: implements APIs for application.

  • Initialization and configuration API: specific register read/write to get and set settings for AS7265X.

  • Read Sensor Data/Status: specific register read to get acceleration data and status.

  • Low-level functions: initialize I2C communication, read/write a memory block via I2C, given memory address, and read/write a register via I2C, given register address.

Testing

This simple test application demonstrates some of the available features of the A Triad Spectroscopy Sensor - AS7265x, after initialization, the Triad Spectroscopy Sensor - AS7265x measures the value and return on the serial communication interface.

You can choose which type of test you want by uncommenting the #define, follow the below steps to test the example:

  1. Open a terminal program on your PC, such as the Console that is integrated into Simplicity Studio or a third-party tool terminal like TeraTerm to receive the logs from the virtual COM port.

  2. Depending on the test mode defined in the app.c file, the code application can operate in different modes.

  • If you use TEST_BASIC_READING for testing, this example takes all 18 readings, 372nm to 966nm, over I2C and outputs them to the serial port.

    basic reading

  • If you use TEST_BASIC_READING_WITH_LED for testing, this example takes all 18 readings and blinks the illumination LEDs as it goes, resets the device, and observes the log messages.

    basic reading with led

  • If you use TEST_READ_RAW_VALUE for testing, this example shows how to output the raw sensor values.

    raw data reading

  • If you use TEST_MAX_READ_RATE for testing, this example shows how to set up the sensor for max, calibrated read rate.

    max rate reading

Report Bugs & Get Support

To report bugs in the Application Examples projects, please create a new "Issue" in the "Issues" section of third_party_hw_drivers_extension repo. Please reference the board, project, and source files associated with the bug, and reference line numbers. If you are proposing a fix, also include information on the proposed fix. Since these examples are provided as-is, there is no guarantee that these examples will be updated to fix these issues.

Questions and comments related to these examples should be made by creating a new "Issue" in the "Issues" section of third_party_hw_drivers_extension repo.