How does it work?
Analog MUX 2 Click is based on the ADG728, a low voltage, CMOS 8-channel analog matrix switch with a serially controlled 2-wire interface from Analog Devices. The ADG728 can operate equally well as either multiplexer, demultiplexer, or switch array, providing more flexibility. It also features a low on-resistance closely matched between switches and very flat over the full signal range. During the Power-Up of the ADG728, all switching channels will be in the OFF condition, and the internal shift register will contain all zeros. All channels exhibit ‘break-before-make’ switching action preventing momentary shorting when switching channels.
Each bit of the 8-bit serial word corresponds to one switch of the device. Internal switching channels are independently controlled by an individual bit, providing an option of having any, all, or none of the switches activated. All of the input channels of the multiplexer can be easily connected to a 9 pole spring action block terminal, without having to use any additional tools, such as screwdrivers, while the output pin from the multiplexer is routed to the AN pin on the mikroBUS™ socket.
Analog MUX 2 Click communicates with MCU using the standard I2C 2-Wire interface with a frequency of up to 400kHz. It also has two address pins (A0 and A1) programmed by the user to determine the value of the last two LSBs of the slave address, selected by onboard SMD jumpers labeled as ADDR SEL to an appropriate position marked as 0 and 1, allowing selection of the slave address LSBs. Also, this Click board™ has a Reset pin routed to the RST pin on the mikroBUS™ socket, which clears the input register and turns all switches to the OFF condition.
When changing the switch conditions, a new 8-bit word is written to the input shift register. The ADG728 compares the state of switches from the previous write cycle to minimize glitches on the switches output. This can be achieved if the switch is already in the ON condition and is required to stay ON.
This Click board™ is designed to operate with both 3.3V and 5V logic voltage levels selected via the VCC SEL jumper. It allows for both 3.3V and 5V capable MCUs to use the I2C communication lines properly. However, the Click board™ comes equipped with a library that contains functions and an example code that can be used, as a reference, for further development.
Specifications
Type
Measurements,Port expander
Applications
Can be used for a wide range of applications, from industrial and instrumentation to medical, consumer, communications, and automotive systems.
On-board modules
ADG728 – low voltage, CMOS 8-channel analog matrix switch with a serially controlled 2-wire interface from Analog Devices
Key Features
8-to-1 matrix switch, low on-resistance, ‘Break-Before-Make’ switching action, serially controlled, and more.
Interface
Analog,I2C
Feature
No ClickID
Compatibility
mikroBUS™
Click board size
L (57.15 x 25.4 mm)
Input Voltage
3.3V or 5V
Pinout diagram
This table shows how the pinout on Analog MUX 2 Click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
Onboard settings and indicators
Label | Name | Default | Description |
---|---|---|---|
LD1 | PWR | – | Power LED Indicator |
JP1 | VCC SEL | Left | Logic Level Voltage Selection 3V3/5V: Left position 3V3, Right position 5V |
JP2 | ADDR SEL | Left | I2C Address Selection 0/1: Left position 0, Right position 1 |
Analog MUX 2 Click electrical specifications
Description | Min | Typ | Max | Unit |
---|---|---|---|---|
Supply Voltage | 3.3 | – | 5 | V |
Analog Input Signal Range | 0 | – | 5 | V |
On Resistance | – | 6 | 12 | Ω |
Operating Temperature Range | -40 | +25 | +85 | °C |
Software Support
We provide a library for the Analog MUX 2 Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.
Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on mikroE github account.
Library Description
This library contains API for AnalogMUX 2 Click driver.
Key functions:
void analogmux2_cfg_setup ( analogmux2_cfg_t *cfg );
– Config Object Initialization function.ANALOGMUX2_RETVAL analogmux2_init ( analogmux2_t *ctx, analogmux2_cfg_t *cfg );
– Initialization function.void analogmux2_default_cfg ( analogmux2_t *ctx );
– Click Default Configuration function.
Examples description
This application controls the multiplexing of a single input channel with an eight-channel matrix switch.
The demo application is composed of two sections :
void application_task ( void ) { for ( uint8_t ch_pos = ANALOGMUX2_SET_CHANNEL_0; ch_pos <= ANALOGMUX2_SET_CHANNEL_7; ch_pos++ ) { analogmux2_set_channel( &analogmux2, ch_pos ); Delay_ms( 3000 ); uint16_t analogmux2_an_value = 0; log_printf( &logger, " CHANNEL : AN%u rn", ( uint16_t ) analogmux2_get_channel( &analogmux2 ) ); log_printf( &logger, "- - - - - - - - - - - - - rn" ); if ( analogmux2_read_an_pin_value ( &analogmux2, &analogmux2_an_value ) != ADC_ERROR ) { log_printf( &logger, " ADC Value : %urn", analogmux2_an_value ); } float analogmux2_an_voltage = 0; if ( analogmux2_read_an_pin_voltage ( &analogmux2, &analogmux2_an_voltage ) != ADC_ERROR ) { log_printf( &logger, " AN Voltage : %.3f V rn", analogmux2_an_voltage ); } log_printf( &logger, "-------------------------rn" ); } }
The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on mikroE github account.
Other mikroE Libraries used in the example:
- MikroSDK.Board
- MikroSDK.Log
- Click.AnalogMux2
Additional notes and informations
Depending on the development board you are using, you may need USB UART click, USB UART 2 click or RS232 click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.
mikroSDK
This Click board™ is supported with mikroSDK – MikroElektronika Software Development Kit. To ensure proper operation of mikroSDK compliant Click board™ demo applications, mikroSDK should be downloaded from the LibStock and installed for the compiler you are using.
For more information about mikroSDK, visit the official page.