How does it work?
IR 2 Click as its foundation uses the TSOP98638, a miniaturized sensor for receiving the modulated signal of QEE113 IR emitting diode from Vishay Semiconductors. All Vishay IR receivers have the same circuit architecture consisting of a photodetector, pre-amplifier, and automatic gain control (ACG) to surpass ambient noise with signals transmitted to it with a wavelength of 940nm. This Click board™ represents a compact and easy solution for adding infrared (IR) remote control to your design suitable for IR repeater applications.
The infrared signal generates an equivalent photocurrent in the integrated photo PIN diode. The DC part of the signal is blocked in the bias circuit, and the AC part is passed to a trans impedance amplifier, followed by an automatic gain-control amplifier and an integrated bandpass filter. A comparator, an integrator, and a Schmitt Trigger stage perform the final signal conditioning. The blocks “Automatic Gain Control” and “Automatic Threshold Control” dynamically control the operating points and the threshold levels required to suppress noise from disturbance sources. The digital output signal has an active-low polarity and consists of an incoming optical burst envelope signal without the carrier frequency.
IR 2 Click communicates with the target MCU via selectable GPIO lines. The selection can be made by positioning SMD jumpers labeled as COMM SEL to an appropriate position. The default configuration of this Click board™ allows transmission via PWM pin of the mikroBUS™ socket and reception via INT pin, while the other configuration allows communication using TX and RX pins.
This Click board™ can be operated only with a 3.3V logic voltage level. The board must perform appropriate logic voltage level conversion before using MCUs with different logic levels. However, the Click board™ comes equipped with a library containing functions and an example code that can be used, as a reference, for further development.
Specifications
Type
Optical
Applications
Can be used for IR repeater applications
On-board modules
TSOP98638 – miniaturized sensor for receiving the modulated signal of IR emitting diode from Vishay Semiconductors
Key Features
Photo detector and preamplifier in one package, AGC to suppress ambient noise, improved shielding againts electric field disturbance, high sensitivity, long receiving range, flexibility, low power consumption, and more
Interface
GPIO,PWM,UART
Feature
No ClickID
Compatibility
mikroBUS™
Click board size
S (28.6 x 25.4 mm)
Input Voltage
3.3V
Pinout diagram
This table shows how the pinout on IR 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-JP2 | COMM SEL | Right | Communication Interface Selection UART/GPIO: Left position UART, Right position GPIO |
IR 2 Click electrical specifications
Description | Min | Typ | Max | Unit |
---|---|---|---|---|
Supply Voltage | – | 3.3 | – | V |
IR Wavelenght | – | 940 | – | nm |
Carrier Frequency | – | 38 | – | kHz |
Operating Temperature Range | -25 | +25 | +85 | °C |
Software Support
We provide a library for the IR 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 IR 2 Click driver.
Key functions
-
ir2_get_out_pin
This function returns the OUT pin logic state. -
ir2_nec_send_data
This function sends an address and data bytes using NEC protocol. -
ir2_nec_read_data
This function reads an address and data bytes by using NEC protocol.
Example Description
This example demonstrates the use of an IR 2 click board by showing the communication between the two click boards configured as a receiver and transmitter using the NEC protocol.
void application_task ( void )
{
#ifdef IR2_TRANSMITTER_MODE
log_printf( &logger, " Sending message." );
for ( uint8_t cnt = 0; cnt < sizeof ( IR2_DATA ); cnt++ )
{
ir2_nec_send_data ( &ir2, IR2_ADDRESS, IR2_DATA[ cnt ] );
log_printf( &logger, "." );
}
log_printf( &logger, "rn Message has been sent! rn" );
log_printf( &logger, "- - - - - - - - - - - - rn" );
Delay_ms( 500 );
#else
uint8_t address;
uint8_t rx_data;
if ( IR2_OK == ir2_nec_read_data ( &ir2, &address, &rx_data ) )
{
log_printf( &logger, "Address: 0x%.2X, Data: %crn", ( uint16_t ) address, rx_data );
}
#endif
}
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.IR2
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 MikroElektronika compilers.
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.