BarGraph Click Board
BarGraph Click Board
Introduce a ten-segment light bar display to user design with the BarGraph Click Board™ from MikroE. This compact accessory board employs a JSB-R102510Z red LED bar display as well as two 74HC595 shift registers. The 74HC595 chip incorporates an 8-bit, serial-in, parallel-out shift register that feeds an 8-bit D-type storage register with 3-state output. For communication with the target board microcontroller, BarGraph Click Board™ uses the MikroBUS SPI (MOSI, MISO, SCK, CS), RST and PWM lines. It allows data to be passed serially from a microcontroller and thus saving I/O lines. The board comes set for 3.3V operation, but can be adapted for 5V use by repositioning an SMD jumper. It has a green LED diode that indicates the presence of a power supply.
The BarGraph Click Board™ is an ideal option to easily build a VU metre. It allows multiple boards to be connected close together and aligned to form a longer LED stripe.
Each segment is composed of a uniformly lit red coloured LED, which draws about 20mA of current. The bar graph display light intensity can be dimmed by applying a PWM signal on the mikroBUS™ PWM pin. By utilizing two shift-register ICs, it is possible to program any pattern using these 10 segments via the industry-standard SPI interface. The Click board™ offers a lot of possibilities for building custom bar graph applications such as VU meters, status indicators, various types of gauges, and similar applications.
How Does The Bargraph Click Board™ Work?
When it comes to driving an array of LED segments, using so-called shift register ICs is almost unavoidable. Due to their ability to be connected in cascades, they are commonly used for any type of LED segment array. The Bargraph Click Board™ uses two 74HC595, 8-bit serial-in, parallel-out shift registers with output latches, from Texas Instruments to drive the JSB-R102510ZR, a 10-segment bar graph array. The 74HC595 ICs are comprised of a D-type internal storage register, as well as the 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, and then clock it out to the parallel output pins.
The JSB-R102510ZR bar graph LED array has 10 red coloured LED segments. Each LED has its anode and cathode routed out, making each LED element absolutely independent, so it can be used in any circuit configuration. However, the JSB-R102510ZR bar graph display is connected as display with the common cathode, meaning that all LED cathodes are connected to a single point. This LED cathodes common line (CC) is connected to the drain of the N channel MOSFET, while its source is connected to the GND. Driving this MOSFET via its gate through the PWM pin of the mikroBUS™ allows dimming of the LED segments. By changing the duty cycle of the PWM signal, it is possible to change the brightness of the XGURUGX10D bar graph display. The gate of this MOSFET is connected to the PWM pin of the mikroBUS™ and it is pulled to VCC, allowing display to work if the PWM pin is left floating.
The Bargraph Click Board™ communicates with the host MCU via the mikroBUS™ SPI interface pins. Two bytes of information (16 bits in total) are pushed through the serial data input pin (DS) of the first 74HC595 IC, routed to the SDI pin. The 74HC595 construction is such that after receiving 8 bits, clocking in one more bit will shift the existing 8 bits by one place, overflowing the last bit to the Q7S output pin, shifting it out that way. Since the Q7S of the first 74HC595 is connected to the DS pin of the second 74HC595, clocking 16 bits into the first 74HC595 IC will fill up both ICs with required data. Note that only two bits of the second byte will be used, since the second shift register only has 2 output connected to the bar graph display (8 from the first IC + 2 from the second).
It is worth mentioning that the Q7S of the last 74HC595 IC is routed to the MISO pin of the mikroBUS™, labeled as the SDO, allowing connection of multiple devices in cascade, building more complex setups. Adding more devices in cascade would require more 8bit words to be clocked into the first 74HC595 IC in the chain.
When the data has been clocked in, the 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 ICs, and it is labeled as LT on the Click board™. A rising edge on the STCP input pins of the 74HC595 ICs will latch the data from their internal storage registers to the output pins, polarizing the connected bar graph segment anodes. The STCP pin is pulled to a LOW logic level by the onboard resistor. If the previously mentioned MOSFET is in conductive state, the current will be able to flow through the LEDs and the polarized LED elements will get lit.
The #MR pin is used to clear the data in the internal storage register of the ICs. 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™, labeled as MR and it is pulled to a HIGH logic level by the onboard resistor.
The Bargraph Click Board™ works with both 3.3V and 5V MCUs. The operating voltage selection can be done via the onboard SMD jumper, labeled as VCC SEL.
SPECIFICATIONS
Type | Bargraph,LED Segment |
Applications | It can be used for displaying of various signal or status properties, for building VU-meters, and various types of gauges and signal indicators |
On-board modules | 74HC595, 8-bit serial-in, parallel-out shift registers with output latches, from Texas Instruments; JSB-R102510ZR, a 10-segment red bar graph LED array |
Key Features | Clean and bright bargraph LED display, with uniform light disbursement, simple to use with included software library functions, low current consumption per LED, it is possible to serially connect more devices |
Interface | GPIO,PWM,SPI |
Compatibility | mikroBUS |
Click board size | M (42.9 x 25.4 mm) |
Input Voltage | 3.3V or 5V |
PINOUT DIAGRAM
This table shows how the pinout on the Bargraph Click Board™ corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
Notes | Pin | Pin | Notes | ||||
---|---|---|---|---|---|---|---|
NC | 1 | AN | PWM | 16 | PWM | Dimming PWM IN | |
Memory Clear | MR | 2 | RST | INT | 15 | NC | |
Data Latch | LT | 3 | CS | RX | 14 | NC | |
SPI Clock | SCK | 4 | SCK | TX | 13 | NC | |
SPI Data OUT | SDO | 5 | MISO | SCL | 12 | NC | |
SPI Data IN | SDI | 6 | MOSI | SDA | 11 | NC | |
Power supply | 3.3V | 7 | 3.3V | 5V | 10 | 5V | Power supply |
Ground | GND | 8 | GND | GND | 9 | GND | Ground |
ONBOARD SETTINGS AND INDICATORS
Label | Name | Default | Description |
---|---|---|---|
LD1 | PWR | - | Power LED indicator |
JP1 | VCC SEL | Right | Power supply voltage selection: left position 3.3V, right position 5V |
Software Support
We provide a demo application for the Bargraph Click Board™ on our Libstock page, as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.
Library Description
The library initializes and defines SPI bus driver and drivers that offer a choice for writing data in registers and reading data from registers. The library includes functions for logging values on the BarGraph display. A user can enable and disable the chip with the function bargraph_enable(), which is supported in the library.
Key Functions
void bargraph_driverInit()
- Functions for initializes chipvoid bargraph_display( uint8_t input )
- Display functionsvoid bargraph_enable( uint8_t input )
- Functions for enable the chip
Example Description
The application is composed of three sections:
- System Initialization - Initializes SPI module and sets PWM pin, CS pin and RST pin as OUTPUT
- Application Initialization - Initializes driver init and BarGraph init
- Application Task - (code snippet) - Counter passes through the loop and logs the value of the counter on the bargraph display
void applicationTask() { for (cnt = 0; cnt <= 10; cnt++) { bargraph_display( cnt ); Delay_ms( 500 ); } }
The full application code, and ready to use projects can be found on our Libstock page.
Other MikroElektronika libraries used in the example:
- SPI
ADDITIONAL NOTES AND INFORMATION
Depending on the development board you are using, you may need USB UART click, USB UART 2 click or RS232 click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.
MIKROSDK
The Bargraph Click Board™ is supported with mikroSDK - MikroElektronika Software Development Kit. To ensure proper operation of mikroSDK compliant click board demo applications, mikroSDK should be downloaded from the LibStock and installed for the compiler you are using.
Software Support
We provide a demo application for the Bargraph Click Board™ on our Libstock page, as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.
Library Description
The library initializes and defines SPI bus driver and drivers that offer a choice for writing data in registers and reading data from registers. The library includes functions for logging values on the BarGraph display. A user can enable and disable the chip with the function bargraph_enable(), which is supported in the library.
Key Functions
void bargraph_driverInit()
- Functions for initializes chipvoid bargraph_display( uint8_t input )
- Display functionsvoid bargraph_enable( uint8_t input )
- Functions for enable the chip
Example Description
The application is composed of three sections:
- System Initialization - Initializes SPI module and sets PWM pin, CS pin and RST pin as OUTPUT
- Application Initialization - Initializes driver init and BarGraph init
- Application Task - (code snippet) - Counter passes through the loop and logs the value of the counter on the bargraph display
void applicationTask() { for (cnt = 0; cnt <= 10; cnt++) { bargraph_display( cnt ); Delay_ms( 500 ); } }
The full application code, and ready to use projects can be found on our Libstock page.
Other MikroElektronika libraries used in the example:
- SPI
ADDITIONAL NOTES AND INFORMATION
Depending on the development board you are using, you may need USB UART click, USB UART 2 click or RS232 click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.
MIKROSDK
The Bargraph Click Board™ is supported with mikroSDK - MikroElektronika Software Development Kit. To ensure proper operation of mikroSDK compliant click board demo applications, mikroSDK should be downloaded from the LibStock and installed for the compiler you are using.
BarGraph Click Board
Frequently Asked Questions
Have a Question?
Be the first to ask a question about this.