Skip to product information
1 of 4


Opto Encoder 2 click

Opto Encoder 2 click


Regular price Rs. 3,139.00
Regular price Sale price Rs. 3,139.00
Sale Sold out
Tax included.

Out of stock

Opto Encoder 2 click is a linear incremental optical sensor/encoder click which can be used for the movement or rotation encoding. Encoders of this type are widely used for many applications, which involve precise detection of the position, speed, or rotational angle of an object. Rotary encoders are often used for various types of controllers on many different devices. Whether it be a rotary encoder knob controller or an angle encoder on a motor shaft, the principle is the same - it includes an optical sensor, just like the one found on Opto Encoder 2 click.

Opto Encoder 2 click is supported by a mikroSDK compliant library, which includes functions that simplify software development. This Click board™ comes as a fully tested product, ready to be used on a system equipped with the mikroBUS™ socket.

This Click board™ features a very small optical encoder employing reflective technology for motion control purposes. The encoder houses an LED light source and a photo-detecting circuitry in a single package. It can be used as an optical sensor in automotive applications, motion, speed, and direction sensor, for precise motor shaft positioning applications, knob encoder applications, and similar applications, where dual channel optical sensing can be utilized.


The optical sensor used on the Opto Encoder 2 click is the AEDR-8300, reflective Surface Mount Optical Encoder from Avago Technologies. This sensor combines an emitter and a detector in a single surface mount leadless package. the AEDR-8300 consists of three major components: a light emitting diode (LED) light source, a detector IC consisting photodiodes and lens to focus light beam from the emitter as well as light falling on the detector. The operation of the encoder is based on the principle of optics where the detector photodiodes sense the absence and presence of light. In this case, the rotary/linear motion of an object being monitored is converted to equivalent light pattern via the use of codewheel/codestrip.

Click BoardsSensorsOpto Encoder 2 Inner

Opto Encoder 2 click offers options of either single channel or two-channel quadrature digital outputs. Being TTL compatible, the outputs of the AEDR-8300 series can be interfaced directly with MCU. Hence the Opto Encoder 2 click provides great design-in flexibility and easy integration into existing systems. A and B pins are routed to the routed to the mikroBUS™ PWM and INT pins, thus providing the quadrature digital signal.

Signal encoding itself is done by the host MCU. Having two optical sensing channels, Opto Encoder 2 click has the ability of both speed and direction encoding. The most common usage is encoding of the step motor position: a cylinder with slits is physically mounted above the sensor so that the LED can illuminate the photodiodes only when light hits the reflective surface of the codewheel. By rotating this cylinder, the light beam will be blocked periodically. The single sensor output will be a pulse train, while the cylinder is rotating. Having two photo sensors physically distanced by a small amount, allows the pulse signal of the first sensor to be either delayed or expedited with respect to the pulse on the second sensor, depending on the rotational direction.

Since the sensors recomended operating voltage is 5V, the Opto Encoder 2 click uses the 5V rail for power supply. The other pins it utilizes are the, before mentioned, Interrupt and PWM pins on mikroBUS™ socket. This click also has a Power LED indicator.

This Click Board™ is designed to be operated only with 5V logic level. A proper logic voltage level conversion should be performed before the Click board™ is used with MCUs with logic levels of 3.3V.


Type Optical
Applications Automotive optical sensors, accurate position sensor for encoder, sensor for motion, speed, and direction, etc.
On-board modules Reflective Surface Mount Optical Encoder from Avago Technologies
Key Features The Opto Encoder 2 click features a precise detection of the position, speed, or rotational angle of an object. It is able to detect the direction of the movement since it features two photo-sensing elements.
Interface GPIO
Click board size S (28.6 x 25.4 mm)
Input Voltage 5V


This table shows how the pinout on Opto Encoder 2 click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).

Notes Pin Mikrobus logo.png Pin Notes
NC 1 AN PWM 16 B Output B
NC 2 RST INT 15 A Output A
NC 3 CS RX 14 NC
NC 7 +3.3V 5V 10 +5V Power Supply
Ground GND 8 GND GND 9 GND Ground


Description Min Typ Max Unit
Supply Voltage 4.5 5 5.5 V
LED Current 13 15 18 µs
Count Frequency - - 30 kHZ
Resolution - 75 - LPI


Label Name Default Description
LD1 PWR - Power LED Indicator


We provide a library for the Opto Encoder 2 click on our LibStock page, as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.

Library Description

Library contains functions for getting INT(Channel A) and PWM(Channel B) pin states Library contains function for incrementing/decrementing encoder position Library contains function for reseting encoder position counter to 0(zero) Library contains function for getting current encoder position

Key functions:

  • int32_t optoencoder2_getPosition(void) - returns current encoder position.
  • void optoencoder2_zeroCounter(void) - resets encoder counter to 0(zero).
  • uint8_t optoencoder2_isr( uint8_t n_cycles ) - checks for rising edge on Channel A (INT pin), within specified number of cycles (n_cycles), and increments or decrements encoder position.

Examples Description

The application is composed of three sections :

  • System Initialization - Initializes LOG, initializes PWM and INT pins.
  • Application Initialization - Initializes GPIO driver and resets encoder counter to 0(zero) .
  • Application Task - If encoder is moving - increments or decrements encoder position on every rising edge on Channel A (INT pin) and logs encoder position .
void applicationTask( )
stop_flag = optoencoder2_isr(100);
encoderPosition = optoencoder2_getPosition( );
if (stop_flag == 0)
LongToStr( encoderPosition, text );
mikrobus_logWrite( "> pos : ", _LOG_TEXT );
mikrobus_logWrite( text, _LOG_LINE );

The full application code, and ready to use projects can be found on our LibStock page.

Other mikroE Libraries used in the example:

  • UART
  • Conversions

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.


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.

View full details

Featured collection

The crazyflie is a versatile platform that is designed to engage people in learning about robotics and quadcopters.
1 of 25