SparkFun Forums 

Where electronics enthusiasts find answers.

Your source for all things Atmel.
By fyrebug
#76417
I have the following led display
http://www.sparkfun.com/commerce/produc ... ts_id=9214

trying to build a clock for fun.

the issue is I can only get it to display all the same numbers 33:33 44:44 etc...

has anyone used one of these before and have any pointers on how to get different numbers? the spec sheet got me as far as the base numbers, but I can't understand it well enough to see how to do multiple different ones.

thanks!
User avatar
By leon_heller
#76423
You need a buffer for the four digits, and code to display each digit in the buffer, in the correct positions.

Leon
By fyrebug
#76426
sorry leon I'm not sure what you mean by that....
By inventore123
#76429
The tecnique is called multiplexing.
Say you want to show the number 12:34, you drive segments A to G to show number 1, and drive the common cathode (or anode, depends on the display) of the first digit,
then you show 2 on the second digit, 3 on the third and 4 on the fourth.
If you repeat that sequence fast enough, say > 50 times a second, your eye will see 12:34.
This is very easy to do with a microcontroller.
By riden
#76439
inventore123 has it right and it is pretty easy to do.

fyrebug, what controller are you using (PIC, Arudino/AtMega, other)?
By fyrebug
#76440
using an arduino this time round, multi plexing now makes perfect sense, the only part I'm now confused on is which is positive and ground.

should I be using a transistor for the common pin?
By riden
#76441
The datasheet says these are common cathode devices so the common goes to GND. Yes, use a NPN transistor driven by the Arduino for each common line (digit). Use a 1K resistor connected between the Arduino and the base of transistor. The emitter goes to GND and the collector to the common wire of the display.
By fyrebug
#76449
so the other non common pins go to the data output pins of the arduino and that's what supplies the +5v correct?
I'm a little confused as to where the led resistor goes though, I get that there should be one between the transistor and arduino, so the pin of the NPN tied to ground should have a resistor as well correct?

thanks!
User avatar
By leon_heller
#76451
You need a resistor between each output from the MCU and the segments it is controlling.

Leon
By riden
#76454
leon_heller wrote:You need a resistor between each output from the MCU and the segments it is controlling.Leon
Good catch, Leon. I've been multiplexing a single segment at time for so long that I forgot that important requirement. And I'm the one that is always reminding everyone to use current limiting resistors when driving LEDs. :oops:

fyrebug, you need a resistor (470 ohms should do) between each Arduino output pin and each of the 7 segments (8, if you count the decimal point). Then you connect the transistor as I described before to each digit. There is a 1K resistor from the Arduino output pin and the base of the NPN transistor.
By fyrebug
#76456
PERFECT!!!

I'll be trying that out tomo then!

thanks guys, multi plexing in general opens up a whole new exciting world of LESS PINS being used. which is great!