# Adafruit ADG728 1-to-8 Analog Matrix Switch

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/129/300/medium800/adafruit_products_5899-03.jpg?1712760005)

Analog switches are a solid state alternative to relays, when you want a smaller, lower-power technology that won't wear out mechanically. And, as the name implies, you can use the **Adafruit ADG728 1-to-8 Analog Matrix Switch** to connect between eight analog signals, much like a set of 8 mechanical switches. These chips tend to be tiny surface mount parts, so this breakout will let anyone use the ADG728 switch for signals up to 5V, without fiddly soldering.

![](https://cdn-learn.adafruit.com/assets/assets/000/129/301/medium800/adafruit_products_5899-01.jpg?1712760079)

The ADG728 uses I2C to select which of the 8 channels switches to turn on or off, to connect that channel to the single analog 'D' pin. Note that unlike digital switches and multiplexers, these are not 'input' and 'output' because the signal is bidirectional. You could have the D signal be an input to 8 outputs, or the 8 inputs to one output.

![](https://cdn-learn.adafruit.com/assets/assets/000/129/302/medium800/adafruit_products_5899-02.jpg?1712760126)

Also, the ADG728 isn't really a 'selecting multiplexer', **it's a matrix switch with 8 independent switches**. That means that yes, you could treat it like an SP8T where you select which signal is routed to the D pin, you can also turn on multiple switches to 'merge' the signals together.

Unlike a relay or mechanical switch, analog switches don't wear out, and the switch time is near instant, about 100nS. The ADG728 chip also guarantees break-before-make so the deselected switches will open before selected switches close.

![](https://cdn-learn.adafruit.com/assets/assets/000/129/303/medium800/adafruit_products_5899-04.jpg?1712760163)

However, there's a few things to watch out for:

- **The VIN power pin** (the red wire if using a STEMMA QT cable) **must as high as the highest analog voltages you want to switch**. That means if the analog signals are no more than 5VDC, the V+ pin must be higher than 5V. You cannot power this pin with 3.3V and switch 5V signals.
- **It cannot switch signals below ground**. No negative voltages can be applied to the Switch or D pins!
- **Analog switches are for signals, not power!** Since this is not a mechanical switch, the signals pass through circuitry that is not designed to source or sink current. This is great for analog signal voltages, and is not good for providing more than a few mA of current.

![](https://cdn-learn.adafruit.com/assets/assets/000/129/304/medium800/adafruit_products_5899-00.jpg?1712760304)

In addition to the 8 switch S pins and the D pin that can be switched to, there are also two I2C address pins, so you can change the default address from 0x4C up to 0x4F. There's also a reset pin if you want to immediately set all the switches to open.

To get you going fast, we spun up a custom-made PCB in the[&nbsp; **STEMMA QT** form factor](https://www.adafruit.com/?q=stemma%20qt%20sensor "STEMMA QT form factor"), making it easy to interface with. The [STEMMA QT connectors](https://learn.adafruit.com/introducing-adafruit-stemma-qt/what-is-stemma-qt) on either side are compatible with the [SparkFun Qwiic](https://www.sparkfun.com/qwiic) I2C connectors. This allows you to make solderless connections between your development board and the ADG or to chain it with a wide range of other sensors and accessories using a [**compatible cable**](https://www.adafruit.com/?q=stemma%20qt%20cable).

# Adafruit ADG728 1-to-8 Analog Matrix Switch

## Pinouts

![](https://cdn-learn.adafruit.com/assets/assets/000/129/317/medium800/adafruit_products_double.jpg?1712779665)

The default I2C address is **0x4C**.

## Power Pins

- **VIN** - this is the power pin. 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. It also needs to have the same voltage as the highest signal you are switching. That means if the analog signals are no more than 5VDC, the **VIN** pin must be higher than 5V. You cannot power this pin with 3.3V and switch 5V signals.
- **GND** - common ground for power and logic.

## I2C Logic Pins

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

## Analog Switch Pins

- **S1-S8** - The 8 switch channels. Unlike digital switches and multiplexers, these channels are not strictly 'inputs' or 'outputs' because the signal is bidirectional.
- **D** - The analog pin for the switch. **D** can act as input or an output. It can be an input to the 8 channel outputs, or the 8 channel inputs can be output to&nbsp; **D**.

This breakout isn't really a 'selecting multiplexer', a matrix switch with 8 independent switches. You could treat it like an SP8T where you select which of the 8 channels are routed to the **D** pin. You can also turn on multiple channels to 'merge' the signals together.

There are a few things to keep in mind when using these pins:

- **The switch signals cannot be below ground**. No negative voltages can be applied to the Switch or D pins!
- **Analog switches are for signals, not power!** Since this is not a mechanical switch, the signals pass through circuitry that is not designed to source or sink current. This is great for analog signal voltages, and is not good for providing more than a few mA of current.

## Address Pins

On the back of the board are **two address jumpers** , labeled **A0** and **A1**. These jumpers allow you to chain up to 4 of these boards on the same pair of I2C clock and data pins. To do so, you solder the jumpers "closed" by connecting the two pads.

On the front of the board are two address pins, labeled **A0** and **A1**. Just like the jumpers, these pins allow you to change the I2C address to connect multiple boards by connecting them to **VIN**.

The default I2C address is **0x4C**. The other address options can be calculated by "adding" the **A0/A1** to the base of **0x4C**.

**A0** sets the lowest bit with a value of **1** and **A**** 1 **sets the next bit with a value of** 2 ****.** The final address is **0x4C + A1 + A0** which would be **0x4F**.

If only **A0** is soldered closed, the address is **0x4C + 1 = 0x4D**

If only **A1** is soldered closed, the address is **0x4C + 2 = 0x4E**

The table below shows all possible addresses, and whether the pin(s) should be high (closed) or low (open).

![](https://cdn-learn.adafruit.com/assets/assets/000/129/340/medium800/adafruit_products_i2c.png?1713189218)

## Reset Pin

- **RST** - This is the reset pin for the ADG728. You can tie it to **GND** to immediately set all the switch channels to open.

## Power LED and LED Jumper

- **Power LED -** In the upper left corner, above the STEMMA connector, on the front of the board, is the power LED, labeled **on**. It is a green LED.
- **LED jumper&nbsp;** - This jumper is located on the back of the board, in the upper right corner. It's labeled **LED** on the board silk. Cut the trace on this jumper to cut power to the "on" LED.

# Adafruit ADG728 1-to-8 Analog Matrix Switch

## CircuitPython

It's easy to use the **ADG728** with CircuitPython and and the [Adafruit\_CircuitPython\_ADG72x](https://github.com/adafruit/Adafruit_CircuitPython_ADG72x) module. This module allows you to easily write Python code to control the matrix switch.

## CircuitPython Microcontroller Wiring

First wire up the switch to your board exactly as follows. The following is the switch wired to a Feather RP2040 using the STEMMA QT connector. You'll connect your two external analog inputs to **S1** and **S5**.

- **Board STEMMA 3V** to **switch** **VIN (red wire)**  
- **Board STEMMA GND** to **switch** &nbsp;**GND (black wire)**  
- **Board STEMMA SCL** to **switch** &nbsp;**SCL (yellow wire)**  
- **Board STEMMA SDA** to **switch** &nbsp;**SDA (blue wire)**
- **Board A0** to **switch D (purple wire)**
- **Analog signal 1** to **switch S1 (orange wire)**
- **Analog signal 2** &nbsp;to **switch S5 (green wire)**

**Make sure to share all grounds between the incoming analog signals and the circuit.**

![adafruit_products_featherStemma_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/129/343/medium640/adafruit_products_featherStemma_bb.jpg?1713192962)

The following is the switch wired to a Feather RP2040 using a solderless breadboard:

- **Board 3V** to **switch** **VIN (red wire)**  
- **Board GND** to **switch** &nbsp;**GND (black wire)**  
- **Board SCL** to **switch** &nbsp;**SCL (yellow wire)**  
- **Board SDA** to **switch** &nbsp;**SDA (blue wire)**
- **Board A0** &nbsp;to **switch D (purple wire)**
- **Analog signal 1** to **switch S1 (orange wire)**
- **Analog signal 2** to **switch S5 (green wire)**

**Make sure to share all grounds between the incoming analog signals and the circuit.**

![adafruit_products_featherBB_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/129/344/medium640/adafruit_products_featherBB_bb.jpg?1713193013)

## CircuitPython Usage

To use with CircuitPython, you need to first install the **Adafruit\_CircuitPython\_ADG72x** library, and its dependencies, into the **lib** folder on your **CIRCUITPY** drive. Then you need to update **code.py** with the example script.

Thankfully, we can do this in one go. In the example below, click the **Download Project Bundle** button below to download the necessary libraries and the **code.py** file in a zip file. Extract the contents of the zip file, and copy the **entire**  **lib**  **folder** and the **code.py** file to your **CIRCUITPY** drive.

Your **CIRCUITPY/lib** folder should contain the following folder and file:

- **adafruit\_bus\_device/**
- **adafruit\_adg72x.mpy**

![CIRCUITPY](https://adafruit.github.io/Adafruit_Learning_System_Guides/ADG72x_Examples_CircuitPython_ADG728.png )

## Example Code

Once everything is saved to the **CIRCUITPY** drive, [connect to the serial console](https://learn.adafruit.com/welcome-to-circuitpython/kattni-connecting-to-the-serial-console) to see the data printed out!

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/ADG72x_Examples/CircuitPython_ADG728/code.py

Every two seconds, the ADG728 switches channels being sent to pin **D**. In the **.GIF** below, you'll see analog signals on channel 1 ( **S1** ) and channel 5 ( **S5** ) being read from pin **D** to board pin&nbsp; **A0** as their channels are turned on.

![](https://cdn-learn.adafruit.com/assets/assets/000/129/435/medium800thumb/adafruit_products_1x8_onOff.jpg?1713384447)

# Adafruit ADG728 1-to-8 Analog Matrix Switch

## Python Docs

# Adafruit ADG728 1-to-8 Analog Matrix Switch

## Arduino

Using the ADG728 breakout with Arduino involves wiring up the breakout to your Arduino-compatible microcontroller, installing the [Adafruit\_ADG72x](https://github.com/adafruit/Adafruit_ADG72x) library, and running the provided example code.

## Wiring

Wire as shown for a **5V** board like an Uno. If you are using a **3V** board, like an Adafruit Feather, wire the board's 3V pin to the sensor VIN.

Here is an Adafruit Metro wired up to the breakout using the STEMMA QT connector. You'll connect your two external analog inputs to **S1** and **S5** :

- **Board 5V** to **switch** **VIN (red wire)**  
- **Board GND** to **switch** &nbsp;**GND (black wire)**  
- **Board SCL** to **switch** &nbsp;**SCL (yellow wire)**  
- **Board SDA** to **switch** &nbsp;**SDA (blue wire)**
- **Board A0** to **switch D (purple wire)**
- **Analog signal 1** to **switch S1 (orange wire)**
- **Analog signal 2** &nbsp;to **switch S5 (green wire)**

**Make sure to share all grounds between the incoming analog signals and the circuit.**

![adafruit_products_metroStemma_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/129/341/medium640/adafruit_products_metroStemma_bb.jpg?1713190334)

Here is an Adafruit Metro wired up using a solderless breadboard:

- **Board 5V** to **switch** **VIN (red wire)**  
- **Board GND** to **switch** &nbsp;**GND (black wire)**  
- **Board SCL** to **switch** &nbsp;**SCL (yellow wire)**  
- **Board SDA** to **switch** &nbsp;**SDA (blue wire)**
- **Board A0** &nbsp;to **switch D (purple wire)**
- **Analog signal 1** to **switch S1 (orange wire)**
- **Analog signal 2** to **switch S5 (green wire)**

**Make sure to share all grounds between the incoming analog signals and the circuit.**

![adafruit_products_metroBB_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/129/342/medium640/adafruit_products_metroBB_bb.jpg?1713190356)

## Library Installation

You can install the **Adafruit\_ADG72x** library for Arduino using the Library Manager in the Arduino IDE.

![](https://cdn-learn.adafruit.com/assets/assets/000/129/331/medium800/adafruit_products_Arduino_Open_Library_Manager.png?1712925737)

Click the **Manage Libraries ...** menu item, search for **Adafruit\_ADG72x** , and select the **Adafruit ADG72x** library:

![](https://cdn-learn.adafruit.com/assets/assets/000/129/332/medium800/adafruit_products_lib.png?1712925948)

If asked about dependencies, click "Install all".

![](https://cdn-learn.adafruit.com/assets/assets/000/129/333/medium800/adafruit_products_depends.png?1712925987)

If the "Dependencies" window does not come up, then you already have the dependencies installed.

Warning: If the dependencies are already installed, you must make sure you update them through the Arduino Library Manager before loading the example!

## Example Code
https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/ADG72x_Examples/Arduino_ADG728_Plotter/Arduino_ADG728_Plotter.ino

Upload the sketch to your board and open up the Serial Plotter ( **Tools -\> Serial Plotter** ) at 115200 baud. You'll see the analog data printed to the plotter. Every two seconds, the ADG728 switches channels being sent to pin **D**. In the **.GIF** below, you'll see analog signals on channel 1 ( **S1** ) and channel 5 ( **S5** ) being read from pin **D** to board pin&nbsp; **A0** as their channels are turned on.

![](https://cdn-learn.adafruit.com/assets/assets/000/129/334/medium800thumb/adafruit_products_arduinoADG728.jpg?1712940670)

# Adafruit ADG728 1-to-8 Analog Matrix Switch

## Arduino Docs

# Adafruit ADG728 1-to-8 Analog Matrix Switch

## Downloads

## Files

- [ADG728 Datasheet](https://cdn-learn.adafruit.com/assets/assets/000/129/305/original/ADG728_729.pdf?1712760443)
- [EagleCAD PCB Files on GitHub](https://github.com/adafruit/Adafruit-ADG728-1-to-8-Analog-Matrix-Switch-PCB)
- [Fritzing object in the Adafruit Fritzing Library](https://github.com/adafruit/Fritzing-Library/blob/master/parts/Adafruit%20ADG728%201-to-8%20Analog%20Matrix%20Switch.fzpz)

## Schematic and Fab Print
![](https://cdn-learn.adafruit.com/assets/assets/000/129/306/medium800/adafruit_products_schem.png?1712760723)

![](https://cdn-learn.adafruit.com/assets/assets/000/129/307/medium800/adafruit_products_fab.png?1712760730 dimensions are in inches)


## Primary Products

### Adafruit ADG728 1-to-8 Analog Matrix Switch

[Adafruit ADG728 1-to-8 Analog Matrix Switch](https://www.adafruit.com/product/5899)
Analog switches are a solid state alternative to relays, when you want a smaller, lower-power technology that won't wear out mechanically. And, as the name implies, you can use the&nbsp; **Adafruit ADG728 1-to-8 Analog Matrix Switch** to connect between eight analog signals,...

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

## Featured Products

### 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)
### STEMMA QT / Qwiic JST SH 4-Pin Cable - 50mm Long

[STEMMA QT / Qwiic JST SH 4-Pin Cable - 50mm Long](https://www.adafruit.com/product/4399)
This 4-wire cable is&nbsp;50mm / 1.9" 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...>

In Stock
[Buy Now](https://www.adafruit.com/product/4399)
[Related Guides to the Product](https://learn.adafruit.com/products/4399/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...

In 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 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...

In 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)

## Related Guides

- [Hang out your washing reminder - Adafruit IO + Vibration switch](https://learn.adafruit.com/hang-out-your-washing-reminder-adafruit-io-vibration-switch.md)
- [Adafruit 555 PWM Output STEMMA](https://learn.adafruit.com/adafruit-555-pwm-output-stemma.md)
- [Adafruit DS2482S-800 8 Channel I2C to 1-Wire Bus Adapter](https://learn.adafruit.com/adafruit-ds2482s-800-8-channel-i2c-to-1-wire-bus-adapter.md)
- [Adafruit EyeLights LED Glasses and Driver](https://learn.adafruit.com/adafruit-eyelights-led-glasses-and-driver.md)
- [Adafruit Metro M7 1011 with AirLift](https://learn.adafruit.com/adafruit-metro-m7-with-airlift.md)
- [Adafruit CAP1188 Breakout](https://learn.adafruit.com/adafruit-cap1188-breakout.md)
- [74HC595 Shift Register](https://learn.adafruit.com/74hc595.md)
- [Adafruit ST25DV16K I2C RFID EEPROM Breakout](https://learn.adafruit.com/adafruit-st25dv16k-i2c-rfic-eeprom-breakout.md)
- [Stand-alone programming AVRs using CircuitPython](https://learn.adafruit.com/stand-alone-programming-avrs-using-circuitpython.md)
- [PyPortal Wake-Up Light Alarm Clock](https://learn.adafruit.com/pyportal-wake-up-light.md)
- [Adafruit QT Py RP2040](https://learn.adafruit.com/adafruit-qt-py-2040.md)
- [Adafruit TSMP96000 IR Receiver Breakout](https://learn.adafruit.com/adafruit-tsmp96000-ir-receiver-breakout.md)
- [Adafruit WINC1500 WiFi Shield for Arduino](https://learn.adafruit.com/adafruit-winc1500-wifi-shield-for-arduino.md)
- [Adafruit bq25185 USB / DC / Solar Charger with 3.3V Buck Board](https://learn.adafruit.com/adafruit-bq25185-usb-dc-solar-charger-with-3-3v-buck-board.md)
- [Adafruit QT Py ESP32-S3](https://learn.adafruit.com/adafruit-qt-py-esp32-s3.md)
