Arduino, HT16C32, and the Library

While a simple example of putting a 8x32 matrix on an Arduino, a more in-depth look at a library for the noobs and non-career- programmers.

Similar projects worth following
My background isn't in programming or engineering but I my career is in computers and networking. A couple of years back I started with a generic Uno and I keep learning and delving deeper into the micro controller world. I like the hardware side much better, but software kind of goes hand in hand.

It can be frustrating to have a device and not find a lot of information pertaining to it. No being sure of how to program it to do something. While usually there is a readme and keywords file, sometimes there is not. The worst can be an example of how to program the device and the example doesn't work. What to do? Fix it I say. Let see how to start.

This is geared towards the newly initiated in the world of Arduino, but I hope others will stop and take a read as well. 

Here I am going to use a simple project to cover this subject. I have an Arduino Nano and 8x32 controlled by a HT1632C. This project is focused on the library used by the Arduino IDE and HT1632. 

While this is a well put together library, there were a couple of items I had to check on and wanted to share some of the knowledge to help and inspire others. A note to all of the real engineers and programmers out there, I welcome constructive criticism and corrections. I want to help some other soul out there who is just dying to get a project put together but can't find quite all the information they need. 

At this point I am going to make a note that the data sheet of any device / chip will provide some very useful details. I highly recommend you take a look. Even if you don't know what everything means, it is another place to start learning; but that is for another article. 

What is a Library?

According to the Arduino site, the definition of a library is

"Arduino Libraries

Libraries are files written in C or C++ (.c, .cpp) which provide your sketches with extra functionality (e.g. the ability to control an LED matrix, or read an encoder, etc.)."

Within these files lies all of the information needed to grasp control of said device. Most of libraries will have a decent README file laying out how to setup the program, the device, options available, and a word or two of advice. Others might be short on the README but long on the comments in the examples. And others might leave you high and dry and your kind of left poking around to find what you can. This guide will hopefully get you started on that path if need be; or if you are just a curious mind and need to know more. 

Included in an usual Arduino library are the following files:

  • device_name.h - the header file. This is the file declared in the "#include" statement. And  what can be done with the device.
  • device_name.cpp - the source file. This is the code the C compiler works with. The .h file is not used directly, but is copied if "#included" in the .cpp file. 
  • keywords.txt - commands for programming and Arduino IDE coloring of class and member
  • README - a little or a lot of info
  • examples directory - a quick look at what it can do

Let's get wired

Now here is how the HT1632 panel is wired to the Arduino. In this case I have used a Nano, but the pins assignments are the same. Up to 4 panels are supported, but being I only have one on hand here it is. 

The core of the matter

Off the bat, here is the scoop. To complete this project you must have the Arduino IDE installed.

Download the library HT1632-for-Arduino. One can either download the library from GitHub through a web browser with the link above, or if you have GitHub installed on your computer that can be used as well. 

Install the library in the Arduino IDE.  From the menu Sketch -> Include Library -> Add .ZIP library. Once the selection window appears, navigate to where the .zip file is, select it, and click Choose. 

This library is a bit different than some as it must be edited to declare what type of display is being used. This edit is done in the HT1632.h file. It includes instructions on how to edit the file for your panel. Be and sure to edit the file in the library directory being used. This can be done with any text editor. I used BBEdit to make sure it is set to:

// SureElectronics 32X08 Monochrome LED Dot Matrix Unit Board
#define TYPE_3208_MONO 1

In the Arduino IDE, open the example sketch from the File menu. 

... Read more »


A quick demo of the hardware and program

x-m4v - 11.83 MB - 09/05/2019 at 01:06



This is my highly commented code for this project.

ino - 1.16 kB - 09/05/2019 at 00:41


  • 1 × Elegoo Arduino Uno Arduino Uno
  • 1 × 8x32 LED matrix HT16C32 Actuall 4 8x8 panels on one board
  • 1 × Jumper wires :: Female - Male

  • Nano Pinouts

    Peter09/05/2019 at 19:21 0 comments

    The source URL for this image is included in the Links/reference section. 

  • Example sketch - with lots and lots of comments

    Peter09/05/2019 at 01:05 0 comments

    Here is my commented code for an example of using an Arduino Nano with a HT1632C 8x32 panel. 

    // Libraries needed for the demo
    #include <HT1632.h>
    #include <font_5x4.h>
    // Set the variables
    // integers
    int i = 0;
    int wd;
    // a string of characters to display
    char disp [] = "Welcome to TVLand!";
    void setup () {
      // Which pins is the display using. 
      // The pin order is (CS1, pinWR, pinDATA)
      HT1632.begin(9, 10, 11);
      // Setting up the font
      wd = HT1632.getTextWidth(disp, FONT_5X4_END, FONT_5X4_HEIGHT);
    void loop () {
      // Original code - drawTarget not a keyword
      // HT1632.drawTarget(BUFFER_BOARD(1));
      // Below, renderTarget, reflects the updated library - v2.0,
      // which screen to send the data to. There can be up to 4 panels.
      // Clear the RAM buffer for the display
      // All of the above variables come from the font.h file
      // OUT_SIZE is the width of the display
      HT1632.drawText(disp, OUT_SIZE - i, 2, FONT_5X4, FONT_5X4_END, FONT_5X4_HEIGHT);
      // Display the contents of RAM to the screen
      // Scrolling the text from right to left
      i = (i+1)%(wd + OUT_SIZE);
      // a quick pause before cycling through

View all 2 project logs

Enjoy this project?



Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates