It's easy to use the ADG729 with CircuitPython and and the 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 external analog input to 1A and 1B.
-
Board STEMMA 3V to switch VIN (red wire)
-
Board STEMMA GND to switch GND (black wire)
-
Board STEMMA SCL to switch SCL (yellow wire)
- Board STEMMA SDA to switch SDA (blue wire)
- Board A0 to switch DA (purple wire)
- Board A1 to switch DB (pink wire)
- Analog signal to switch 1A (orange wire) and switch 1B (green wire)
Make sure to share all grounds between the incoming analog signals and the circuit.
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 GND (black wire)
-
Board SCL to switch SCL (yellow wire)
- Board SDA to switch SDA (blue wire)
- Board A0 to switch DA (purple wire)
- Board A1 to switch DB (pink wire)
- Analog signal to switch 1A (orange wire) and switch 1B (green wire)
Make sure to share all grounds between the incoming analog signals and the circuit.
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

Example Code
Once everything is saved to the CIRCUITPY drive, connect to the serial console to see the data printed out!
# SPDX-FileCopyrightText: Copyright (c) 2024 Liz Clark for Adafruit Industries # # SPDX-License-Identifier: MIT import time import board import adafruit_adg72x from analogio import AnalogIn analog_in_DA = AnalogIn(board.A0) analog_in_DB = AnalogIn(board.A1) i2c = board.I2C() switch = adafruit_adg72x.ADG72x(i2c, 0x44) c = 0 switch_time = 3 clock = time.monotonic() while True: if (time.monotonic() - clock) > switch_time: if c < 4: channels = "A" else: channels = "B" print(f"Selecting channel {(c % 4) + 1}{channels}") switch.channel = c c = (c + 1) % 8 clock = time.monotonic() print((analog_in_DA.value, analog_in_DB.value,)) time.sleep(0.1)
Every two seconds, the ADG729 switches channels being sent to pins DA and DB. In the .GIF below, you'll see analog signals on channel 1 (1A and 1B) being read from pin DA to board pin A0 and pin DB to board pin A1 as their channels are turned on.
Page last edited January 22, 2025
Text editor powered by tinymce.