Help with 4 digit 7 segment display.

Hi guys,

I bought one of these 4 digit 7 segment displays a while back and now I have a use for it in a project - however I cannot figure out what the pinout is whatsoever?

I haven't powered it up since I got it, partly because I don't want to burn it out by wiring it up incorrectly, and partly because I just can't figure it out?

I understand how a single 7 segment display works and have used 4026's to control them before, however the pinout doesn't make sense, and neither does the datasheet as it has nothing but electrical charaacteristics?

(From Sparkfun's website)

Note: The pinout in the datasheet is incorrect. This is the correct pin-out:
1: Digit 1 16: B
2: Digit 2 15: G
3: D 14: A
4: Colon Anode 13: C
5: E 12: Colon Cathode
6: Digit 3 11: F
7: Decimal Point 10:Apostrophe Anode
8: Digit 4 9: Apostrophe Cathode

However, I don't know which pin is pin 1 as there is no indication?

Could I possibly end up burning this out if I wire it up incorrectly when trying to figure it out, and do you have any suggestions on how toi protect the display when experimenting?

Many Thanks,
The datasheet (link at the bottom of that page) shows pin 1 at the bottom left and there's no indication on the page that that is wrong also.

How to test safely...1.5v battery and a 1K resistor will be a safe test method - the LEDs will glow very dimly or not at all..
Look under the display. Can you see "1" next to one pin and "16" next to the same pin on the other side? if not, go back to that Sparkfun page and magnify the image that shows the backside of the display. Anyway, pin 1 should be the one on the front row, on the left (looking from above):
   16 15 14 13 12 11 10 9

--------       --------
!      !       !      !
!      !       !      !
--------       --------       etc
!      !       !      !
!      !       !      !
--------   *   --------   *

   1  2  3  4  5  6  7  8
You should not damage a LED by applying, for a very short time, a moderate reverse voltage. So, using an appropriate resistor (@5V and Vf=2V, 680Ohms will give out less than 5mA - enough to light the LED, not enough to damage it if applied in reverse).

Start by connecting V+ to pin 1 (remember the resistor) and Gnd to pin 14. The top segment of the first digit should light up.
The datasheet indicates max reverse voltage as 5v, so keep below that.
It also indicates forward voltage (@ 20mA) to be ~2v.
Hence, 1.5v might be a bit borderline to make it work at all.
So I'd go for 3v with a 1k resistor.

Crossed with last post.
I'd agree with that pinout. They usually follow the same convention as regular ICs.
Last edited:
I completely missed that PIN 1 right bang in the middle of the datasheet - sorry for that!

Ok so from what I understand, each digit has a common anode and the segments of each digit are all in parallel, so in order to get all 4 digits to light I have to use PWM (or a seriously fast high-low loop) in a round-robin fashion?

What I want to build is a clock using a DS1307 real-time clock IC with 32Khz crystal, and also incorporate a DS18B20 to enable the clock to also tell the temperature at the push of a button.

However I'm limited to a 20x2 and I'm now wondering if it leaves me with enough I/O pins unless I offload some of the work to an IC. Ideally I'd use 4 4026's (which I have) but these require a common-cathode setup.

Does anyone have any suggestions what I could use (whilst trying to keep the component count low) to achieve this?

By my count I need:

8 I/O for the digits
4 I/O for the anodes
1 I/O for the apostrophe
1 I/O for the colon
1 I/O for the DS18B20
?? for the 1307 RTC (don't have the datasheet handy)

IDeally I'd also like to be able to control the last digit independently of a "stuck" format like a 4026 as I'd like to display a C when the temperature is on the display.

Any help would be greatly appreciated.

Last edited:
You will need two (specific I2C) pins for the RTC chip.
You will also need to use one wire commands for the DS18B20 because ReadTemp can take ~750mS to execute which is a long time to have the display blank between each reading.

Strongly suggest the assistance of a display driver.
I'm sure someone will shortly post their favourite.
I'm also playing with clocks and only last week I built a prototype using a display not very different from this one. In the meantime I decided to use some of the (many) graphical LCDs I got really cheap and I no longer have the LED display setup.

I started with a 20X2 and a 595. Couldn't really make it go fast enough to avoid a lot of flicker. So I moved to a 28X2 driving the cathodes directly. A common cathode is not much of a problem if you throw a few transistors in. That's actually what I did (a full ULN2803A plus some NPN transistors - the ULN2803 was, obviously, overkill, but I got tired of dealing with so many small leads and use ICs and resistor arrays whenever possible).

I don't have any nice schematic, only a small drawing of the piece of stripboard I used for the display. doesn't even include the Picaxe. But, just in case it helps:

If you go the route of a counter/divider I strongly suggest one with parallel input (BCD?). Otherwise, with a Picaxe, you may find it difficult to program the IC fast enough. Or, if you have a few, maybe use one for each digit.

If you have the Picaxe or the IC driving transistors and these driving the LED cathodes, there should be no problem.

At the end of the day, with so many semiconductors in the picture, a MAX7219 starts looking more and more appealing.
O/T, but... :eek:

PEBBLE is great! It was actually one thing that helped me decide to take the jump into learning electronics - playing with that virtual breadboard made me think it couldn't be as hard as I thought it might be.

I only go back to Excel when designs start getting more complex, as I can easily route wires all over the place. Plus I'm trying to learn Diptrace and/or Eagle, as one of these days I'll have to start having PCBs made.

Back on topic, please note that my display has blue LEDs, requiring higher voltages than the regular red or green. Plus I was driving it at a low duty cycles. That's why the resistors used are somewhat weak.


Senior Member
Hi kandh,
thats the equivilent display to what i,m using in my stopwatch project
maybe this circuit makes sense. all resistor values can be the same
just the pin numbers are different. that is the layout
 C3        1: Digit 1                                B1         16: B 
 C2        2: Digit 2                                B6         15: G 
 B3        3: D                                      B0         14: A 
 -         4: Colon Anode                            B2         13: C 
 B4        5: E                                      -          12: Colon Cathode 
 C1        6: Digit 3                                B5         11: F 
 B7        7: Decimal Point                          -          10:Apostrophe Anode 
 C0        8: Digit 4                                           9: Apostrophe Cathode


Last edited:
Hi kandh,
thats the equivilent display to what i,m using in my stopwatch project
Hi Marks - I see that you are using transistors on the cathode of each digit so that you have digital control whilst avoiding having to use the Picaxe to sink the current which is good, but I'm wondering what your code looks like for the display?

From my understanding the only way to use these displays is PWM but I'm a little unsure on a few things.

1. What is the best way to store the pin pattern for each required digit (on the B pins in your circuit) so that it is easily and quickly accessible? (I can't use an IC such as a 4026 as I need custom patterns as well as numbers)

2. The best way to PWM? Is it best to have a small subroutine for each of the 4 digits and cycle through these quickly?

3. How to listen for changes to the numbers as the PWM is busy cycling?

Any help would be greatly appreciated,

Many Thanks,
I think you're a bit confused over PWM vs. multiplexing. Marks' circuit requires software multiplexing (highs/lows on the right transistors at the right times).

PWM is generally used for brightness control and you could overlay a PWM on these multiplexing signals (via hardware I would suggest) to get brightness control, but that's the next level of refinement.

DIY multiplexing can turn into a less than satisfactory experience depending on what else you want the PICAXE at the same time that it is rushing around making all the digits non-flickering and constant brightness - you can't get a quart out of a pint pot, as they say. Any appreciable time spent doing anything other than multiplexing is likely to be noticeable.

...and that's why display drivers were invented. Of course, the emerging requirement for non-standard segment illuminations knocks some of them on the head (although the MAX7219 is still in with a shout as it does more than 0-9)


Senior Member
Hi kandh,
i have a few projects in the
User projects- miscellaneous

just finished doing a clock
theres a stopwatch too
and a counter

i,d play around with the counter project get a feel how it works
code has been improved with the clock there is no flicker.

hope you find em heres the code for the counter
	'             -- --   -- --   -- --   -- --
	' B0-A       |     | |     | |     | |     |
	' B1-B	
	' B2-C       |     | |     | |     | |     |
	' B3-D        -- --   -- --   -- --   -- --
	' B4-E       |     | |     | |     | |     |
	' B5-F
	' B6-G       |     | |     | |     | |     |
	' B7-         -- --   -- --   -- --   -- --   
	'Display        1       2       3       4
	'Common anode  C.3     C.2     C.1     c.0
let dirsb = %11111111
let dirsc = %10111111



let b10 = w0 dig 3
if w0 < 1000 then bl10                                       'Zero blanking
lookup b10, (192,249,164,176,153,146,130,248,128,144),b10    '(0,1,2,3,4,5,6,7,8,9)
Dig1:  high c.0 : let pinsb = b10 : low c.3 : pause 1        'Display1 

let b11 = w0 dig 2	
if w0 < 100 then bl11                                        'Zero blanking
lookup b11, (192,249,164,176,153,146,130,248,128,144),b11    '(0,1,2,3,4,5,6,7,8,9)
Dig2:  high c.3 : let pinsb = b11 : low c.2 : pause 1        'Display2 
let b12 = w0 dig 1	
if w0 < 10 then bl12                                         'Zero blanking
lookup b12, (192,249,164,176,153,146,130,248,128,144),b12	 '(0,1,2,3,4,5,6,7,8,9)
Dig3:  high c.2 : let pinsb = b12 : low c.1 : pause 1        'Display3 

let b13 = w0 dig 0	
lookup b13, (192,249,164,176,153,146,130,248,128,144),b13    '(0,1,2,3,4,5,6,7,8,9)
Dig4:  high c.1 : let pinsb = b13 : low c.0 : pause 1        'Display4 
if pinc.6=0 then start                                       'reset ready for next count
s1:let w1=w1+1                                               'ignores button bounce
if w1>1 then display

if w0>9998 then main                                         'Reset after 9999 reached
let w0=w0+1 goto display                                     'Add count by 1 

bl10: let b10 =255  goto Dig1                                 
bl11: let b11 =255  goto Dig2
bl12: let b12 =255  goto Dig3
I see the difference between multiplexing and PWM but was thinking of a different implementation where PWM was indeed used for brightness control.

I have 4x 7-segment displays that I could use instead, but that requires 4x 4026's (which I have) but increases the circuit size drastically and I lose the colon. However in using the 4026 I encounter a problem on the last digit - when it is in clock mode it will utilize the 4026, but when a button is pressed a temperature is read from a DS18B20 and then displayed on the 4 digits in 'xx.xc' format. As such, I also need to be able to write a "c" to the fourth digit bypassing the 4026 without damaging it, and I don't know the best way to do that. :(

I have eagle schematics at home of the 4026 version that I can post later if it helps.

Many Thanks,

(Btw, is there any way to change names on the forums or is it a case of creating a new account?)