Beginner
10 min
0

Experience the future of visual excellence with WS2812 and TM4C1299KCZAD

Pixels come alive: 16 RGB elements in harmony!

4X4 RGB Click with Fusion for ARM v8

Published Sep 04, 2023

Click board™

4X4 RGB Click

Development board

Fusion for ARM v8

Compiler

NECTO Studio

MCU

TM4C1299KCZAD

Our 4x4 display matrix featuring 16 'intelligent' RGB elements opens the door to a world of dynamic visual experiences, making it the ideal choice for projects requiring vivid and customizable displays

A

A

Hardware Overview

How does it work?

4x4 RGB Click is based on the WS2812, intelligent LED elements with an integrated control from Worldsemi. Thanks to the high brightness of the LED elements and their color consistency, this Click board™ can be used in various decorative applications, simple pattern displays, and color number displays, and due to the cascade nature of the Click board™ itself, they can even be used for building larger screens and displays. These LED elements are composed of red, green, and blue LED segments, forming an RGB LED cell, with their intensities controlled by the integrated logic section. This integrated control section allows separate 8-bit control of each RGB segment, forming a 24-bit color palette and allowing

16,777,216 different colors to be displayed. The power supply for the LED elements is provided by the MCP1826, a low-voltage, low-quiescent current LDO regulator from Microchip, which can provide current up to 1A. While the logic voltage can be selected between 3.3V and 5V rails, the LED power supply is derived from the 5V mikroBUS™ power rail. It is reduced to 3.5V by the LDO and distributed to the LED supply inputs of the WS2812 elements. 4x4 RGB Click uses a single line to communicate with the host MCU. The onboard IN switch between the IN1 and IN2 pins can select the communication line. The OUT pin of the mikroBUS™ allows cascading of multiple 4x4 RGB Click devices. It simply routes the data line back to

the mikroBUS™, allowing it to be re-used for the next 4x4 RGB click, and so on. The length of the whole chain is limited only by the communication speed required to scan through all the LED devices in order to maintain a reasonable refresh speed. This Click board™ can operate with either 3.3V or 5V logic voltage levels selected via the IO LEVEL 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.

4X4 RGB Click hardware overview image

Features overview

Development board

Fusion for ARM 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 ARM® Cortex®-M based 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, Fusion for ARM v8 provides a fluid and immersive working experience, allowing access anywhere and under any

circumstances at any time. Each part of the Fusion for ARM 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. Fusion for ARM 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.

Fusion for ARM v8 horizontal image

Microcontroller Overview

MCU Card / MCU

default

Type

8th Generation

Architecture

ARM Cortex-M4

MCU Memory (KB)

512

Silicon Vendor

Texas Instruments

Pin count

212

RAM (Bytes)

262144

Used MCU Pins

mikroBUS™ mapper

NC
NC
AN
Data Input 1
PB6
RST
Data Input 2
PE7
CS
NC
NC
SCK
NC
NC
MISO
NC
NC
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
Cascading Signal
PD0
PWM
NC
NC
INT
NC
NC
TX
NC
NC
RX
NC
NC
SCL
NC
NC
SDA
Power Supply
5V
5V
Ground
GND
GND
1

Take a closer look

Schematic

4X4 RGB 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 Fusion for ARM 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 4x4 RGB Click driver.

