Opto 2 click is an optical isolator used to provide an optical galvanic isolation of sensitive lines. The used optoisolation elements require very low input current to be driven, down to 1.3mA (min). The speed of the internal optocoupler elements of the Opto click 2 allows it to work with the signals up to 20MHz. The Opto click 2 can be used to provide a galvanic isolation of the MCU pins, allowing driving by external components, while protecting it from surges up to 5kV on the driver side.
Opto click 2 can be used in applications where the input side is under risk of high voltage surges in a noisy environment. Since it provides a galvanic isolation, the electrical potential of the input side circuit does not have to be the same as the electrical potential of the MCU circuit. Featuring the galvanic isolation, Opto click 2 blocks so-called stray currents, that may appear as a result of differences in ground potential, or the electromagnetic induction. Opto 2 click provides means to drive inputs of the connected MCU with a wide range of external applications and signals.
How does it work?
Opto 2 click uses four TLP2770, 20-Mbps low-power optocouplers, from Toshiba. These are fast optocouplers, with their output stages shielded against EMI, allowing them to work on higher speeds, providing common-mode transient immunity of ±20 kV/µs. The internal LED elements are driven with 4mA for 5V operation or 2.6mA for 3.3V operation. The input stages are also equipped with (Schottky) diodes, which prevents inverse polarization of the LED elements and thus, a permanent damage that might occur in that case.
The working principle of the optocouplers is quite simple: A photo-emitting element - usually a LED, is encapsulated inside the die along with the photo-sensitive element, which can be a photo-sensitive transistor or a photo-diode. LEDs and photo-sensing elements are galvanically isolated, making the input and output electrical networks completely independent of each other. When the LED is biased, it emits light which in return causes the current to flow through the photo-sensitive element. In these particular optocouplers, the output stage is additionally conditioned by a Schmitt trigger and it drives the output transistors which form a totem pole output stage. Having a totem pole output configuration allows the output stage to both sink and source current.
The optocoupler inputs - the anodes (labeled as A) and cathodes (labeled as C) of the internal optocoupler LEDs, are routed to the screw terminals, which allow connection the external electrical circuit, used to trigger an event on the isolated MCU. The electrical potential between the anode and the cathode input of each optocoupler element should stay within the range between 3.3V and 5V.
The optocoupler outputs are routed to the mikroBUS™. The mikroBUS™ pins INT, CS, RST, and AN, are routed to the optocoupler outputs 1, 2, 3, and 4, respectively, and are labeled as IN1, IN2, IN3, and IN4. As already mentioned, the output stages are conditioned with the Schmitt trigger circuit, reducing the input noise sensitivity and false triggering. The Faraday shield protects the output stages against EMI and provides common-mode transient immunity of ±20 kV/µs. Although these mikroBUS™ pins are labeled as IN1 to IN4, they are actually outputs from the optocouplers, and it is highly recommended to use them as the INPUT pins on the host MCU.
The Click board™ is equipped with an SMD jumper labeled as LOGIC, which allows selection of the voltage, applied to the optocoupler output stage. This voltage effectively determines the logic voltage level for the MCU pins. It can be selected between 3.3V and 5V, allowing this Click board™ to be interfaced with both 3.3V and 5V MCUs.
The provided library offers functions that simplify and speed up the application development. The included example application demonstrates their use. This application can be used as a reference for custom projects.
Specifications
Type |
Optocoupler |
Applications |
Used for isolation MCU input pins from the influence of the external circuitry, for interfacing an MCU with the electric circuit that works on a different potential |
On-board modules |
TLP2770, a 20-Mbps low-power optocoupler, from Toshiba. |
Key Features |
High isolation voltage of the galvanic barrier - up to 5kV, Faraday shield on the output stage, providing common-mode transient immunity of ±20 kV/µs, screw terminals for easy connection, low current consumption, high input sensitivity. |
Interface |
GPIO |
Input Voltage |
3.3V or 5V |
Click board size |
M (42.9 x 25.4 mm) |
Pinout diagram
This table shows how the pinout on Opto 2 click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
Notes | Pin | | Pin | Notes |
---|
Optocoupler 4 OUT |
IN4 |
1 |
AN |
PWM |
16 |
NC |
|
Optocoupler 3 OUT |
IN3 |
2 |
RST |
INT |
15 |
IN1 |
Optocoupler 1 OUT |
Optocoupler 2 OUT |
IN2 |
3 |
CS |
RX |
14 |
NC |
|
|
NC |
4 |
SCK |
TX |
13 |
NC |
|
|
NC |
5 |
MISO |
SCL |
12 |
NC |
|
|
NC |
6 |
MOSI |
SDA |
11 |
NC |
|
Power supply |
+3.3V |
7 |
3.3V |
5V |
10 |
+5V |
Power supply |
Ground |
GND |
8 |
GND |
GND |
9 |
GND |
Ground |
Onboard settings and indicators
Label | Name | Default | Description |
---|
LD1 |
PWR |
- |
Power LED indicator |
JP1 |
LOGIC |
Left |
Logic voltage level selection: left position 3.3V, right position 5V |
Opto 2 click electrical characteristics
Description | Min | Typ | Max | Unit |
---|
Input forward current (IF) |
- |
- |
8 |
mA |
Peak transient input forward current (IFPT) |
- |
- |
1 |
A |
Output current (IO) |
- |
- |
10 |
mA |
Software support
We provide a library for Opto 2 click on our Libstock page, as well as a demo application (example), developed using MikroElektronika compilers. The demo application can run on all the main MikroElektronika development boards.
Library Description
The library performs the check procedure for the desired outputs (IN1 - IN4). For more details check the documentation.
Key functions:
uint8_t opto2_checkOut1( void )
- The function checks the state of the OUT1 pin.
Examples Description
The demo application is composed of three sections:
- System Initialization - Initializes peripherals and pins.
- Application Initialization - Initializes GPIO driver and selects the outputs (OUT1 - OUT4) which state be checked.
- Application Task - (code snippet) - Performs the check procedure for selected outputs and logs the states from the outputs on USB UART. Repeats the check procedure every 2 seconds.
void applicationTask()
{
tmp = 1;
for (cnt = 0; cnt < 4; cnt++)
{
switch (selOutput & tmp)
{
case 0x01 :
{
checkOutput = opto2_checkOut1();
if (checkOutput == 0)
{
mikrobus_logWrite( "OUT1 is low", _LOG_LINE );
}
else
{
mikrobus_logWrite( "OUT1 is high", _LOG_LINE );
}
break;
}
case 0x02 :
{
checkOutput = opto2_checkOut2();
if (checkOutput == 0)
{
mikrobus_logWrite( "OUT2 is low", _LOG_LINE );
}
else
{
mikrobus_logWrite( "OUT2 is high", _LOG_LINE );
}
break;
}
case 0x04 :
{
checkOutput = opto2_checkOut3();
if (checkOutput == 0)
{
mikrobus_logWrite( "OUT3 is low", _LOG_LINE );
}
else
{
mikrobus_logWrite( "OUT3 is high", _LOG_LINE );
}
break;
}
case 0x08 :
{
checkOutput = opto2_checkOut4();
if (checkOutput == 0)
{
mikrobus_logWrite( "OUT4 is low", _LOG_LINE );
}
else
{
mikrobus_logWrite( "OUT4 is high", _LOG_LINE );
}
break;
}
default :
{
break;
}
}
tmp <<= 1;
}
mikrobus_logWrite( "", _LOG_LINE );
Delay_ms( 2000 );
}
- void opto2_setLogger( uint8_t selOut1, uint8_t selOut2, uint8_t selOut3, uint8_t selOut4 ) - Determines the outputs that be checked and logged on USB UART terminal. If selOutx is 1, the corresponding output will be included in check procedure.vAnd if selOutx is 0, that output will not be included in check procedure and will not be logged on UART.
The full application code, and ready to use projects can be found on our Libstock page.
mikroE Libraries used in the example:
Additional notes and information
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 by 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.