Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe

Spectroscopic sensor interface with Arduino

By Usman ali Butt February 25, 2021

In this tutorial, we’ll learn how to interface a spectroscopic sensor with Arduino. Spectroscopy refers to the study of the spectra produced when material interacts with or emits light. Researchers analyze the change(s) in a light spectrum and its attributes — such as its frequency or wavelength — when it’s exposed to matter (a gas, liquid, solid, etc.).

Depending on its physical properties, matter will either allow the light to pass or absorb some or all of its frequencies. For example, black bodies fully absorb light — including all of the frequencies in an electromagnetic spectrum. This means that we can distinguish materials (or matter) by exposing them to a known light source and studying their frequency absorption.

Currently, there is only one cost-effective spectrometer that’s available for a do-it-yourself (DIY) project such as this, the AS7265x. It’s a combination of three individual sensors that offer:

1. Visible light (VL): AS72651
2. Ultraviolet light (UV): AS72652
3. Near-infrared light spectrum (NIR): AS72653

Each sensor has a dedicated LED adjacent to it and, combined, they form a triad.

These onboard LED’s are powerful enough to illuminate nearby objects and reflect back the light. However, you can also use external LED’s for a greater level of reflected/incident light frequencies.

Unfortunately, the spectral triad can only cover a small portion of the light spectrum. DIY sensors are limited. To cover the full spectrum, individual sensors can be cascaded together.

The AS7265x triad outputs 18 values (A, B, C, D, E, F, G, H, R, I, S, J, T, U, V, W, K, L), which correspond to 18 different light frequencies. When a light source that’s within the sensor range (VI, UV, NIR) is detected, the light’s frequency is rounded off to the nearest range within these 18 frequencies.

Here’s the frequency range…

Essentially, the AS7265x “communicates” with the I2C protocol’s external modules. It operates on 3.3V, which is ideal for the I2C port. The visible light sensor acts as the master while the NIR and UV light spectrums are slaves.

Arduino NANO is best suited for this project and its connections with the sensor are shown here…

The code
First, import and initiate the SparkFun library for the AS7265x sensor. The setup function for Arduino’s serial monitor is initialized at a 9600 baud rate.

Then, the sensor must be started and polled to ensure its fully powered up and working.

In the loop function, the statement takeMeasurements() will note the frequencies that are reflected from the exposed object or material. To determine which of the 18 frequencies are absorbed, you’ll need to call all of the frequencies’ status functions. The getCalibratedx() function will let you see the status of the individual frequencies.

The above function only measures the raw light and natural frequencies in a particular environment. To measure their exact values, it’s necessary to switch on the sensor’s VI, UV, and NIR LED’s.

This statement allows us to take readings with the LED switched on:

Otherwise, you can switch on the LED’s permanently by placing these statements in the setup loop:

For the results, open the serial monitor at the 9600 baud rate. The spectral properties of the material/matter can be studied using the above DIY spectrometer.

Here’s what you’ll need:

  • Arduino Nano: Mouser
  • The AS7265x sensor: Mouser

You may also like:


  • Interface SparkFun 9DoF sensor stick with Arduino Uno

  • Infrared Sensors or IR Sensors

  • Infrared Imaging or Thermal Imaging : History

  • First Spectroscopic Probe Of Element Nobelium

Filed Under: Microcontroller Projects
Tagged With: Arduino
 

Next Article

← Previous Article
Next Article →

Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

EE TECH TOOLBOX

“ee
Tech Toolbox: 5G Technology
This Tech Toolbox covers the basics of 5G technology plus a story about how engineers designed and built a prototype DSL router mostly from old cellphone parts. Download this first 5G/wired/wireless communications Tech Toolbox to learn more!

EE Learning Center

EE Learning Center
“engineers
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


RSS EDABOARD.com Discussions

  • problem connecting to my xilinx device VIA global IP
  • Output Stage Microwave Device Selection
  • Exporting sensor readings as data...
  • lumped port or wave port in ansys hfss for my on-chip spiral inductor ??
  • NXP library issue in awr

RSS Electro-Tech-Online.com Discussions

  • using a RTC in SF basic
  • What is correct names for GOOD user friendly circuit drawing program?
  • Is AI making embedded software developers more productive?
  • Why can't I breadboard this oscillator?
  • Parts required for a personal project

Featured – RPi Python Programming (27 Part)

  • RPi Python Programming 21: The SIM900A AT commands
  • RPi Python Programming 22: Calls & SMS using a SIM900A GSM-GPRS modem
  • RPi Python Programming 23: Interfacing a NEO-6MV2 GPS module with Raspberry Pi
  • RPi Python Programming 24: I2C explained
  • RPi Python Programming 25 – Synchronous serial communication in Raspberry Pi using I2C protocol
  • RPi Python Programming 26 – Interfacing ADXL345 accelerometer sensor with Raspberry Pi

Recent Articles

  • GigaDevice launches GD32C231 MCU series with 48MHz Cortex-M23 core and 64KB Flash
  • Advanced Energy releases 425 W CF-rated medical power supply in 3.5 x 6 x 1.5-inch format”
  • LEM combines shunt and Hall effect sensing in 2000 A current measurement unit
  • What is AWS IoT Core and when should you use it?
  • AC-DC power supply extends voltage range to 800 V DC

EE ENGINEERING TRAINING DAYS

engineering

Submit a Guest Post

submit a guest post
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • EV Engineering
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • Subscribe to our newsletter
  • About Us
  • Contact Us
  • Advertise

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy

Search Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe