A versatile single-character 7-segment display using one PicAxe o/p pin

A versatile single-character 7-segment display using one PicAxe o/p pin, one resistor, one capacitor and a simple counter chip.

This started out as a means of displaying the levels in the drinking water tanks on our boat. Using three float switches at different heights I could sense four different levels, but as there was the possibility that a float might stick, I wanted to have some error codes as well as levels. The levels I wanted to display were: "F" for Full; "H" for High; "O" for Okay; and "L" for Low, with error codes 1, 2, 3 & 4 which would tell me which float switches were causing an error. Displaying this info on a seven-segment LED seemed a simple way to do it but the standard CMOS decoders such as the 4511 and 4543 don't do any alpha characters and the 4056 only does L, H, P & A.

I also wanted to sense two temperatures with DS18B20 sensors, the presence of a charging voltage and the state of a push-button - all with a PicAxe 08M2!

I could sense all the water tank levels and error states on pin C.4 and on C.3 I could monitor the push-button and charging voltage. C.2 and C.1 were dedicated to the two DS18B20s, which only left C.5 (serial in, no use as an output) and C.0, a digital output - perfect!

So I had one output pin with which to control a seven-segment LED display, and get characters that weren't available from a standard decoder. This is what I came up with: a simple (and cheap) CMOS ripple counter such as the 4024 (or for more functions, the 4040) could be clocked into any given state on the seven outputs (one per LED segment) conveniently using the PULSOUT function in PicAxe Basic. Seven-segment displays, while not able to display all the alpha characters, can display many more characters than most decoders allow, making this a very versatile solution.

While I could just reset the counter at power-up, I thought the software to keep track of where it had got to would be too much for my programming skills, so I figured out a way of resetting it and clocking it from the same pin, effectively using a simple R-C filter. The duty-cycle of the PULSOUT pulses never charges the capacitor (C4) up enough to reset the counter (and hence display), but a longer reset pulse does. Note in the code that the pin is taken high for 700ms to effect the reset, but then taken low again for the same length of time to ensure the capacitor is discharged. If this weren't done, the PULSOUT pulses might cause an unwanted reset.

I've included in the schematic a crude table showing the codes (counts) required for a large range of characters. They are effectively context specific, for instance a "5" and an "S" are actually the same, but it is possible to distinguish between a "J" and a "j". If a count value isn't shown for a given character, it's either not possible with a 7-segment display, or might be ambiguous. Other characters are possible, such as a "?" (count 083), i.e. a "2" with the bottom bar missing.

When the counter is being clocked, the display does briefly flicker through various states, but assuming any given character is displayed for at least ½ a second (as in the demo), this isn't visually a problem. The demo runs through numeric characters 0 - 9 and then upper case A, C, E, F, G, H, I, J, L, O, P, S, U & Y to show some of the possibilities.

A short video of it is here:

The code isn't necessarily very elegant, but it is simple and, I hope, understandable.

#picaxe 08M2
for b4 = 0 to 9
	gosub res_timer
	LOOKUP b4,(63,6,91,79,102,109,125,7,127,111),b5
; numeric 0 - 9
	for b6 = 1 to b5
	pulsout c.0,2
	next b6
	pause 500
next b4
for b7 = 0 to 13
	gosub res_timer
	LOOKUP b7,(119,57,121,113,61,118,48,_
; A,C,E,F,G,H,I,J,L,O,P,S,U,Y,
	for b6 = 1 to b5
	pulsout c.0,2
	next b6
	pause 500
next b7	
goto main
high c.0
pause 700
low c.0
pause 700

The circuit diagram (of the relevant parts of the circuit) is here:
http://www.aardvark-world.org.uk/picaxe/Single pin display circuit.PNG

Additional notes:

When the PicAxe is being programmed, the display is clocked through many states. This could be prevented with a programming link on pin C.0, but I haven't bothered.

The counter chip needs to be a 74HC4024 or 74HC4040 type to have sufficient output drive capability and the 7-segment display must be a high-efficiency type. Be aware that with all the outputs on ("8"), the counter is potentially providing quite a lot of current which may exceed its design capabilities if left on indefinitely.

In the circuit shown, I've included a little alarm beeper on output Q8. To set this, just add 128 to whichever code is being displayed. The decimal point could be displayed as well or instead of this.

The LM317T regulator shown needs a heatsink as the 7V drop (from 12V) and the currents involved add up to quite a few watts to be dissipated.
Last edited:


Well-known member
Necessity is the mother of invention! Good show!

Now just imagine what you could do with this and a 20X2! Wonders!


New Member
What an excellent way to drive 7-seg displays with few pins! (ONE!)

Back around 1982, when I was in a digital electronics/computer course, I devised an "alphabet" font for 7 seg displays that included all of the letters. Yes, some were strange, but once a person was familiar with the odd font, messages could be read fairly easily.

For example, a "v" was the bottom and two lower sides. A "w" was the same, but with the top segment lit. "U" was upper case. Fun stuff. ;)

I have some 16 segment displays, now, and this gives me some great ideas! :) Thanks!


Yes, an inventive way to drive a single digit multi segment display.
Well done.

Next, you could use the spare pins on that 4040 chip to drive more segments in a 14/16 segment single-char display to cover more of the alphabet. See:
In the 7-segment group but then go to near the bottom where they have the "14-segment" displays.
Even just driving 12 of the segments and/common the 2 halves of the horizontal lines can add to the character range.


Senior Member
VERY nice! I'm also a fan of "pinimalism", using cheap external hardware to minimize the use of I/O pins. Here's my $4 08M2 two-pin ultrasonic display.