Provide complete electrical isolation, ensuring your sensitive signals remain unaffected by external interference.
A
A
Hardware Overview
How does it work?
Opto 3 Click is based on two pairs of normally opened, high-quality solid-state relays labeled as TLP241A, from Toshiba Semiconductor. The TLP241A is an optically isolated solid-state relay (SSR), featuring an integrated IR LED and two output MOSFETs. The output stage does not have any electrical contact with the input stage; it is activated by infrared light, produced by an integrated IR LED. This allows reinforced galvanic isolation between the input and the output stage. The output stage can sustain up to 40V while OFF. When activated, due to a very low RDSON of the integrated MOSFETs, it can conduct up to 2A of current. The TLP241A are able to effectively replace traditionally used mechanical relays, bringing up the full set of inherited benefits: virtually unlimited number of cycles since there are no moving parts that would wear off, no bouncing effect on the output contacts, high resistance to mechanical shock and environmental influence, low current required for the activation, constant resistance since no carbon and rust can build up on contacts, there is no sparking or electric arc forming while operated, compact size, higher isolation voltage, and so on. However, unlike optocouplers (similar devices which are designed for much lower currents and voltages), SSRs are not designed
to be used as signal line isolators. SSR typically has a slow signal propagation time. Still, it can be used for various communication protocols which use lower data rates, including UART/RS232, 1-Wire, and similar. One pair of SSRs is driven by the host MCU. This pair can be used to activate an external circuit, utilizing the full potential of the TLP241A SSR. One or two SSRs can be used as relays, allowing the host MCU to control heavier loads such as DC motors, some other electrical circuit which operates on higher potential, LED strips, LED arrays, and more. A HIGH logic level on mikroBUS™ pins AN or RST labeled as OU1 and OU2 respectively, will activate the integrated IR LED. It will turn ON the MOSFETs in the SSR, allowing the current to flow through an external circuit. Two red LEDs, labeled as OUT1 and OUT 2, are connected to each of the MCU output pins. These LEDs provide visual feedback about the SSR state: if ON, the respective SSR is in a conductive state. SSR outputs are routed to two screw terminals labeled as OUT1 and OUT2, allowing an external circuit to be securely connected. The other pair of SSRs is used to provide optical isolation for external signals, offering protection for sensitive MCU pins that way. While the SSR is not activated, PWM and INT pins of the mikroBUS™
labeled as IN1 and IN2 respectively, are pulled to a HIGH logic level by a resistor. A signal on the input terminal will activate the respective SSR, pulling the IN1 (IN2) pin to a LOW logic level. Since galvanically isolated, the signal at the input terminal can be at a different potential than the host MCU, preventing any stray currents to flow between two GNDs. This will also protect the host MCU from the electrostatic discharge (ESD) that might occur. It is important to connect the input signal correctly. Therefore, two input terminals have their ports clearly labeled with + and - signs. A Schottky diode in series provides some protection to the input IR LED, however, care should be taken not to exceed specifications from the TLP241A datasheet. Pull-up resistors on the input side SSRs are connected to the power supply from mikroBUS™, providing a HIGH logic level while the SSR is not active. The voltage of the power supply directly determines the voltage level that will be applied to IN1 and IN2 pins in this case. Therefore, an SMD jumper labeled as VCC SEL is provided on the Click board™, allowing the user to select the logic voltage level between 3.3V and 5V, depending on the used MCU and its capabilities.
Features overview
Development board
Nucleo-64 with STM32F091RC MCU offers a cost-effective and adaptable platform for developers to explore new ideas and prototype their designs. This board harnesses the versatility of the STM32 microcontroller, enabling users to select the optimal balance of performance and power consumption for their projects. It accommodates the STM32 microcontroller in the LQFP64 package and includes essential components such as a user LED, which doubles as an ARDUINO® signal, alongside user and reset push-buttons, and a 32.768kHz crystal oscillator for precise timing operations. Designed with expansion and flexibility in mind, the Nucleo-64 board features an ARDUINO® Uno V3 expansion connector and ST morpho extension pin
headers, granting complete access to the STM32's I/Os for comprehensive project integration. Power supply options are adaptable, supporting ST-LINK USB VBUS or external power sources, ensuring adaptability in various development environments. The board also has an on-board ST-LINK debugger/programmer with USB re-enumeration capability, simplifying the programming and debugging process. Moreover, the board is designed to simplify advanced development with its external SMPS for efficient Vcore logic supply, support for USB Device full speed or USB SNK/UFP full speed, and built-in cryptographic features, enhancing both the power efficiency and security of projects. Additional connectivity is
provided through dedicated connectors for external SMPS experimentation, a USB connector for the ST-LINK, and a MIPI® debug connector, expanding the possibilities for hardware interfacing and experimentation. Developers will find extensive support through comprehensive free software libraries and examples, courtesy of the STM32Cube MCU Package. This, combined with compatibility with a wide array of Integrated Development Environments (IDEs), including IAR Embedded Workbench®, MDK-ARM, and STM32CubeIDE, ensures a smooth and efficient development experience, allowing users to fully leverage the capabilities of the Nucleo-64 board in their projects.
Microcontroller Overview
MCU Card / MCU
Architecture
ARM Cortex-M0
MCU Memory (KB)
256
Silicon Vendor
STMicroelectronics
Pin count
64
RAM (Bytes)
32768
You complete me!
Accessories
Click Shield for Nucleo-64 comes equipped with two proprietary mikroBUS™ sockets, allowing all the Click board™ devices to be interfaced with the STM32 Nucleo-64 board with no effort. This way, Mikroe allows its users to add any functionality from our ever-growing range of Click boards™, such as WiFi, GSM, GPS, Bluetooth, ZigBee, environmental sensors, LEDs, speech recognition, motor control, movement sensors, and many more. More than 1537 Click boards™, which can be stacked and integrated, are at your disposal. The STM32 Nucleo-64 boards are based on the microcontrollers in 64-pin packages, a 32-bit MCU with an ARM Cortex M4 processor operating at 84MHz, 512Kb Flash, and 96KB SRAM, divided into two regions where the top section represents the ST-Link/V2 debugger and programmer while the bottom section of the board is an actual development board. These boards are controlled and powered conveniently through a USB connection to program and efficiently debug the Nucleo-64 board out of the box, with an additional USB cable connected to the USB mini port on the board. Most of the STM32 microcontroller pins are brought to the IO pins on the left and right edge of the board, which are then connected to two existing mikroBUS™ sockets. This Click Shield also has several switches that perform functions such as selecting the logic levels of analog signals on mikroBUS™ sockets and selecting logic voltage levels of the mikroBUS™ sockets themselves. Besides, the user is offered the possibility of using any Click board™ with the help of existing bidirectional level-shifting voltage translators, regardless of whether the Click board™ operates at a 3.3V or 5V logic voltage level. Once you connect the STM32 Nucleo-64 board with our Click Shield for Nucleo-64, you can access hundreds of Click boards™, working with 3.3V or 5V logic voltage levels.
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Click board™ Schematic
Step by step
Project assembly
Track your results in real time
Application Output
This Click board can be interfaced and monitored in two ways:
Application Output
- Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
UART Terminal
- Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.
Software Support
Library Description
This library contains API for Opto 3 Click driver.
Key functions:
opto3_get_in1
- This function gets input 1 pin stateopto3_get_in2
- This function gets input 2 pin stateopto3_set_out1
- This function sets output 1 pin state.
Open Source
Code example
The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.
/*!
* \file
* \brief Opto 3 Click example
*
* # Description
* Opto 3 click to be used in applications that require reinforced galvanic
* isolation for both their input and output stages.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes GPIO interface.
*
* ## Application Task
* Reads the input pins state and sets their respective output pins to the same logic state.
* The output pins state will be displayed on the USB UART where you can track their changes.
*
* \author MikroE Team
*
*/
// ------------------------------------------------------------------- INCLUDES
#include "board.h"
#include "log.h"
#include "opto3.h"
// ------------------------------------------------------------------ VARIABLES
static opto3_t opto3;
static log_t logger;
// ------------------------------------------------------ APPLICATION FUNCTIONS
void application_init ( void )
{
log_cfg_t log_cfg;
opto3_cfg_t cfg;
/**
* Logger initialization.
* Default baud rate: 115200
* Default log level: LOG_LEVEL_DEBUG
* @note If USB_UART_RX and USB_UART_TX
* are defined as HAL_PIN_NC, you will
* need to define them manually for log to work.
* See @b LOG_MAP_USB_UART macro definition for detailed explanation.
*/
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
opto3_cfg_setup( &cfg );
OPTO3_MAP_MIKROBUS( cfg, MIKROBUS_1 );
opto3_init( &opto3, &cfg );
log_info( &logger, " Application Task " );
}
void application_task ( void )
{
static uint8_t out1_state = 0;
static uint8_t out2_state = 0;
uint8_t in1_state = 0;
uint8_t in2_state = 0;
in1_state = opto3_get_in1( &opto3 );
in2_state = opto3_get_in2( &opto3 );
if ( in1_state != out1_state )
{
out1_state = in1_state;
opto3_set_out1( &opto3, out1_state );
log_printf( &logger, " OUT1 state: %u\r\n", ( uint16_t ) out1_state );
}
if ( in2_state != out2_state )
{
out2_state = in2_state;
opto3_set_out2( &opto3, out2_state );
log_printf( &logger, " OUT2 state: %u\r\n", ( uint16_t ) out2_state );
}
}
int main ( void )
{
/* Do not remove this line or clock might not be set correctly. */
#ifdef PREINIT_SUPPORTED
preinit();
#endif
application_init( );
for ( ; ; )
{
application_task( );
}
return 0;
}
// ------------------------------------------------------------------------ END
/*!
* \file
* \brief Opto 3 Click example
*
* # Description
* Opto 3 click to be used in applications that require reinforced galvanic
* isolation for both their input and output stages.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes GPIO interface.
*
* ## Application Task
* Reads the input pins state and sets their respective output pins to the same logic state.
* The output pins state will be displayed on the USB UART where you can track their changes.
*
* \author MikroE Team
*
*/
// ------------------------------------------------------------------- INCLUDES
#include "board.h"
#include "log.h"
#include "opto3.h"
// ------------------------------------------------------------------ VARIABLES
static opto3_t opto3;
static log_t logger;
// ------------------------------------------------------ APPLICATION FUNCTIONS
void application_init ( void )
{
log_cfg_t log_cfg;
opto3_cfg_t cfg;
/**
* Logger initialization.
* Default baud rate: 115200
* Default log level: LOG_LEVEL_DEBUG
* @note If USB_UART_RX and USB_UART_TX
* are defined as HAL_PIN_NC, you will
* need to define them manually for log to work.
* See @b LOG_MAP_USB_UART macro definition for detailed explanation.
*/
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
opto3_cfg_setup( &cfg );
OPTO3_MAP_MIKROBUS( cfg, MIKROBUS_1 );
opto3_init( &opto3, &cfg );
log_info( &logger, " Application Task " );
}
void application_task ( void )
{
static uint8_t out1_state = 0;
static uint8_t out2_state = 0;
uint8_t in1_state = 0;
uint8_t in2_state = 0;
in1_state = opto3_get_in1( &opto3 );
in2_state = opto3_get_in2( &opto3 );
if ( in1_state != out1_state )
{
out1_state = in1_state;
opto3_set_out1( &opto3, out1_state );
log_printf( &logger, " OUT1 state: %u\r\n", ( uint16_t ) out1_state );
}
if ( in2_state != out2_state )
{
out2_state = in2_state;
opto3_set_out2( &opto3, out2_state );
log_printf( &logger, " OUT2 state: %u\r\n", ( uint16_t ) out2_state );
}
}
int main ( void )
{
/* Do not remove this line or clock might not be set correctly. */
#ifdef PREINIT_SUPPORTED
preinit();
#endif
application_init( );
for ( ; ; )
{
application_task( );
}
return 0;
}
// ------------------------------------------------------------------------ END