Need help: 4-Digit 7-Segment Clock with 74HC595 Shift Register

I’ve spent hours Googling around with no luck, so hopefully someone can help get me going.

I’d like to create a clock using a 4-digit 7-segment display that I have lying around ( data sheet ). In the interests of conserving pins on my Photon, it seems a shift register would be a good move, and I have a 74HC595 that I believe will do the job.

I found a tutorial elsewhere for an Arduino Uno that is almost what I want: However it uses literally 4 separate 7-segment displays, so the pin count is different and I’m really not familiar enough with this stuff yet to adapt it. I realise it’s probably trivial… but there you have it.

Hoping to learn more through this experience. Help welcome! Please let me know if you need any more details.

@Japh, with your display, the trick is to shift out a segment value to the shift register and then selecting the common cathode for the digit you want do display with those segments. Doing that for each digit quickly (faster than 30 Hz) will appear like all four digits are being controlled independently.

The thing to remember is that LEDs are current-based devices as long as their operating voltage is satisfied. As such, you will not be able to drive the common cathode directly from a Photon pin since it can only sink 20ma max. Also, the 74HC595 can only source a few milliamps per pin. Bottom line is you will need to use transistors to drive each common cathode and current limiting resistors (220 ohms or so) for the segment drive lines.

You may want to consider using this Adafruit board:



Ditto what @peekay123 said.

You’re correct that a shift register is the way to go, you’ll just need to make sure to implement it the correct way. The tutorial you linked requires 4 shift registers because each one only has enough outputs to handle a single digit of the display.
For a good understanding of shift registers, I’ve always appreciated TronixStuff’s tutorials Chapter 4 and 5.

Chapter 4 talks about the basics of shift registers and Chapter 5 expands on that to talk about chaining the shift registers together to save on pins.


Thanks so much to both of you for the info and feedback.

@peekay123 Sounds like maybe even going all the way to an Adafruit display + backpack, just to be sure (also my display doesn’t appear to have the “:”, which would be nice). Might grab one of these:

@johnventions Thanks for the reading material! Much appreciated :smile:

@Japh, did you also consider the alphanumeric version?


1 Like

This might also help :smile:

1 Like

I’m actually placing an order for the Adafruit alphanumeric version with backpack right now :smiley:

More options, eh? :wink:

1 Like

Nice example project, thanks!

Wait til a bit to order and get 10% off tonight :slight_smile: if you get a code from the Ask An Engineer show.

I’ll be placing my order through, as I’m based in Australia. So that probably wouldn’t apply to me, sadly. Right?

Yeah I think you must order direct. Good to know they have distribution around the world though :smile:

1 Like