Opto Encoder 3 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 3 click. This Click board™ features an optical sensor in a tall dome design, which allows more physical space, even for a vertical signal encoding. 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.
How does it work?
The optical sensor used on the Opto Encoder 3 click is the TCUT1800X01, a tall dome quad channel transmissive optical sensor with phototransistor outputs from Vishay. This sensor is equipped with one infrared LED with the wavelength of 950nm, and four phototransistors. These phototransistors are positioned behind small slits on the sensor, on the opposite side of the LED. They form four separate channels. When the transistors get illuminated by the LED, they become conductive. The collectors of these transistors are connected to the same pin, while their emitters are routed to separate output pins of the TCUT1800X01 – E1, E2 E3, and E4. This allows the activity on each channel to be detected by the host MCU separately.
Since the signals of these output channels are not enough to drive pins on a host MCU, the Click board™ features two additional buffer IC – the SN74LVC125A, from texas instruments. E1, E2, E3, and E4 pins are routed to the input pins od the buffer IC. These pins are pulled to a LOW logic level by the pull-down resistors, to avoid floating. The output pins of the buffer are routed to the mikroBUS™ AN, RST, INT, and PWM pins respectively.
Signal encoding itself is done by the host MCU. Having four optical sensing channels, Opto Encoder 3 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 phototransistors only through these slits. 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. By adding two more sensors, the resolution and reliability of the position reading are further increased.
Provided Click board™ library offers easy to use functions that can be used to get the encoder position. The provided example application demonstrates the usage of these functions and can be used for further custom development.
Specifications
Type
Optical
Applications
Automotive optical sensors, accurate position sensor for encoder, sensor for motion, speed, and direction, etc.
On-board modules
TCUT1800X01 Tall Dome Dual Channel Transmissive Optical Sensor with Phototransistor Outputs
Key Features
The Opto Encoder 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
Feature
No ClickID
Compatibility
mikroBUS™
Click board size
M (42.9 x 25.4 mm)
Input Voltage
3.3V,5V
Pinout diagram
This table shows how the pinout on Opto Encoder 3 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 |
Opto Encoder 3 click electrical specifications
Description | Min | Typ | Max | Unit |
---|---|---|---|---|
IR LED forward voltage | 1 | 1.2 | 1.4 | V |
Switching Rise Time (5V) | – | 9 | 150 | µs |
Switching Fall Time (5V) | – | 16 | 150 | µs |
Software Support
We provide a library for the Opto Encoder 3 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
The library includes functions to enable or disable reading pins, reading every single pin or reading all at once. The user has a function to count number of swipes, counter for direction swipes and function for reseting these counters.
Key functions:
void optoencoder3_Enabler(uint8_t active)
– Enables or disables readingvoid optoencoder3_readAllPins(T_OPTOENCODER3_PINS *pins)
– Reads state of all pinsuint8_t optoencoder3_Counter()
– Counts number of swipesint8_t optoencoder3_DirectionCounter()
– Counts number of swipe directionvoid optoencoder3_ResetCounters()
– Resets all counters
Examples description
The application is composed of three sections :
- System Initialization – Initialzes gpio
- Application Initialization – Initialization driver init
- Application Task – Waits for valid user input and executes functions based on set of valid commands
- Commands :’1′ – first demo ‘2’ – second demo ‘r’ – reset counters
void applicationTask() { uint8_t dataReady_; char receivedData_; dataReady_ = UART_Rdy_Ptr( ); if (dataReady_ != 0) { receivedData_ = UART_Rd_Ptr( ); switch (receivedData_) { case '1' : { taskNum = 1; break; } case '2' : { taskNum = 2; break; } case 'r' : { optoencoder3_ResetCounters(); taskNum = 0; break; } } } if (taskNum == 1) { _drawPinsStatus(); } else if (taskNum == 2) { _viewCounters(); } else if (taskNum == 0) { _infoWrite(); } }
Additional Functions :
- void _drawPinsStatus() – Draws state of all pins
- void _viewCounters() – Shows counters value
- void _infoWrite() – Write commands info
The full application code, and ready to use projects can be found on our LibStock page.
Other mikroE Libraries used in the example:
- 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.
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.