Intermediate
30 min
0

Illuminate, animate, and inspire with WS2812 and PIC32MX664F064L

Pixels awaken!

10x10 RGB Click with UNI Clicker

Published Sep 06, 2023

Click board™

10x10 RGB Click

Development board

UNI Clicker

Compiler

NECTO Studio

MCU

PIC32MX664F064L

Our solution, featuring a 10x10 display matrix of 100 'intelligent' RGB elements, transforms your creative ideas into mesmerizing visuals, making it the ultimate choice for dynamic displays, animations, and interactive presentations

A

A

Hardware Overview

How does it work?

10x10 RGB Click is based on the WS2812, an intelligent control LED light source from Worldsemi. Its exterior adopts the latest MOLDING packaging technology, and the control circuit and RGB chips are integrated into a package of 2020 components. It's internal includes an intelligent digital port data latch and signal reshaping amplification drive circuit. It also includes a precision internal oscillator and a voltage-programmable constant current control part, ensuring consistent pixel point light color height. The data transfer protocol use single NZR communication mode. After the pixel power-on reset, the DIN port receive data from controller, the first pixel collect initial 24bit data then sent to the internal data latch, the other data which reshaping by the internal signal reshaping amplification circuit sent to the next cascade pixel through the DO port. After transmission for each

pixel, the signal to reduce 24bit. pixel adopt auto reshaping transmit technology, making the pixel cascade number is not limited the signal transmission, only depend on the speed of signal transmission. RESET time >280μs , it won't cause wrong reset while interruption, it supports the lower frequency and inexpensive MCU. Refresh Frequency updates to 2KHz, Low Frame Frequency and No Flicker appear in HD Video Camera, it improve excellent display effect. LED with low driving voltage, environmental protection and energy saving, high brightness, large scattering angle, good consistency, low power, long life and other advantages. The control chip integrated in LED above becoming more simple circuit, small volume, convenient installation. 10x10 RGB Click can be used in many applications, like full-color module, full color soft lights a lamp strip, LED decorative lighting, indoor/outdoor LED

irregular screen, game machine and amusement equipment, and more. The INT pin of the mikroBUS™, which is labeled as DO on this Click board™, allows cascading of multiple 10x10 RGB click devices. It simply routes the data line back to the mikroBUS™, allowing it to be re-used for the next 10x10 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 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.

10x10 RGB Click top side image
10x10 RGB Click bottom side image

Features overview

Development board

UNI Clicker is a compact development board designed as a complete solution that brings the flexibility of add-on Click boards™ to your favorite microcontroller, making it a perfect starter kit for implementing your ideas. It supports a wide range of microcontrollers, such as different ARM, PIC32, dsPIC, PIC, and AVR from various vendors like Microchip, ST, NXP, and TI (regardless of their number of pins), four mikroBUS™ sockets for Click board™ connectivity, a USB connector, LED indicators, buttons, a debugger/programmer connector, and two 26-pin headers for interfacing with external electronics. Thanks to innovative manufacturing technology, it allows you to build

gadgets with unique functionalities and features quickly. Each part of the UNI Clicker development kit contains the components necessary for the most efficient operation of the same board. In addition to the possibility of choosing the UNI Clicker programming method, using a third-party programmer or CODEGRIP/mikroProg connected to onboard JTAG/SWD header, the UNI Clicker board also includes a clean and regulated power supply module for the development kit. It provides two ways of board-powering; through the USB Type-C (USB-C) connector, where onboard voltage regulators provide the appropriate voltage levels to each component on the board, or using a Li-Po/Li

Ion battery via an onboard battery connector. All communication methods that mikroBUS™ itself supports are on this board (plus USB HOST/DEVICE), including the well-established mikroBUS™ socket, a standardized socket for the MCU card (SiBRAIN standard), and several user-configurable buttons and LED indicators. UNI Clicker is an integral part of the Mikroe ecosystem, allowing you to create a new application in minutes. Natively supported by Mikroe software tools, it covers many aspects of prototyping thanks to a considerable number of different Click boards™ (over a thousand boards), the number of which is growing every day.

UNI clicker double image

Microcontroller Overview

MCU Card / MCU

default

Type

8th Generation

Architecture

PIC32

MCU Memory (KB)

64

Silicon Vendor

Microchip

Pin count

100

RAM (Bytes)

32768

Used MCU Pins

mikroBUS™ mapper

NC
NC
AN
NC
NC
RST
NC
NC
CS
NC
NC
SCK
NC
NC
MISO
NC
NC
MOSI
NC
NC
3.3V
Ground
GND
GND
Data Input
PD1
PWM
Data Output
PE8
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

10x10 RGB Click Schematic schematic

Step by step

Project assembly

UNI Clicker front image hardware assembly

Start by selecting your development board and Click board™. Begin with the UNI Clicker as your development board.

UNI Clicker front image hardware assembly
Thermo 28 Click front image hardware assembly
SiBRAIN for STM32F745VG front image hardware assembly
Prog-cut hardware assembly
UNI Clicker MB 1 - upright/with-background hardware assembly
Necto image step 2 hardware assembly
Necto image step 3 hardware assembly
Necto image step 4 hardware assembly
Necto image step 5 hardware assembly
Necto image step 6 hardware assembly
Necto image step 7 hardware assembly
Necto No Display image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Debug Image Necto Step hardware assembly

Track your results in real time

Application Output

After loading the code example, pressing the "DEBUG" button builds and programs it on the selected setup.

Application Output Step 1

After programming is completed, a header with buttons for various actions available in the IDE appears. By clicking the green "PLAY "button, we start reading the results achieved with Click board™.

Application Output Step 3

Upon completion of programming, the Application Output tab is automatically opened, where the achieved result can be read. In case of an inability to perform the Debug function, check if a proper connection between the MCU used by the setup and the CODEGRIP programmer has been established. A detailed explanation of the CODEGRIP-board connection can be found in the CODEGRIP User Manual. Please find it in the RESOURCES section.

Application Output Step 4

Software Support

Library Description

This library contains API for 10x10 RGB Click driver.

Key functions:

  • c10x10rgb_display_image - This function displays an image from the specified demo_image address

  • c10x10rgb_display_byte - This function displays the specified byte

  • c10x10rgb_display_string - This function displays the specified string.

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 10x10 RGB Click example
 * 
 * # Description
 * This example showcases how to initialize, configure and use the 10x10 RGB click moduel. The
 * click has a 10 by 10 RGB LED matrix which can be programmed to show different colors or even
 * images. LED elements that form the matrix communicate by a single line with the host MCU.
 *
 * The demo application is composed of two sections :
 * 
 * ## Application Init 
 * This function initializes and configures the click board.
 * 
 * ## Application Task  
 * This function first displays 3 chars { R, G, B }, the string "MIKROE", the company logo and
 * a rainbow in the end.
 * 
 * @note
 * Timing sequence chart:
 *          -----------|     T0L
 *              T0H    |______________
 * Logic 0: 
 *          T0H ~ 200-400ns
 *          T0L ~ 600-1000ns
 * 
 *          -----------|     T1L
 *              T1H    |______________
 * Logic 1: 
 *          T1H ~ 600-1000ns
 *          T1L ~ 600-1000ns
 * 
 * \author MikroE Team
 *
 */
// ------------------------------------------------------------------- INCLUDES

#include "board.h"
#include "c10x10rgb.h"

// Delay adjustment for specific systems.
#ifdef __MIKROC_AI__
    #ifdef STM32F407ZG
        /*< Adjusted for STM32F407ZG */
        #define DELAY_TOH Delay_Cyc( 3 );   // ~280ns
        #define DELAY_TOL Delay_Cyc( 7 );   // ~790ns
        #define DELAY_T1H Delay_Cyc( 12 );  // ~820ns
        #define DELAY_T1L Delay_Cyc( 8 );   // ~840ns
    #elif MK64FN1M0VDC12
        /*< Adjusted for MK64FN1M0VDC12 */
        #define DELAY_TOH \
                    asm nop; \
                    asm nop; \
                    asm nop; \
                    asm nop; \
                    asm nop; \
                    asm nop; \
                    asm nop; \
                    asm nop; \
                    asm nop; \
                    asm nop; \
                    asm nop; \
                    asm nop;                // ~280ns
        #define DELAY_TOL Delay_Cyc( 2 );   // ~880ns
        #define DELAY_T1H Delay_Cyc( 8 );   // ~800ns
        #define DELAY_T1L Delay_Cyc( 2 );   // ~800ns
    #elif TM4C129XNCZAD
        /*< Adjusted for TM4C129XNCZAD */
        #define DELAY_TOH                   // ~320ns
        #define DELAY_TOL asm nop;          // ~780ns
        #define DELAY_T1H Delay_Cyc( 6 );   // ~860ns
        #define DELAY_T1L                   // ~800ns
    #elif PIC32MX795F512L
        /*< Adjusted for PIC32MX795F512L */
        #define DELAY_TOH                   // ~300ns
        #define DELAY_TOL                   // ~940ns
        #define DELAY_T1H Delay_Cyc( 3 );   // ~780ns
        #define DELAY_T1L                   // ~940ns
    #else
        #error "Logic delays are not defined for the selected MCU"
    #endif
