Read a wide range of 1D and 2D barcode types, including QR codes, data matrices, and linear barcodes
A
A
Hardware Overview
How does it work?
Barcode 3 Click is based on the LV30, an area image engine from Rakinda designed for efficient barcode scanning. This component features a laser aiming system and an LED illumination system, meeting the safety standards of IEC 62471:2006 for LEDs and IEC 60825:2014 for lasers. The LV30 incorporates a CMOS image sensor and a sophisticated image recognition system-on-chip, enabling quick and accurate decoding of barcodes on various media, including paper and magnetic cards. This versatile engine can be easily integrated into OEM equipment such as handheld, portable, or stationary barcode scanners, making it an excellent choice for upgrading from 1D to 2D barcode scanning solutions. The LV30 is equipped with a red LED (wavelength: 625±10nm) for additional lighting, allowing for barcode scanning even in complete darkness, with the option to turn the illumination ON or OFF. It also includes a laser aimer to help users accurately position the barcode within the scanning area, enhancing efficiency. The aiming pattern can be toggled ON or OFF, with the recommendation to keep it on during scanning for
better accuracy. When using the Barcode 3 Click for scanning through a specific surface, it is crucial to ensure proper protection against dust and other contaminants that could degrade the performance of the LV30 module. The surface through which scanning occurs must be made of clear material; it is recommended to use cell-cast plastics or optical glass such as PMMA, ADC, or chemically tempered glass. While the LV30 performs well under ambient light, exposure to high-frequency pulsed light can negatively impact its performance. The illumination LED in the LV30 is bright but designed to be safe under normal usage conditions. Nevertheless, users should avoid direct eye exposure to the beam. The LV30's physical interface includes a 12-pin FPC connector, which allows the Barcode 3 Click to connect to the host MCU using a 12-wire 0.5mm pitch FPC cable. This setup supports communication via the UART interface (the TX and RX pins of the mikroBUS™ socket) or the USB interface. Since the LV30 operates at 3.3V, while using the USB interface, the necessary power supply is provided through an additional
low-dropout (LDO) regulator, the TLV700, which converts the USB voltage level to the required 3.3V for the LV30. The Barcode 3 Click also features several additional components to enhance its functionality. An onboard buzzer provides audible feedback to the user, indicating power-on and successful read statuses. A blue READ OK LED indicator signals a successful barcode read. The READ button, when pressed and released, activates scanning until a barcode is decoded or the decode session timeout expires. This function can also be achieved through the TRG pin on the mikroBUS™ socket. Additionally, the board includes a RESET button for resetting the LV30, which can also be operated via the RST pin on the mikroBUS™ socket. 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. Also, it comes equipped with a library containing functions and an example code that can be used as a reference for further development.
Features overview
Development board
Nucleo-64 with STM32F030R8 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)
64
Silicon Vendor
STMicroelectronics
Pin count
64
RAM (Bytes)
8192
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
Schematic
Step by step
Project assembly
Track your results in real time
Application Output via Debug Mode
1. Once the code example is loaded, pressing the "DEBUG" button initiates the build process, programs it on the created setup, and enters Debug mode.
2. After the programming is completed, a header with buttons for various actions within the IDE becomes visible. Clicking the green "PLAY" button starts reading the results achieved with the Click board™. The achieved results are displayed in the Application Output tab.
Software Support
Library Description
This library contains API for Barcode 3 Click driver.
Key functions:
barcode3_generic_read
- This function reads a desired number of data bytes by using UART serial interface.barcode3_start_scanning
- This function starts the barcode scanning by setting the TRG pin to low logic state.barcode3_stop_scanning
- This function stops the barcode scanning by setting the TRG pin to high logic state.
Open Source
Code example
This example can be found in NECTO Studio. Feel free to download the code, or you can copy the code below.
/*!
* @file main.c
* @brief Barcode 3 Click Example.
*
* # Description
* This example demonstrates the use of the Barcode 3 click board by scanning
* and displaying the content of a barcode or QR Code.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes the driver, stops scanning and resets the barcode device.
*
* ## Application Task
* Triggers scanning and waits up to 3 seconds for the barcode to be detected.
* If a barcode or QR Code is detected, it displays its content on the USB UART.
*
* ## Additional Function
* - static void barcode3_clear_app_buf ( void )
* - static void barcode3_log_app_buf ( void )
* - static err_t barcode3_process ( barcode3_t *ctx )
*
* @author Stefan Filipovic
*
*/
#include "board.h"
#include "log.h"
#include "barcode3.h"
// Application buffer size
#define APP_BUFFER_SIZE 500
#define PROCESS_BUFFER_SIZE 200
static barcode3_t barcode3;
static log_t logger;
static uint8_t app_buf[ APP_BUFFER_SIZE ] = { 0 };
static int32_t app_buf_len = 0;
/**
* @brief Barcode 3 clearing application buffer.
* @details This function clears memory of application buffer and reset its length.
* @note None.
*/
static void barcode3_clear_app_buf ( void );
/**
* @brief Barcode 3 log application buffer.
* @details This function logs data from application buffer to USB UART.
* @note None.
*/
static void barcode3_log_app_buf ( void );
/**
* @brief Barcode 3 data reading function.
* @details This function reads data from device and concatenates data to application buffer.
* @param[in] ctx : Click context object.
* See #barcode3_t object definition for detailed explanation.
* @return @li @c 0 - Read some data.
* @li @c -1 - Nothing is read.
* See #err_t definition for detailed explanation.
* @note None.
*/
static err_t barcode3_process ( barcode3_t *ctx );
void application_init ( void )
{
log_cfg_t log_cfg; /**< Logger config object. */
barcode3_cfg_t barcode3_cfg; /**< Click config object. */
/**
* 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.
barcode3_cfg_setup( &barcode3_cfg );
BARCODE3_MAP_MIKROBUS( barcode3_cfg, MIKROBUS_1 );
if ( UART_ERROR == barcode3_init( &barcode3, &barcode3_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
barcode3_stop_scanning ( &barcode3 );
barcode3_reset_device ( &barcode3 );
log_info( &logger, " Application Task " );
}
void application_task ( void )
{
uint16_t timeout = 0;
log_printf( &logger, "\r\n------- SCAN START ------\r\n" );
barcode3_start_scanning ( &barcode3 );
while ( ++timeout < 3000 )
{
if ( BARCODE3_OK == barcode3_process( &barcode3 ) )
{
barcode3_log_app_buf( );
barcode3_clear_app_buf( );
Delay_10ms ( );
while ( BARCODE3_OK == barcode3_process( &barcode3 ) )
{
barcode3_log_app_buf( );
barcode3_clear_app_buf( );
Delay_10ms ( );
}
break;
}
Delay_1ms ( );
}
log_printf( &logger, "------- SCAN STOP -------\r\n" );
barcode3_stop_scanning ( &barcode3 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
}
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;
}
static void barcode3_clear_app_buf ( void )
{
memset( app_buf, 0, app_buf_len );
app_buf_len = 0;
}
static void barcode3_log_app_buf ( void )
{
for ( int32_t buf_cnt = 0; buf_cnt < app_buf_len; buf_cnt++ )
{
log_printf( &logger, "%c", app_buf[ buf_cnt ] );
}
}
static err_t barcode3_process ( barcode3_t *ctx )
{
uint8_t rx_buf[ PROCESS_BUFFER_SIZE ] = { 0 };
int32_t overflow_bytes = 0;
int32_t rx_cnt = 0;
int32_t rx_size = barcode3_generic_read( ctx, rx_buf, PROCESS_BUFFER_SIZE );
if ( ( rx_size > 0 ) && ( rx_size <= APP_BUFFER_SIZE ) )
{
if ( ( app_buf_len + rx_size ) > APP_BUFFER_SIZE )
{
overflow_bytes = ( app_buf_len + rx_size ) - APP_BUFFER_SIZE;
app_buf_len = APP_BUFFER_SIZE - rx_size;
memmove ( app_buf, &app_buf[ overflow_bytes ], app_buf_len );
memset ( &app_buf[ app_buf_len ], 0, overflow_bytes );
}
for ( rx_cnt = 0; rx_cnt < rx_size; rx_cnt++ )
{
if ( rx_buf[ rx_cnt ] )
{
app_buf[ app_buf_len++ ] = rx_buf[ rx_cnt ];
}
}
return BARCODE3_OK;
}
return BARCODE3_ERROR;
}
// ------------------------------------------------------------------------ END