# Adafruit AS7341 10-Channel Light / Color Sensor Breakout

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/094/048/medium800/adafruit_products_edit_4698_iso_ORIG_2020_08.png?1597258590)

The [AS7341 by AMS](https://adafruit.com/product/4698) is a multi-channel spectrometer which is a special type of light sensor that is able to detect not only the amount of light present, but also the amounts of light within different wavelengths. This means that you can use it to detect, much better than the human eye is capable of, what color or colors of light is present. The AS7341 packs within its 3x2mm footprint 16 different sensors that can detect 8 separate, overlapping bands of colored light. As if that weren't enough, it also includes sensors for white light as well as Near Infra-red light, and even sensors made specifically for detecting light flicker at specific frequencies from things like indoor lighting.

![](https://cdn-learn.adafruit.com/assets/assets/000/094/044/medium800/adafruit_products_edit_4698_top_ORIG_2020_08-2.png?1597258462)

The super-human color measuring capabilities of the AS7341 can be used to quantify the specific makeup of whatever interesting colors you can point it at, and can do so with more accuracy and specificity than a well-trained artist. Now you don't need to go to art school to tell [Smalt](https://www.google.com/search?q=smalt+blue&source=lnms&tbm=isch&sa=X) from [Ultramarine](https://www.google.com/search?q=ultramarine+blue&source=lnms&tbm=isch&sa=X), instead, you can have the AS7341 can give you a clue how blue your blue is. This is possible thanks to the impressive collection of sensors in the AS7341 being routed through a 16-bit 6-channel ADC that takes the raw measurements and converts them to digital values that can be read out over I2C.

![](https://cdn-learn.adafruit.com/assets/assets/000/094/050/medium800/adafruit_products_smux.png?1597258854)

11 readable individual sensor elements ( 10 light channels plus flicker detection) don’t exactly fit through a 6-channel ADC all at once, so the chip includes a so-called Super MUX (SMUX) that allows you to route the signal from any sensor to any ADC channel. Now that’s some super multiplexing! The sensor also has GPIO and interrupt pins that can allow it to communicate directly with other sensors, or the microcontroller itself.

![](https://cdn-learn.adafruit.com/assets/assets/000/094/047/medium800/adafruit_products_edit_4698_quarter_ORIG_2020_08.png?1597258531)

All of this capability is made accessible by mounting the sensor on a Stemma QT form factor breakout board, complete with level shifting circuitry and [SparkFun Qwiic](https://www.sparkfun.com/qwiic)&nbsp;compatible [Stemma QT](https://learn.adafruit.com/introducing-adafruit-stemma-qt) connectors. This means that you can, without needing to solder, connect our AS7341 breakout into your 3.3V or 5V microcontroller of choice be it an Arduino Uno, Raspberry Pi, or one of the many [CircuitPython compatible boards](https://circuitpython.org/downloads). While it certainly takes a bit of work to make all those different light sensors share their measurements, our Arduino and CircuitPython libraries take care of all of that hard work for you and even include example code to help get you started. Read on and you'll find library installation instructions, as well as wiring diagrams that make using the AS7341 super easy.

![](https://cdn-learn.adafruit.com/assets/assets/000/094/046/medium800/adafruit_products_edit_4698_side_ORIG_2020_08.png?1597258509)

# Adafruit AS7341 10-Channel Light / Color Sensor Breakout

## Pinouts

![](https://cdn-learn.adafruit.com/assets/assets/000/094/051/medium800/adafruit_products_edit_4698_top_ORIG_2020_08.png?1597258907)

## **Power Pins**

- **VIN** - this is the power pin. Since the sensor chip uses 1.8 VDC, we have included a voltage regulator on board that will take 3-5VDC and safely convert it down. To power the board, give it the same power as the logic level of your microcontroller - e.g. for a 5V microcontroller like Arduino, use 5V
- **GND** - common ground for power and logic

 **I2C Logic Pins**

- **SCL** - I2C clock pin, connect to your microcontroller I2C clock line. This pin is level shifted so you can use 3-5V logic, and there's a **10K pullup** on this pin.
- **SDA** - I2C data pin, connect to your microcontroller I2C data line. This pin is level shifted so you can use 3-5V logic, and there's a **10K pullup** on this pin.
- [**STEMMA QT**](https://learn.adafruit.com/introducing-adafruit-stemma-qt) **&nbsp;-** These connectors allow you to connectors to dev boards with&nbsp; **STEMMA QT** connectors or to other things with&nbsp;[various associated accessories](https://www.adafruit.com/?q=JST%20SH%204)

 **Other Pins**

- **INT** -This is the interrupt pin. You can setup the AS7341 to pull this low when certain conditions are met such as new measurement data being available. Consult the [datasheet](https://ams.com/documents/20143/36005/AS7341_DS000504_3-00.pdf/) for usage
- **GPIO** - This is a **G** eneral **P** urpose **I** nput **O** utput pin that can be controlled via the AS7341 and can be used to trigger measurements. Consult the [datasheet](https://ams.com/documents/20143/36005/AS7341_DS000504_3-00.pdf/) for usage

# Adafruit AS7341 10-Channel Light / Color Sensor Breakout

## Arduino

Using the AS7341 with Arduino is a simple matter of wiring up the sensor to your Arduino-compatible microcontroller, installing the [Adafruit AS7341](https://github.com/adafruit/Adafruit_AS7341) library we've written, and running the provided example code.

## **I2C Wiring**

Use this wiring if you want to connect via I2C interface. The I2C address for the AS7341 is **0x39**

Here is how to wire up the sensor using one of the [**STEMMA QT**](https://learn.adafruit.com/introducing-adafruit-stemma-qt) connectors. The examples show a Metro but wiring will work the same for an Arduino or other compatible board.

- Connect&nbsp;**board VIN (red wire)** to&nbsp; **Arduino 5V** &nbsp;if you are running a **5V** board Arduino (Uno, etc.).&nbsp;If your board is **3V,** connect to that instead.
- Connect **board GND (black wire)&nbsp;**to&nbsp; **Arduino**  **GND**
- Connect **board SCL (yellow wire)&nbsp;**to&nbsp; **Arduino**  **SCL**
- Connect **board SDA (blue wire)&nbsp;**to&nbsp; **Arduino**  **SDA**

![adafruit_products_AS7341_Arduino_STEMMA_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/093/853/medium640/adafruit_products_AS7341_Arduino_STEMMA_bb.jpg?1596660106)

Here is how to wire the sensor to a board using a solderless breadboard:

- Connect&nbsp;**board VIN (red wire)** to&nbsp; **Arduino 5V** &nbsp;if you are running a **5V** board Arduino (Uno, etc.).&nbsp;If your board is **3V,** connect to that instead.
- Connect **board GND (black wire)&nbsp;**to&nbsp; **Arduino**  **GND**
- Connect **board SCL (yellow wire)&nbsp;**to&nbsp; **Arduino**  **SCL**
- Connect **board SDA (blue wire)&nbsp;**to&nbsp; **Arduino**  **SDA**

![adafruit_products_AS7341_Arduino_breadboard_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/093/856/medium640/adafruit_products_AS7341_Arduino_breadboard_bb.jpg?1596660139)

## **Library Installation**

You can install the **Adafruit AS7341 l** ibrary for Arduino using the Library Manager in the Arduino IDE.

![](https://cdn-learn.adafruit.com/assets/assets/000/093/712/medium800/adafruit_products_a_ARDUINO_-_library_manager_menu.png?1596394261)

Click the&nbsp; **Manage Libraries ...** menu item, search for **Adafruit AS7341** ,&nbsp;and select the&nbsp; **Adafruit AS7341** &nbsp;library:

![](https://cdn-learn.adafruit.com/assets/assets/000/093/710/medium800/adafruit_products_c_arduino_libmgr.png?1596394166)

Follow the same process for the&nbsp; **Adafruit BusIO** &nbsp;library.

![](https://cdn-learn.adafruit.com/assets/assets/000/093/713/medium800/adafruit_products_aa_ARDUINO-_BusIO_Lib_Manager.png?1596394271)

## **Load Example**

Open up&nbsp; **File -\> Examples -\> Adafruit AS7341 -\> get\_channel**

After opening the demo file, upload to your Arduino wired up to the sensor. Once you upload the code, you will see the raw readings for each light frequency band being printed when you open the Serial Monitor ( **Tools-\>Serial Monitor** ) at **115200 baud** , similar to this:

![](https://cdn-learn.adafruit.com/assets/assets/000/093/711/medium800/adafruit_products_c_arduino_example_screenshot.png?1596394170)

## **Example Code**
https://github.com/adafruit/Adafruit_AS7341/blob/master/examples/get_channel/get_channel.ino

# Adafruit AS7341 10-Channel Light / Color Sensor Breakout

## Arduino Docs

# Adafruit AS7341 10-Channel Light / Color Sensor Breakout

## Python & CircuitPython

It's easy to use the **AS7341** with Python or CircuitPython, and the [Adafruit CircuitPython AS7341](https://github.com/adafruit/Adafruit_CircuitPython_AS7341) module. This module allows you to easily write Python code that reads multi-spectral color intensity from the **AS7341** sensor.

You can use this sensor with any CircuitPython microcontroller board or with a computer that has GPIO and Python [thanks to Adafruit\_Blinka, our CircuitPython-for-Python compatibility library](https://learn.adafruit.com/circuitpython-on-raspberrypi-linux).

## **CircuitPython Microcontroller Wiring**

First wire up a AS7341 to your board exactly as shown below. Here's an example of wiring a Feather M4 to the sensor with I2C using one of the handy [**STEMMA QT**](https://learn.adafruit.com/introducing-adafruit-stemma-qt) connectors:

- **Board 3V** &nbsp;to&nbsp;**sensor VIN (red wire)**
- **Board GND** &nbsp;to&nbsp;**sensor GND (black wire)**
- **Board SCL** &nbsp;to&nbsp;**sensor SCL (yellow wire)**
- **Board SDA** &nbsp;to&nbsp;**sensor SDA (blue wire)**

![adafruit_products_AS7341_FeatherM4_STEMMA_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/093/852/medium640/adafruit_products_AS7341_%10FeatherM4_STEMMA_bb.jpg?1596660086)

You can also use the standard **0.100" pitch** headers to wire it up on a breadboard:

- **Board 3V** &nbsp;to&nbsp;**sensor VIN (red wire)**
- **Board GND** &nbsp;to&nbsp;**sensor GND (black wire)**
- **Board SCL** &nbsp;to&nbsp;**sensor SCL (yellow wire)**
- **Board SDA** &nbsp;to&nbsp;**sensor SDA (blue wire)**

![adafruit_products_AS7341_FeatherM4_breadboard_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/093/851/medium640/adafruit_products_AS7341_%10FeatherM4_breadboard_bb.jpg?1596660188)

## **Python Computer Wiring**

Since there's _dozens_ of Linux computers/boards you can use, we will show wiring for Raspberry Pi. For other platforms, [please visit the guide for CircuitPython on Linux to see whether your platform is supported](https://learn.adafruit.com/circuitpython-on-raspberrypi-linux).&nbsp;

Here's the Raspberry Pi wired to the sensor using I2C and a [**STEMMA QT**](https://learn.adafruit.com/introducing-adafruit-stemma-qt) connector:

- **Pi 3V** &nbsp;to&nbsp;**sensor VCC (red wire)**
- **Pi GND** &nbsp;to&nbsp;**sensor GND (black wire)**
- **Pi SCL** &nbsp;to&nbsp;**sensor SCL (yellow wire)**
- **Pi SDA** &nbsp;to&nbsp;**sensor SDA (blue wire)**

![adafruit_products_AS7341_RasPi_STEMMA_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/093/849/medium640/adafruit_products_AS7341_RasPi_STEMMA_bb.jpg?1596659845)

Finally here is an example of how to wire up a Raspberry Pi to the sensor using a solderless breadboard

- **Pi 3V** &nbsp;to&nbsp;**sensor VCC (red wire)**
- **Pi GND** &nbsp;to&nbsp;**sensor GND (black wire)**
- **Pi SCL** &nbsp;to&nbsp;**sensor SCL (yellow wire)**
- **Pi SDA** &nbsp;to&nbsp;**sensor SDA (blue wire)**

![adafruit_products_AS7341_RasPi_breadboard_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/093/850/medium640/adafruit_products_AS7341_RasPi_breadboard_bb.jpg?1596659953)

## **CircuitPython Installation of AS7341 Library**

You'll need to install the [Adafruit CircuitPython AS7341](https://github.com/adafruit/Adafruit_CircuitPython_AS7341) library on your CircuitPython board.

First make sure you are running the&nbsp;[latest version of Adafruit CircuitPython](https://learn.adafruit.com/welcome-to-circuitpython/installing-circuitpython)&nbsp;for your board.

Next you'll need to install the necessary libraries&nbsp;to use the hardware--carefully follow the steps to find and install these libraries from&nbsp;[Adafruit's CircuitPython library bundle](https://circuitpython.org/libraries).&nbsp; Our CircuitPython starter guide has [a great page on how to install the library bundle](https://learn.adafruit.com/welcome-to-circuitpython/circuitpython-libraries).

Before continuing make sure your board's **lib** folder or root filesystem has the **adafruit\_AS7341.mpy** file as well as the **adafruit\_bus\_device** &nbsp; and **adafruit\_register** folders.

Next&nbsp;[connect to the board's serial REPL&nbsp;](https://learn.adafruit.com/welcome-to-circuitpython/the-repl)so you are at the CircuitPython&nbsp; **\>\>\>** &nbsp;prompt.

## **Python Installation of AS7341 Library**

You'll need to install the **Adafruit\_Blinka** library that provides the CircuitPython support in Python. This may also require enabling I2C on your platform and verifying you are running Python 3.&nbsp;[Since each platform is a little different, and Linux changes often, please visit the CircuitPython on Linux guide to get your computer ready](https://learn.adafruit.com/circuitpython-on-raspberrypi-linux)!

Once that's done, from your command line run the following command:

- `sudo pip3 install adafruit-circuitpython-as7341`

If your default Python is version 3 you may need to run 'pip' instead. Just make sure you aren't trying to use CircuitPython on Python 2.x, it isn't supported!

## **CircuitPython & Python Usage**

To demonstrate the usage of the sensor we'll initialize it and read the measurements for each channel from the board's Python REPL.

Run the following code to import the necessary modules and initialize the I2C connection with the sensor:

```python
from time import sleep
import board
from adafruit_as7341 import AS7341

i2c = board.I2C()
sensor = AS7341(i2c)
```

![](https://cdn-learn.adafruit.com/assets/assets/000/102/048/medium800/adafruit_products_as7341.png?1620304322)

Now you're ready to read values from the sensor using these properties using the code below

- **channel\_415nm** - Data for F1, the 415nm channel
- **channel\_445nm** - Data for F2, the 445nm channel
- **channel\_480nm** - Data for F3, the 480nm channel
- **channel\_515nm** - Data for F4, the 515nm channel
- **channel\_555nm** - Data for F5, the 555nm channel
- **channel\_590nm** - Data for F6, the 590nm channel
- **channel\_630nm** - Data for F7, the 630nm channel
- **channel\_680nm** - Data for F8, the 680nm channel

```python
print("F1 - 415nm/Violet  %s" % sensor.channel_415nm)
print("F2 - 445nm//Indigo %s" % sensor.channel_445nm)
print("F3 - 480nm//Blue   %s" % sensor.channel_480nm)
print("F4 - 515nm//Cyan   %s" % sensor.channel_515nm)
print("F5 - 555nm/Green   %s" % sensor.channel_555nm)
print("F6 - 590nm/Yellow  %s" % sensor.channel_590nm)
print("F7 - 630nm/Orange  %s" % sensor.channel_630nm)
print("F8 - 680nm/Red     %s" % sensor.channel_680nm)
```

![](https://cdn-learn.adafruit.com/assets/assets/000/093/829/medium800/adafruit_products_d_cp_repl_props.png?1596652633)

## **Example Code**
https://github.com/adafruit/Adafruit_CircuitPython_AS7341/blob/main/examples/as7341_simpletest.py

# Adafruit AS7341 10-Channel Light / Color Sensor Breakout

## Python Docs

# Adafruit AS7341 10-Channel Light / Color Sensor Breakout

## Downloads

## **Files**

- [AS7341 Datasheet](https://ams.com/documents/20143/36005/AS7341_DS000504_3-00.pdf/)
- [EagleCAD files on GitHub](https://github.com/adafruit/Adafruit-AS7341-PCB)
- [3D Models on GitHub](https://github.com/adafruit/Adafruit_CAD_Parts/tree/main/4698%20AS7341%20Light%20Color%20Sensor)
- [Fritzing object in the Adafruit Fritzing Library](https://github.com/adafruit/Fritzing-Library/blob/master/parts/Adafruit%20AS7341.fzpz)

## **Schematic**
![](https://cdn-learn.adafruit.com/assets/assets/000/093/709/medium800/adafruit_products_e_downloads_schematic.png?1596394135)

## **Fab Print**
![](https://cdn-learn.adafruit.com/assets/assets/000/093/708/medium800/adafruit_products_e_downloads_fab_print.png?1596394112)

## **3D Model**
![](https://cdn-learn.adafruit.com/assets/assets/000/119/862/medium800/adafruit_products_4698_AS7341_Light_Color_Sensor.jpg?1680030368)


## Featured Products

### Adafruit AS7341 10-Channel Light / Color Sensor Breakout

[Adafruit AS7341 10-Channel Light / Color Sensor Breakout](https://www.adafruit.com/product/4698)
The **Adafruit AS7341 10-Channel Light / Color Sensor Breakout** is a multi-channel spectrometer, which is a special type of light sensor that is able to detect not only the amount of light present but also the amounts of light within different wavelengths. This means that you can...

In Stock
[Buy Now](https://www.adafruit.com/product/4698)
[Related Guides to the Product](https://learn.adafruit.com/products/4698/guides)
### STEMMA QT / Qwiic JST SH 4-pin to Premium Male Headers Cable

[STEMMA QT / Qwiic JST SH 4-pin to Premium Male Headers Cable](https://www.adafruit.com/product/4209)
This 4-wire cable is a little over 150mm / 6" long and fitted with JST-SH female 4-pin connectors on one end and premium Dupont male headers on the other. Compared with the chunkier JST-PH these are 1mm pitch instead of 2mm, but still have a nice latching feel, while being easy to insert...

Out of Stock
[Buy Now](https://www.adafruit.com/product/4209)
[Related Guides to the Product](https://learn.adafruit.com/products/4209/guides)
### JST SH 4-pin Cable with Alligator Clips - STEMMA QT / Qwiic

[JST SH 4-pin Cable with Alligator Clips - STEMMA QT / Qwiic](https://www.adafruit.com/product/4398)
This cable will make it super easy to use our plug-and-play STEMMA QT boards with boards like Circuit Playground. On one end you get a Qwiic / STEMMA QT connector (technically known as a JST SH 4-pin plug)&nbsp; into 4 individual wires with grippy alligator clips. We're carrying these to...

Out of Stock
[Buy Now](https://www.adafruit.com/product/4398)
[Related Guides to the Product](https://learn.adafruit.com/products/4398/guides)
### 4-pin JST PH to JST SH Cable - STEMMA to QT / Qwiic

[4-pin JST PH to JST SH Cable - STEMMA to QT / Qwiic](https://www.adafruit.com/product/4424)
Are you a maker in the midst of&nbsp;a [**STEMMA**](https://learn.adafruit.com/introducing-adafruit-stemma-qt/what-is-stemma) dilemma? This 200mm long 4-wire cable is a fantastic chimera-cable fitted with **STEMMA QT / Sparkfun Qwiic JST SH** on one end,...

In Stock
[Buy Now](https://www.adafruit.com/product/4424)
[Related Guides to the Product](https://learn.adafruit.com/products/4424/guides)
### STEMMA QT / Qwiic JST SH 4-pin Cable with Premium Female Sockets

[STEMMA QT / Qwiic JST SH 4-pin Cable with Premium Female Sockets](https://www.adafruit.com/product/4397)
This 4-wire cable is a little over 150mm / 6" long and fitted with JST-SH female 4-pin connectors on one end and premium female headers on the other. Compared with the chunkier JST-PH these are 1mm pitch instead of 2mm, but still have a nice latching feel, while being easy to insert and...

Out of Stock
[Buy Now](https://www.adafruit.com/product/4397)
[Related Guides to the Product](https://learn.adafruit.com/products/4397/guides)
### STEMMA QT / Qwiic JST SH 4-pin Cable - 100mm Long

[STEMMA QT / Qwiic JST SH 4-pin Cable - 100mm Long](https://www.adafruit.com/product/4210)
This 4-wire cable is a little over 100mm / 4" long and fitted with JST-SH female 4-pin connectors on both ends. Compared with the chunkier JST-PH these are 1mm pitch instead of 2mm, but still have a nice latching feel, while being easy to insert and remove.

<a...></a...>

Out of Stock
[Buy Now](https://www.adafruit.com/product/4210)
[Related Guides to the Product](https://learn.adafruit.com/products/4210/guides)

## Related Guides

- [Color Sensing Music Player](https://learn.adafruit.com/color-sensing-music-player.md)
- [Bricktunes: LEGO Synthesizer Glove](https://learn.adafruit.com/bricktunes-lego-glove-synthesizer.md)
- [Adafruit TCA8418 Keypad Matrix and GPIO Expander Breakout](https://learn.adafruit.com/adafruit-tca8418-keypad-matrix-and-gpio-expander-breakout.md)
- [Submitting an open-source project to OSHWA](https://learn.adafruit.com/submitting-an-open-source-project-to-oshwa.md)
- [Adafruit Universal USB / DC / Solar Lithium Ion/Polymer charger - BQ24074](https://learn.adafruit.com/adafruit-bq24074-universal-usb-dc-solar-charger-breakout.md)
- [Adafruit INA23x DC Current Voltage Power Monitor](https://learn.adafruit.com/adafruit-ina237-dc-current-voltage-power-monitor.md)
- [Adafruit MEMENTO Camera Board](https://learn.adafruit.com/adafruit-memento-camera-board.md)
- [LED Matrix Alarm Clock](https://learn.adafruit.com/led-matrix-alarm-clock.md)
- [Adafruit Pixel Trinkey](https://learn.adafruit.com/adafruit-pixel-trinkey.md)
- [Adafruit MCP9808 Precision I2C Temperature Sensor Guide](https://learn.adafruit.com/adafruit-mcp9808-precision-i2c-temperature-sensor-guide.md)
- [Adafruit BMP388 and BMP390 - Precision Barometric Pressure and Altimeter](https://learn.adafruit.com/adafruit-bmp388-bmp390-bmp3xx.md)
- [ItsyBitsy ESP32 wFL case](https://learn.adafruit.com/itsybitsy-esp32-wfl-case.md)
- [Adafruit Monochrome 1.12" 128x128 OLED Graphic Display](https://learn.adafruit.com/adafruit-monochrome-1-12-in-128x128-oled.md)
- [Adafruit LIS2MDL Triple Axis Magnetometer](https://learn.adafruit.com/adafruit-lis2mdl-triple-axis-magnetometer.md)
- [Adafruit 2.13" 250x122 Quad-Color eInk](https://learn.adafruit.com/adafruit-2-13-250x122-quad-color-eink.md)