Key functions:

  • c4x4rgb_set_diode - This function allows to set color of one diode

  • c4x4rgb_fill_screen - This function sets every diode on selected color

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 4x4 RGB Click example
 * 
 * # Description
 * This application is used for powering 4x4 RGB LED matrices.
 *
 * The demo application is composed of two sections :
 * 
 * ## Application Init 
 * Initialization driver enables - GPIO.
 * 
 * ## Application Task  
 * This is an example which demonstrates the use of 4x4 RGB Click board.
 * This simple example shows all ten numbers in different colors on 4x4 RGB click.
 * The 4x4 RGB click carries a matrix of 16 RGB LEDs and an MCP1826 low dropout regulator.
 * These LEDs actually consist of three single colored LEDs ( Red, Green and Blue ) in a single package.
 * Various colors can be reproduced by mixing the intensity of each LED.
 * 
 * *note:* 
 * **Diodes layout:**
 * ----------------------
 * | 13 | 14 | 15 | 16  |
 * |--------------------|
 * |  9 | 10 | 11 | 12  |
 * |--------------------|
 * |  5 |  6 |  7 |  8  |
 * |--------------------|
 * |  1 |  2 |  3 |  4  |
 * ----------------------
 * 
 * Timeing sequence chart:
 *          -----------|     T0L
 *              T0H    |______________
 * Logic 0: 
 *          T0H ~ 200-500ns
 *          T0L ~ 650-1050ns
 * 
 *          -----------|     T1L
 *              T1H    |______________
 * Logic 1: 
 *          T1H ~ 550-850ns
 *          T1L ~ 450-750ns
 * 
 * \author MikroE Team
 *
 */
#include "board.h"
#include "c4x4rgb.h"

#ifdef __MIKROC_AI_FOR_ARM__

#ifdef __STM32__/*< STM32F407ZG*/

#define D_S    2
#define D_L    4

#define DELAY_SHORT \
    Delay_Cyc( D_S );
    
#define DELAY_LONG \
    Delay_Cyc( D_L );
    
#elif __KINETIS__/*< MK64FN1M0VDC12*/
    
#define DELAY_SHORT 
    
#define DELAY_LONG \
    asm nop
    
#endif

#elif __MIKROC_AI_FOR_PIC32__ /*< PIC32MZ2048EFH144 */

#define D_L    4
    
#define DELAY_SHORT \
    asm nop
    
#define DELAY_LONG \
    Delay_Cyc( D_L );
#endif
    
/*< You need to define long and short delay */
#if !defined(DELAY_SHORT) && !defined(DELAY_LONG)

#define DELAY_SHORT     
#define DELAY_LONG 

#endif
    

#define SNAKE_DELAY     50
#define MASH_DELAY      100

static c4x4rgb_t c4x4rgb;

static void c4x4rgb_logic_zero ( void );

static void c4x4rgb_logic_one ( void );

static void c4x4rgb_color_mash ( void );

static void c4x4rgb_snake ( uint32_t snake_color );

static void c4x4rgb_snake_return ( uint32_t snake_color );

void application_init ( void )
{
    c4x4rgb_cfg_t cfg;

    //  Click initialization.
    c4x4rgb_cfg_setup( &cfg, &c4x4rgb_logic_zero, &c4x4rgb_logic_one, C4X4RGB_CTRL_PIN_IN1 );
    C4X4RGB_MAP_MIKROBUS( cfg, MIKROBUS_1 );
    c4x4rgb_init( &c4x4rgb, &cfg );
    
    c4x4rgb_fill_screen( &c4x4rgb, C4X4RGB_COLOR_WHITE, 5 );
    Delay_ms( 100 ); 
    
    
    c4x4rgb_color_mash();
    Delay_ms( 2000 );
}

void application_task ( void )
{
    c4x4rgb_snake( C4X4RGB_COLOR_BLUE );
    Delay_ms( 500 ); 
    
    c4x4rgb_snake_return( C4X4RGB_COLOR_LIGHT_BLUE );
    Delay_ms( 1000 ); 
    
    c4x4rgb_snake(  C4X4RGB_COLOR_GREEN );
    Delay_ms( 500 ); 
    
    c4x4rgb_snake_return( C4X4RGB_COLOR_YELLOW );
    Delay_ms( 1000 ); 
    
    c4x4rgb_snake( C4X4RGB_COLOR_RED );
    Delay_ms( 500 ); 
    
    c4x4rgb_snake_return( C4X4RGB_COLOR_PURPLE );
    Delay_ms( 1000 ); 
    
    c4x4rgb_fill_screen( &c4x4rgb, C4X4RGB_COLOR_WHITE, 50 );
    Delay_ms( 100 ); 
}