#elif __GNUC__ 
    #ifdef STM32F407ZG
        /*< Adjusted for STM32F407ZG */
        #define DELAY_TOH \
                    asm("nop"); \
                    asm("nop"); \
                    asm("nop"); \
                    asm("nop"); \
                    asm("nop"); \
                    asm("nop"); \
                    asm("nop"); \
                    asm("nop"); \
                    asm("nop"); \
                    asm("nop"); \
                    asm("nop"); \
                    asm("nop"); \
                    asm("nop"); \
                    asm("nop");             // ~300ns
        #define DELAY_TOL Delay_Cyc( 2 );   // ~840ns
        #define DELAY_T1H Delay_Cyc( 7 );   // ~810ns
        #define DELAY_T1L Delay_Cyc( 2 );   // ~830ns
    #elif MK64
        /*< Adjusted for MK64FN1M0VDC12 */
        #define DELAY_TOH \
                    asm("nop"); \
                    asm("nop"); \
                    asm("nop"); \
                    asm("nop"); \
                    asm("nop"); \
                    asm("nop");             // ~300ns
        #define DELAY_TOL  \
                    asm("nop"); \
                    asm("nop"); \
                    asm("nop"); \
                    asm("nop"); \
                    asm("nop"); \
                    asm("nop"); \
                    asm("nop"); \
                    asm("nop"); \
                    asm("nop"); \
                    asm("nop"); \
                    asm("nop"); \
                    asm("nop"); \
                    asm("nop"); \
                    asm("nop"); \
                    asm("nop"); \
                    asm("nop");             // ~720ns
        #define DELAY_T1H Delay_Cyc( 7 );   // ~780ns
        #define DELAY_T1L Delay_Cyc( 2 );   // ~900ns
    #elif TM4C129
        /*< Adjusted for TM4C129XNCZAD */
        #define DELAY_TOH                   // ~350ns
        #define DELAY_TOL                   // ~900ns
        #define DELAY_T1H Delay_Cyc( 2 );   // ~880ns
        #define DELAY_T1L                   // ~900ns
    #elif GD32VF103VBT6
        /*< Adjusted for GD32VF103VBT6 */
        #define DELAY_TOH \
                    asm("nop"); \
                    asm("nop"); \
                    asm("nop"); \
                    asm("nop");             // ~290ns
        #define DELAY_TOL \
                    asm("nop"); \
                    asm("nop"); \
                    asm("nop"); \
                    asm("nop"); \
                    asm("nop"); \
                    asm("nop"); \
                    asm("nop"); \
                    asm("nop");             // ~690ns
        #define DELAY_T1H Delay_Cyc( 2 );   // ~730ns
        #define DELAY_T1L \
                    asm("nop"); \
                    asm("nop"); \
                    asm("nop"); \
                    asm("nop"); \
                    asm("nop"); \
                    asm("nop"); \
                    asm("nop"); \
                    asm("nop"); \
                    asm("nop"); \
                    asm("nop"); \
                    asm("nop"); \
                    asm("nop");            // ~680ns
    #else
        #error "Logic delays are not defined for the selected MCU"
    #endif
#else
    #error "Logic delays are not defined for the selected toolchain"
#endif

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

static c10x10rgb_t c10x10rgb;

const uint32_t MIKROE_IMAGE[ 100 ] =
{
    0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,
    0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,
    0x000000,0x000000,0x181800,0x181800,0x181800,0x181800,0x181800,0x181800,0x181800,0x000000,
    0x000000,0x181800,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,
    0x000000,0x181800,0x181800,0x181800,0x181800,0x181800,0x181800,0x181800,0x181800,0x000000,
    0x000000,0x181800,0x181800,0x181800,0x181800,0x181800,0x181800,0x181800,0x181800,0x000000,
    0x000000,0x181800,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,
    0x000000,0x000000,0x181800,0x181800,0x181800,0x181800,0x181800,0x181800,0x181800,0x000000,
    0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,
    0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000
};

