How to Get Your HS420361K-32 4 Digit 7 Segment Display Working with an Arduino

Typically when I get new electronic components to play with, I just google the part number and lookup tutorials on how to get it working. This has been a pretty successful strategy more often than not. However, this wasn’t the case when I needed to get the HS420361K-32 4 digit 7 segment display to work.

The rule of thumb for when you want to work with an electronic component is you use its datasheet as a point of reference. The datasheet will inform you on things like what the pins do, how much voltage and current it can handle, and a whole load of extra information that should equip you with enough knowledge to get the component up and running. So when I went looking for the HS420361K-32’s datasheet and didn’t find it, I knew I needed to put in quite a bit of extra effort.

So where do we start? Let’s start with the 7 segment display.

These kinds of displays can be found in calculators, watches, microwaves, almost any display that needs to portray numerical information. The convention for naming the seven segments that make up the display is as shown in the diagram above, from A to G. Lighting these segments in various combinations will enable you to display a particular number, or even some alphabetical characters.

7 segment displays come in one of two combinations: it could be a common anode connection

in which all the anodes of the constituent segments are connected together; or it could be connected in a common cathode connection

in which all the cathodes are connected together. Just a quick reminder of which side of the diode symbol is the anode and which the cathode if you need one

The cathode is the negative terminal of a diode, and the anode is its positive terminal. One way I like to remember this is we know that the diode symbol points in the direction of conventional current, therefore current moves from anode to cathode, from A to C, get it, you can remember it like AC current, yes?

7 segment displays come is quite a number of combinations, you could have a single digit 7 segment display like the one shown below

or a 4 digit 7 segment display like the one that’s the topic of this post.

One good thing about 4 digit 7 segment displays that I was happy to find out is that if they are the type that have 12 pins, then the layout is pretty much as shown below, regardless of whether it’s a common anode or common cathode type of a display

The D1-D4 are the common pins that are connected to digit 1-4 respectively.

PIN NOSEGMENT/COMMON POINT
1E
2D
3.
4C
5G
6D4
7B
8D3
9D2
10F
11A
12D1

At this point, what needed to be determined was whether the HS420361K-32 was a common anode, or a common cathode kind of display. This is where a datasheet could have helped, but nonetheless, it turns out it is a common cathode kind of display. This information is of particular value if you are going to be searching for a library to use to control the display.

With this background knowledge, we are now equipped with the information we need to start working with the arduino. So what do we need to have some working prototype? Well, it’s best to have the following at hand:

  • A HS420361K-32 Display (doesn’t have to be this strictly)
  • An Arduino (I’ll be using the Uno)
  • 4 x 330Ω Resistors
  • Breadboard
  • Male to Male Jumper Wires
Next, you’d want to connect your led display pins to the arduino as outlined below:
ARDUINO PINLED PINSEGMENT/COMMON POINT
212D1
311A
410F
59D2
68D3
77B
86D4
91E
102D
113.
124C
135G
And below we have a pretty poor “schematic” of the circuit using Fritzing. This is my first, and possibly last, time using Fritzing.

And this is how it should actually look like once hooked up

The reason I chose the pin layout as outlined in the table above is because I wanted to have a clean cable layout whereby you could see the led display without cables running over it. These kinds of design considerations are pretty important 😉.

Once everything is hooked up nice and securely, the next step is the fun step, which is the code.

When this is run as it is, it should display the value of pi correct to three decimal digits.

The code itself is pretty lengthy because it has quite a number of functions for displaying various characters. I could make it into a library so that everything looks nice and clean. I don’t really want to get into the whole code situation right now, I think I’ll leave that for another day but I have tried commenting on it so that it should be relatively straight forward.

What I’m especially excited about the code is all the alphabetically characters that I managed to add into the code so you can write text to some extent.

So, that’s it, that’s how to get a common cathode 4 digit 7 segment display to work. Below is a little loop of all the characters that the code above can display, if you are interested in the code that runs the loop, you can get it from my github.

References

These were some of the resources that I used in the making of this post, you could check them out for extra information.

9 thoughts on “How to Get Your HS420361K-32 4 Digit 7 Segment Display Working with an Arduino

  1. Appreciate the post. First result when I Googled HS420361K-32. I can’t believe none of the ‘datasheet’s actually show a pinout!

Leave a Reply

Your email address will not be published. Required fields are marked *