30 min

Upgrade your data presentation with SMA-B500LE and STM32F437ZG

Data insights, one segment at a time!

BarGraph 3 Click with UNI-DS v8

Published Sep 12, 2023

Click board™

BarGraph 3 Click

Development board



NECTO Studio



Our 5-segment red bar graph display is designed to provide a straightforward and precise way to visualize data, making it ideal for various applications where simplicity and clarity are essential



Hardware Overview

How does it work?

BarGraph 3 Click is equipped with a five-segment LED bar graph display, notable for its strong and uniform illumination of the segments. When it comes to driving an array of LED segments, using so-called shift-register ICs is almost unavoidable. This Click board™ uses a single 74HC595 IC, a tri-state, serial-in, parallel-out, 8-bit shift-register with output latch, from Texas Instruments. It is used to drive the SMA-B500LE a monochrome (red) 5 segment bar graph array, from American Opto Plus LED corporation. The 74HC595 ICs is comprised of a D-type internal storage register, and a serial-to-parallel shift register, both 8 bits wide. Each of these registers has its own clock line, making it possible to clock in the desired data in, and then clock it out to the parallel output pins when needed. The SMA-B500LE bar graph LED array has 5 red LED segments. Each segment contains three LEDs, with their cathodes connected in a single point and routed out as the single common cathode pin. This results with a bar graph display that has only six pins, even though it uses 15 LED elements in total. Similarly, all the anodes of the LED segments are routed to a single pin, which is connected to the drain of the P channel MOSFET, while its source is connected to the VCC. Driving the gate of the MOSFET using the PWM pin of the mikroBUS™ allows dimming of the LED bar graph display, by changing the pulse

width of the applied PWM signal. The Click board™ communicates with the host MCU over the SPI interface, routed to the mikroBUS™ MOSI and SCK pins, labeled as SDI and SCK on this Click board™, respectively. Five bits of information are pushed through the serial data input pin (DS) of the 74HC595 IC, routed to the SDI pin. The construction of the SPI interface is such that it operates with 8-bit long words, so the whole data word needs to be clocked in before it is latched on the output. However, the values of the bits that correspond to the non-connected pins of the 74HC595 IC will be disregarded. The Output Enable pin (#OE) is routed to the AN pin of the mikroBUS™, and it is labeled as OE. If this pin is at the HIGH logic level, the outputs Q0 to Q7S of the 74HC595 IC will be set at HIGH-Z (high impedance mode) meaning that they will become disconnected. Regardless of the logic state on other pins, the outputs will not change from this state, until #OE is brought down to a LOW logic level. Memory content and the logic states at the output pins will be unaffected, meaning that the OE can be used to turn the segments of the bar graph on or off without affecting their states (like a simple SPST switch in series with the LED segment of the bar graph). After the data word has been clocked in, the master SPI clock should be stopped, and the CS pin should be driven

to a HIGH logic level. The CS pin of the mikroBUS™ is routed to the STCP pin of the 74HC595 IC. A rising edge on the STCP input pin of the 74HC595 IC will latch the data from the internal storage register to the output pins, changing the states of its parallel output pins (Q0 to Q7). If a specific bit in the internal storage is 0, the state on the appropriate pin of the 74HC595 IC will become LOW. With their anodes connected to the positive voltage level already (provided that the P-type MOSFET is open), the segment will be lit. This means that the logical 0 lights up a segment, while 1 turns it off. The #MR pin is used to clear the data in the internal storage register of the 74HC595 IC. The LOW logic level on this pin will clear the content of this storage register, but it will not turn off the outputs which are already activated. The #MR pin is routed to the RST pin of the mikroBUS™ and it is pulled to a HIGH logic level by the onboard resistor. This Click board™ can operate with either 3.3V or 5V logic voltage levels selected via the VCC SEL jumper. This way, both 3.3V and 5V capable MCUs can use the communication lines properly. Also, this Click board™ comes equipped with a library containing easy-to-use functions and an example code that can be used as a reference for further development.

BarGraph 3 Click top side image
BarGraph 3 Click bottom side image

Features overview

Development board

UNI-DS v8 is a development board specially designed for the needs of rapid development of embedded applications. It supports a wide range of microcontrollers, such as different STM32, Kinetis, TIVA, CEC, MSP, PIC, dsPIC, PIC32, and AVR MCUs regardless of their number of pins, and a broad set of unique functions, such as the first-ever embedded debugger/programmer over WiFi. The development board is well organized and designed so that the end-user has all the necessary elements, such as switches, buttons, indicators, connectors, and others, in one place. Thanks to innovative manufacturing technology, UNI-DS v8 provides a fluid and immersive working experience, allowing access anywhere and under any

circumstances at any time. Each part of the UNI-DS v8 development board contains the components necessary for the most efficient operation of the same board. An advanced integrated CODEGRIP programmer/debugger module offers many valuable programming/debugging options, including support for JTAG, SWD, and SWO Trace (Single Wire Output)), and seamless integration with the Mikroe software environment. Besides, it also includes a clean and regulated power supply module for the development board. It can use a wide range of external power sources, including a battery, an external 12V power supply, and a power source via the USB Type-C (USB-C) connector. Communication options such as USB-UART, USB

HOST/DEVICE, CAN (on the MCU card, if supported), and Ethernet is also included. In addition, it also has the well-established mikroBUS™ standard, a standardized socket for the MCU card (SiBRAIN standard), and two display options for the TFT board line of products and character-based LCD. UNI-DS v8 is an integral part of the Mikroe ecosystem for rapid development. Natively supported by Mikroe software tools, it covers many aspects of prototyping and development thanks to a considerable number of different Click boards™ (over a thousand boards), the number of which is growing every day.

UNI-DS v8 horizontal image

Microcontroller Overview

MCU Card / MCU



8th Generation


ARM Cortex-M4

MCU Memory (KB)


Silicon Vendor


Pin count


RAM (Bytes)


Used MCU Pins

mikroBUS™ mapper

Output Enable
Data Clear
SPI Chip Select
SPI Clock
Power Supply
PWM Dimming Control
Power Supply

Take a closer look


BarGraph 3 Click Schematic schematic

Step by step

Project assembly

Fusion for PIC v8 front image hardware assembly

Start by selecting your development board and Click board™. Begin with the UNI-DS v8 as your development board.

Fusion for PIC v8 front image hardware assembly
Buck 22 Click front image hardware assembly
SiBRAIN for PIC32MZ1024EFK144 front image hardware assembly
v8 SiBRAIN MB 1 - upright/background hardware assembly
Necto image step 2 hardware assembly
Necto image step 3 hardware assembly
Necto image step 4 hardware assembly
NECTO Compiler Selection Step Image hardware assembly
NECTO Output Selection Step Image hardware assembly
Necto image step 6 hardware assembly
Necto image step 7 hardware assembly
Necto image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Necto PreFlash Image hardware assembly

Track your results in real time

Application Output

After pressing the "FLASH" button on the left-side panel, it is necessary to open the UART terminal to display the achieved results. By clicking on the Tools icon in the right-hand panel, multiple different functions are displayed, among which is the UART Terminal. Click on the offered "UART Terminal" icon.

UART Application Output Step 1

Once the UART terminal is opened, the window takes on a new form. At the top of the tab are two buttons, one for adjusting the parameters of the UART terminal and the other for connecting the UART terminal. The tab's lower part is reserved for displaying the achieved results. Before connecting, the terminal has a Disconnected status, indicating that the terminal is not yet active. Before connecting, it is necessary to check the set parameters of the UART terminal. Click on the "OPTIONS" button.

UART Application Output Step 2

In the newly opened UART Terminal Options field, we check if the terminal settings are correct, such as the set port and the Baud rate of UART communication. If the data is not displayed properly, it is possible that the Baud rate value is not set correctly and needs to be adjusted to 115200. If all the parameters are set correctly, click on "CONFIGURE".

UART Application Output Step 3

The next step is to click on the "CONNECT" button, after which the terminal status changes from Disconnected to Connected in green, and the data is displayed in the Received data field.

UART Application Output Step 4

Software Support

Library Description

This library contains API for BarGraph 3 Click driver.

Key functions:

  • bargraph3_display - This function control the display

  • bargraph3_set_pwm - This function set PWM

  • bargraph3_enable - Functions for enable the chip.

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 
 * \brief BarGraph3 Click example
 * # Description
 * This application used to create various types of VU meters, 
 * status indicators, different types of counters and similar devices.
 * The demo application is composed of two sections :
 * ## Application Init 
 * Initialization driver init, enable device and set PWM
 * ## Application Task  
 * Counter passes through the loop and logs the value of the 
 * counter on the bargraph display.
 * \author MikroE Team
// ------------------------------------------------------------------- INCLUDES

#include "board.h"
#include "log.h"
#include "bargraph3.h"

// ------------------------------------------------------------------ VARIABLES

static bargraph3_t bargraph3;
static log_t logger;

void application_init ( void )
    log_cfg_t log_cfg;
    bargraph3_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.

    bargraph3_cfg_setup( &cfg );
    bargraph3_init( &bargraph3, &cfg );
    bargraph3_enable( &bargraph3, BARGRAPH3_DEVICE_ENABLE );
    bargraph3_set_pwm( &bargraph3, BARGRAPH3_DEVICE_ENABLE );
    Delay_ms( 500 );

void application_task ( void )
   uint8_t bargraph_cnt;
    for ( bargraph_cnt = 0; bargraph_cnt <= 5; bargraph_cnt++ )
        bargraph3_display( &bargraph3, BARGRAPH3_INCREASE_LED,  
                           bargraph_cnt );
        Delay_ms( 1000 );

void main ( void )
    application_init( );

    for ( ; ; )
        application_task( );

// ------------------------------------------------------------------------ END

Additional Support