How does it work?
Comparator Click is based on the LM2903, a dual differential comparator from ON Semiconductor. These two independent voltage comparators allow the comparison of voltages near ground potential and are compatible with all forms of logic. The LM2903 has a low current drain with low input bias current, low input offset current, and low offset voltage with ±1mV. Two potentiometers have high shafts allowing easy usage, but they can also be used with a flat screwdriver. The potentiometers can be used in correlation with the VR (voltage reference) screw terminals to set the threshold values for comparison with the obtained values over the IN (input) screw terminals with the common ground (GND) screw terminals.
Comparator Click communicates with the host microcontroller with each output using its own interrupt pin on the mikroBUS™ socket labeled O1 and O2. In addition, every independent output has its own red HIGH and green LOW LEDs for visual presentation, labeled LO1, HI1, LO2, and HI2.
This Click board™ can operate with either 3.3V or 5V logic voltage levels selected via the LOGIC SEL jumper. This way, both 3.3V and 5V capable MCUs can use the communication lines properly. However, the 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.
Specifications
Type
ADC
Applications
Can be used for A/D converters, wide range VCOs, MOS clock generator, and more
On-board modules
LM2903 – dual differential comparator from ON Semiconductor
Key Features
Dual differential comparator, two pairs of input screw terminals, two voltage reference threshold potentiometers, working with single or dual power supply, allow the comparison of voltages near ground potential, low power consumption, and more
Interface
GPIO
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 Comparator 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 |
---|---|---|---|
– | PWR | – | Power LED Indicator |
– | LO1 | – | Low Output 1 LED Indicator |
– | HI1 | – | High Output 1 LED Indicator |
– | LO2 | – | Low Output 2 LED Indicator |
– | HI2 | – | High Output 2 LED Indicator |
J1 | LOGIC SEL | Left | Logic Level Voltage Selection 3V3/5V: Left position 3V3, Right position 5V |
Comparator Click electrical specifications
Description | Min | Typ | Max | Unit |
---|---|---|---|---|
Supply Voltage | 3.3 | – | 5 | V |
Single Power Supply | 2 | – | 36 | VDC |
Dual Power Supply | ±1 | – | ±18 | VDC |
Software Support
We provide a library for the Comparator Click as well as a demo application (example), developed using Mikroe compilers. The demo can run on all the main Mikroe development boards.
Package can be downloaded/installed directly from NECTO Studio Package Manager (recommended), downloaded from our LibStock™ or found on Mikroe github account.
Library Description
This library contains API for Comparator Click driver.
Key functions
-
This function check and return state of the o1 ( AN ) pin of Comparator Click Board.
-
This function check and return state of the o2 ( INT ) pin of Comparator Click Board.
Example Description
This is an example which demonstrates the usage of Comparator Click board.
void application_task ( void )
{
out_state_one = comparator_check_output_one( &comparator );
out_state_two = comparator_check_output_two( &comparator );
log_printf( &logger, " Output One: rn" );
if ( out_state_one )
{
log_printf( &logger, " High rn" );
}
else
{
log_printf( &logger, " Low rn" );
}
Delay_ms ( 500 );
log_printf( &logger, " Output Two: rn" );
if ( out_state_two )
{
log_printf( &logger, " High rn" );
}
else
{
log_printf( &logger, " Low rn" );
}
Delay_ms ( 500 );
log_printf( &logger, "--------------------------rn" );
Delay_ms ( 1000 );
}
The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager (recommended), downloaded from our LibStock™ or found on Mikroe github account.
Other Mikroe Libraries used in the example:
- MikroSDK.Board
- MikroSDK.Log
- Click.Comparator
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. UART terminal is available in all Mikroe compilers.
mikroSDK
This Click board™ is supported with mikroSDK – Mikroe 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.