static c10x10rgb_byte_t scroll_data_obj[ 6 ] =
{
    { 'M', C10X10RGB_COLOR_OFF, C10X10RGB_COLOR_YELLOW_25, C10X10RGB_SCROLL_ROTATE_V },
    { 'I', C10X10RGB_COLOR_OFF, C10X10RGB_COLOR_YELLOW_25, C10X10RGB_SCROLL_ROTATE_V },
    { 'K', C10X10RGB_COLOR_OFF, C10X10RGB_COLOR_YELLOW_25, C10X10RGB_SCROLL_ROTATE_V },
    { 'R', C10X10RGB_COLOR_OFF, C10X10RGB_COLOR_YELLOW_25, C10X10RGB_SCROLL_ROTATE_V },
    { 'O', C10X10RGB_COLOR_OFF, C10X10RGB_COLOR_YELLOW_25, C10X10RGB_SCROLL_ROTATE_V },
    { 'E', C10X10RGB_COLOR_YELLOW_25, C10X10RGB_COLOR_OFF, C10X10RGB_SCROLL_ROTATE_V }
};

static uint16_t scroll_speed_ms = 100;
static uint8_t scroll_data_len = 6;

static c10x10rgb_byte_t rgb_data_byte[ 3 ] =
{
    { 'R', C10X10RGB_COLOR_RED_25, C10X10RGB_COLOR_OFF, C10X10RGB_BYTE_ROTATE_H_UP },
    { 'G', C10X10RGB_COLOR_OFF, C10X10RGB_COLOR_GREEN_25, C10X10RGB_BYTE_ROTATE_H_UP },
    { 'B', C10X10RGB_COLOR_BLUE_25, C10X10RGB_COLOR_OFF, C10X10RGB_BYTE_ROTATE_H_UP }
};

static uint8_t rainbow_brightness = 10;
static uint16_t rainbow_speed_ms = 20;                                                 

// ------------------------------------------------------- ADDITIONAL FUNCTIONS

static void logic_zero ( void )
{
    hal_ll_gpio_set_pin_output( &c10x10rgb.di_pin.pin );
    DELAY_TOH;
    hal_ll_gpio_clear_pin_output( &c10x10rgb.di_pin.pin );
    DELAY_TOL;
}

static void logic_one ( void )
{
    hal_ll_gpio_set_pin_output( &c10x10rgb.di_pin.pin );
    DELAY_T1H;
    hal_ll_gpio_clear_pin_output( &c10x10rgb.di_pin.pin );
    DELAY_T1L;
}

// ------------------------------------------------------ APPLICATION FUNCTIONS

void application_init ( void )
{
    c10x10rgb_cfg_t cfg;

    //  Click initialization.
    c10x10rgb_cfg_setup( &cfg, &logic_zero, &logic_one );
    C10X10RGB_MAP_MIKROBUS( cfg, MIKROBUS_1 );
    c10x10rgb_init( &c10x10rgb, &cfg );

    c10x10rgb_fill_screen( &c10x10rgb, C10X10RGB_COLOR_OFF );
    Delay_ms( 1000 );
}

void application_task ( void )
{
    c10x10rgb_display_byte ( &c10x10rgb, &rgb_data_byte[ 0 ] );
    Delay_ms( 1000 );
    c10x10rgb_display_byte ( &c10x10rgb, &rgb_data_byte[ 1 ] );
    Delay_ms( 1000 );
    c10x10rgb_display_byte ( &c10x10rgb, &rgb_data_byte[ 2 ] );
    Delay_ms( 2000 );
    
    c10x10rgb_display_string( &c10x10rgb, &scroll_data_obj, scroll_data_len, scroll_speed_ms );
    Delay_ms( 1000 );
    c10x10rgb_display_image( &c10x10rgb, &MIKROE_IMAGE[ 0 ] );
    Delay_ms( 3000 );
    c10x10rgb_demo_rainbow( &c10x10rgb, rainbow_brightness, rainbow_speed_ms );
    Delay_ms( 1000 );
}

int main ( void ) 
{
    application_init( );
    
    for ( ; ; ) 
    {
        application_task( );
    }

    return 0;
}

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

Additional Support

Resources