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: http://randomnerdtutorials.com/arduino-temperature-displayed-on-4-digit-7-segment/ 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:
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.