I've used the STLED316S LED driver in several projects with good results. It's inexpensive and can drive up to 6 common anode digits plus 8 additional discrete LEDs with brightness control. It can also read from up to 16 tactile switches. I'm currently developing an alarm clock shield using this chip - I hope to post details soon. I've written a library for the chip I plan to share. It's only available in an SMT package but you could always put one on a breakout board if that's a problem.

Pinout is not the only difference. Your display is common Cathode and my SparkFun display is common Anode. So basically wherever the code sets pin to HIGH it needs to set it LOW and vice versa. I only had to make 4 changes to the code and I've highlighted them [glow]yellow[/glow]. That should work. Good luck!

void RefreshDisplay(){[glow] //Change#2 (Your display is common Cathode, so to turn OFF a digit, we need to set it to +5)[/glow] digitalWrite(digit0 + digitPosition, [glow]HIGH[/glow]); // Turn off previous digit

As others have mentioned, you can use practically any 8-bit serial-to-parallel 'sinking' driver IC or "constant current" sinking driver IC connected to the segments and five PNP or P-channel MOSFET 'sourcing' column drivers. The 74HC595 is a little "light duty" for this application but seems to hold up well. A better choice might be the TPIC6C595.

Here's an example of my MacMux? design for that Sparkfun display. I apologize for not yet having enough experience to back up the design with an Arduino software driver example but I could provide a C example for PIC if someone wants to take a stab at coding my method for Arduino.

The MacMux? design uses the PWM module with a period equal to the digit scan interval (1 to 2 msecs) to multiplex the column driver lines. When the PWM signal goes high (display "off") at the beginning of each digit scan interval the column driver lines are re-tasked for use as <CLK> and <DAT> lines to load the 74HC595 shift register. The column driver lines are then reset to the correct column select pattern (only one line low) before the PWM line goes back low (display "on"). Complete fade-to-black brightness control is a matter of setting the PWM duty cycle to some value between approximately 5% and 100% in the main program. PWM duty cycle is inversely proportional to display brightness with a 5% duty cycle = full brightness and a 100% duty cycle = black.

I was just wondering how to program the Arduino to make the 4 digit 7-segment display show a number that was arrived at in a different part of the program. I would be using the red display, so would it be different than Hari's post? I think I may have to use an Arduino Mega since I'm already taking up 8 digital pins with other things.

just a quick comment.4 resistors are enough, and the 40ma is not a real issue (only 4 segments can be using the same current source, and with 10ma you can still get good brightness) if using the code from "http://nootropicdesign.com/projectlab/2009/10/"(mentioned by jeremytsl).in this code the relevant segments are turned on individually, and stays on for a short delay, and then turned off. this also answers the question embedded in the code for why there is a need for a delay."delay(1); // Don't understand why I Have to set a delay digitalWrite(groundPins[g], HIGH);"also, if using the red 7-segment display, which is rated 2.1V and 20ma a 330 or 220 Ohm resistors are better.if using a code that lights all the segments in a number at the same time - then the comments are accurate and segments should each have a resistor and 40ma Arduino pin output should be taken under consideration.thanks everyone for your comments!

I just received this (YSD-439AK2B-35) from sparkfun and started playing with it. What I realize is that if I set this to input on HIGH, it uses lower voltage (1.74v). And I tested it out with 1k resistors, which is the smaller I have ATM, it will lid up but very dim (w/ 1k R).

I'm too chicken too remove the resistor, since its brand new... So what I want to know is, can I cut the cost down and save a few resistors this way?

The specs say Reverse voltage: VR=5V, 10µA and this is the code I used to test it.

i Think that the right is //Digit 0 thru 3 == pins 10 thru 13 but i don't know how change this in the sketch.

thanks for your attention

---------------------Posted by: hari Posted on: 26.03.2010 at 04:54:35Pinout is not the only difference. Your display is common Cathode and my SparkFun display is common Anode. So basically wherever the code sets pin to HIGH it needs to set it LOW and vice versa. I only had to make 4 changes to the code and I've highlighted them yellow. That should work. Good luck!

Testato,If I understand you correctly, it is probably simplest to adjust the wiring rather than the code. Take a look at Arduino pins 10,11,12,13. Those corresponds to the digits.Say right now you have it wired like this:

Arduino

Display

10

P

11

Q

12

R

13

S

You have complete control as to which digit value correspond to which display digit. What if you re-wire it like this?