Build a top-quality microphone setup that meets your unique needs and specifications.
A
A
Hardware Overview
How does it work?
MIC 2 Click is based on a small omnidirectional electret microphone, accompanied by a digitally controlled pre-amp section. The pre-amp consists of the MCP6022, a dual, rail-to-rail, low noise operational amplifier from Microchip. This op-amp has a wide bandwidth of 10MHz, very low noise, and extremely low total harmonic distortion (THD). These features make it perfectly suitable to be used to build a microphone pre-amplifier (pre-amp). By adding a digital potentiometer IC in the feedback loop, it is possible to set the gain ratio by the host MCU. The AD5171, a digital potentiometer IC with 64 positions from Analog Devices is used in the feedback loop to digitally control the gain ratio. This device contains an OTP memory (a fuse) which can be used to lock the wiper in a permanent position. The wiper data can be changed indefinitely until the internal protection fuse is blown. This can be done by a special command. However, the Click board™ must be operated at 5V in order to successfully blow up the fuse and lock down the wiper position
permanently. Please consult the AD5171 for more details about the OTP memory programming and permanent lock-down of the wiper position. The AD5171 uses the I2C interface to communicate with the host MCU. The slave I2C address of this device can be changed using the SMD jumper, labeled as ADDR SEL. This jumper sets the LSB of the address, allowing it to be selected between 0b0101100x, and 0b0101101x, where (x) represents the R/W bit. The datasheet of the AD5171 offers a comprehensive explanation of its operation. However, it is supported by a mikroSDK compatible set of libraries. These functions greatly simplify the use, ensuring that the accidental lock-down is avoided if not wanted. One half of the MCP6022 is configured as a non-inverting amplifier, with the digital potentiometer connected as a rheostat in its feedback loop. The digital rheostat affects the feedback loop gain, allowing the host MCU to control it over the I2C interface. The input of the op-amp is biased by a voltage divider, so it stays at half the power supply
voltage when there is no signal. This way when the signal appears at the input, it can swing both down to 0V and up to VCC. A minimum gain of the op-amp is 23. It can be increased as the AD5171 is moved away from the 0 position. After power ON, the wiper of the AD5171 is in the middle position (i.e. 25K, if it is not locked down to some other value). The second op-amp of the MCP6022 serves as a unity-gain buffer, allowing the host MCU to sample the output over the AN pin of the mikroBUS™. Depending on the applied gain ratio, the output voltage may peak up to VCC. Therefore, care should be taken when selecting the voltage for the Click board™. This Click board™ can operate with either 3.3V or 5V logic voltage levels selected via the VCC SEL jumper. This way, both 3.3V and 5V capable MCUs can use the communication lines properly. Also, this Click board™ comes equipped with a library containing easy-to-use functions and an example code that can be used as a reference for further development.
Features overview
Development board
EasyPIC v8 is a development board specially designed for the needs of rapid development of embedded applications. It supports many high pin count 8-bit PIC microcontrollers from Microchip, regardless of their number of pins, and a broad set of unique functions, such as the first-ever embedded debugger/programmer. The development board is well organized and designed so that the end-user has all the necessary elements, such as switches, buttons, indicators, connectors, and others, in one place. Thanks to innovative manufacturing technology, EasyPIC v8 provides a fluid and immersive working experience, allowing access anywhere and under any
circumstances at any time. Each part of the EasyPIC v8 development board contains the components necessary for the most efficient operation of the same board. In addition to the advanced integrated CODEGRIP programmer/debugger module, which offers many valuable programming/debugging options and seamless integration with the Mikroe software environment, the board also includes a clean and regulated power supply module for the development board. It can use a wide range of external power sources, including a battery, an external 12V power supply, and a power source via the USB Type-C (USB-C) connector.
Communication options such as USB-UART, USB DEVICE, and CAN are also included, including the well-established mikroBUS™ standard, two display options (graphical and character-based LCD), and several different DIP sockets. These sockets cover a wide range of 8-bit PIC MCUs, from the smallest PIC MCU devices with only eight up to forty pins. EasyPIC v8 is an integral part of the Mikroe ecosystem for rapid development. Natively supported by Mikroe software tools, it covers many aspects of prototyping and development thanks to a considerable number of different Click boards™ (over a thousand boards), the number of which is growing every day.
Microcontroller Overview
MCU Card / MCU
Architecture
PIC
MCU Memory (KB)
128
Silicon Vendor
Microchip
Pin count
40
RAM (Bytes)
3728
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Schematic
Step by step
Project assembly
Track your results in real time
Application Output via UART Mode
1. Once the code example is loaded, pressing the "FLASH" button initiates the build process, and programs it on the created setup.
2. After the programming is completed, click on the Tools icon in the upper-right panel, and select the UART Terminal.
3. After opening the UART Terminal tab, first check the baud rate setting in the Options menu (default is 115200). If this parameter is correct, activate the terminal by clicking the "CONNECT" button.
4. Now terminal status changes from Disconnected to Connected in green, and the data is displayed in the Received data field.
Software Support
Library Description
This library contains API for MIC 2 Click driver.
Key functions:
mic2_set_potentiometer
- This function set the value of digital potentiometermic2_read_an_pin_value
- This function reads results of AD conversion of the AN pinmic2_read_an_pin_voltage
- This function reads results of AD conversion of the AN pin and converts them to proportional voltage level.
Open Source
Code example
This example can be found in NECTO Studio. Feel free to download the code, or you can copy the code below.
/*!
* \file
* \brief Mic2 Click example
*
* # Description
* This range is suited for audio and/or speech applications.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes the driver and logger and sets the digital potentiometer.
*
* ## Application Task
* Reads the AN pin voltage and displays the results on the USB UART every 100ms.
*
* \author MikroE Team
*
*/
#include "board.h"
#include "log.h"
#include "mic2.h"
static mic2_t mic2;
static log_t logger;
void application_init ( void )
{
log_cfg_t log_cfg;
mic2_cfg_t cfg;
/**
* Logger initialization.
* Default baud rate: 115200
* Default log level: LOG_LEVEL_DEBUG
* @note If USB_UART_RX and USB_UART_TX
* are defined as HAL_PIN_NC, you will
* need to define them manually for log to work.
* See @b LOG_MAP_USB_UART macro definition for detailed explanation.
*/
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
mic2_cfg_setup( &cfg );
MIC2_MAP_MIKROBUS( cfg, MIKROBUS_1 );
mic2_init( &mic2, &cfg );
mic2_set_potentiometer( &mic2, 35 );
log_info( &logger, " Application Task " );
}
void application_task ( void )
{
float voltage = 0;
if ( MIC2_OK == mic2_read_an_pin_voltage ( &mic2, &voltage ) )
{
log_printf( &logger, " AN Voltage : %.3f[V]\r\n\n", voltage );
Delay_ms ( 100 );
}
}
int main ( void )
{
/* Do not remove this line or clock might not be set correctly. */
#ifdef PREINIT_SUPPORTED
preinit();
#endif
application_init( );
for ( ; ; )
{
application_task( );
}
return 0;
}
// ------------------------------------------------------------------------ END