void main ( void )
{
    application_init( );

    for ( ; ; )
    {
        application_task( );
    }
}


static void c4x4rgb_logic_zero ( void )
{
    digital_out_high( &c4x4rgb.ctrl_pin );
    DELAY_SHORT;
    digital_out_low( &c4x4rgb.ctrl_pin );
    DELAY_LONG;
}

static void c4x4rgb_logic_one ( void )
{
    digital_out_high( &c4x4rgb.ctrl_pin );
    DELAY_LONG;
    digital_out_low( &c4x4rgb.ctrl_pin );
    DELAY_SHORT;
}

static void c4x4rgb_color_mash ( void )
{
    c4x4rgb_set_diode( &c4x4rgb, 1, C4X4RGB_COLOR_BLUE );
    Delay_ms( MASH_DELAY );
    c4x4rgb_set_diode( &c4x4rgb, 2, C4X4RGB_COLOR_YELLOW );
    Delay_ms( MASH_DELAY );
    c4x4rgb_set_diode( &c4x4rgb, 3, C4X4RGB_COLOR_LIGHT_BLUE );
    Delay_ms( MASH_DELAY );
    c4x4rgb_set_diode( &c4x4rgb, 4, C4X4RGB_COLOR_WHITE );
    Delay_ms( MASH_DELAY );
    c4x4rgb_set_diode( &c4x4rgb, 5, C4X4RGB_COLOR_PURPLE );
    Delay_ms( MASH_DELAY );
    c4x4rgb_set_diode( &c4x4rgb, 6, C4X4RGB_COLOR_GREEN );
    Delay_ms( MASH_DELAY );
    c4x4rgb_set_diode( &c4x4rgb, 7, C4X4RGB_COLOR_RED );
    Delay_ms( MASH_DELAY );
    c4x4rgb_set_diode( &c4x4rgb, 8, C4X4RGB_COLOR_BLUE );
    Delay_ms( MASH_DELAY );
    c4x4rgb_set_diode( &c4x4rgb, 9, C4X4RGB_COLOR_YELLOW );
    Delay_ms( MASH_DELAY );
    c4x4rgb_set_diode( &c4x4rgb, 10, C4X4RGB_COLOR_LIGHT_BLUE );
    Delay_ms( MASH_DELAY );
    c4x4rgb_set_diode( &c4x4rgb, 11, C4X4RGB_COLOR_WHITE );
    Delay_ms( MASH_DELAY );
    c4x4rgb_set_diode( &c4x4rgb, 12, C4X4RGB_COLOR_PURPLE );
    Delay_ms( MASH_DELAY );
    c4x4rgb_set_diode( &c4x4rgb, 13, C4X4RGB_COLOR_GREEN );
    Delay_ms( MASH_DELAY );
    c4x4rgb_set_diode( &c4x4rgb, 14, C4X4RGB_COLOR_RED );
    Delay_ms( MASH_DELAY );
    c4x4rgb_set_diode( &c4x4rgb, 15, C4X4RGB_COLOR_BLUE );
    Delay_ms( MASH_DELAY );
    c4x4rgb_set_diode( &c4x4rgb, 16, C4X4RGB_COLOR_RED );
    Delay_ms( MASH_DELAY );
}

static void c4x4rgb_snake ( uint32_t snake_color )
{
    c4x4rgb_set_diode( &c4x4rgb, 4, snake_color );
    Delay_ms( SNAKE_DELAY );
    c4x4rgb_set_diode( &c4x4rgb, 3, snake_color );
    Delay_ms( SNAKE_DELAY );
    c4x4rgb_set_diode( &c4x4rgb, 2, snake_color );
    Delay_ms( SNAKE_DELAY );
    c4x4rgb_set_diode( &c4x4rgb, 1, snake_color );
    Delay_ms( SNAKE_DELAY );
    c4x4rgb_set_diode( &c4x4rgb, 5, snake_color );
    Delay_ms( SNAKE_DELAY );
    c4x4rgb_set_diode( &c4x4rgb, 9, snake_color );
    Delay_ms( SNAKE_DELAY );
    c4x4rgb_set_diode( &c4x4rgb, 13, snake_color );
    Delay_ms( SNAKE_DELAY );
    c4x4rgb_set_diode( &c4x4rgb, 14, snake_color );
    Delay_ms( SNAKE_DELAY );
    c4x4rgb_set_diode( &c4x4rgb, 15, snake_color );
    Delay_ms( SNAKE_DELAY );
    c4x4rgb_set_diode( &c4x4rgb, 16, snake_color );
    Delay_ms( SNAKE_DELAY );
    c4x4rgb_set_diode( &c4x4rgb, 12, snake_color );
    Delay_ms( SNAKE_DELAY );
    c4x4rgb_set_diode( &c4x4rgb, 8, snake_color );
    Delay_ms( SNAKE_DELAY );
    c4x4rgb_set_diode( &c4x4rgb, 7, snake_color );
    Delay_ms( SNAKE_DELAY );
    c4x4rgb_set_diode( &c4x4rgb, 6, snake_color );
    Delay_ms( SNAKE_DELAY );
    c4x4rgb_set_diode( &c4x4rgb, 10, snake_color );
    Delay_ms( SNAKE_DELAY );
    c4x4rgb_set_diode( &c4x4rgb, 11, snake_color );
}

static void c4x4rgb_snake_return ( uint32_t snake_color )
{
    c4x4rgb_set_diode( &c4x4rgb, 11, snake_color );
    Delay_ms( SNAKE_DELAY );
    c4x4rgb_set_diode( &c4x4rgb, 10, snake_color );
    Delay_ms( SNAKE_DELAY );
    c4x4rgb_set_diode( &c4x4rgb, 6, snake_color );
    Delay_ms( SNAKE_DELAY );
    c4x4rgb_set_diode( &c4x4rgb, 7, snake_color );
    Delay_ms( SNAKE_DELAY );
    c4x4rgb_set_diode( &c4x4rgb, 8, snake_color );
    Delay_ms( SNAKE_DELAY );
    c4x4rgb_set_diode( &c4x4rgb, 12, snake_color );
    Delay_ms( SNAKE_DELAY );
    c4x4rgb_set_diode( &c4x4rgb, 16, snake_color );
    Delay_ms( SNAKE_DELAY );
    c4x4rgb_set_diode( &c4x4rgb, 15, snake_color );
    Delay_ms( SNAKE_DELAY );
    c4x4rgb_set_diode( &c4x4rgb, 14, snake_color );
    Delay_ms( SNAKE_DELAY );
    c4x4rgb_set_diode( &c4x4rgb, 13, snake_color );
    Delay_ms( SNAKE_DELAY );
    c4x4rgb_set_diode( &c4x4rgb, 9, snake_color );
    Delay_ms( SNAKE_DELAY );
    c4x4rgb_set_diode( &c4x4rgb, 5, snake_color );
    Delay_ms( SNAKE_DELAY );
    c4x4rgb_set_diode( &c4x4rgb, 1, snake_color );
    Delay_ms( SNAKE_DELAY );
    c4x4rgb_set_diode( &c4x4rgb, 2, snake_color );
    Delay_ms( SNAKE_DELAY );
    c4x4rgb_set_diode( &c4x4rgb, 3, snake_color );
    Delay_ms( SNAKE_DELAY );
    c4x4rgb_set_diode( &c4x4rgb, 4, snake_color );
    Delay_ms( SNAKE_DELAY );
}

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

Additional Support

Resources